>> I would like to simulate packet loss of RTP packets on the network, >> and I would like to use Live555 to do this. In fact, there already >> is some code in MultiFramedRTPSink (in the >> MultiFramedRTPSink::sendPacketIfNecessary() function) which is >> contained in a "TEST_LOSS" macro, and is hardcoded to simulate 10% >> loss: >> >> #ifdef TEST_LOSS >> if ((our_random()%10) != 0) // simulate 10% packet loss >> ##### #endif >> >> I would like to do some more sophisticated testing (e.g. change the >> packet loss to 5% or 25%). What is the "right" way to do this? > > Normally I don't advise modifying the supplied code. However, > because you just want to simulate packet loss for testing (i.e., I > presume you don't plan on building a product that loses packets , > you might as well just modify the (#ifdef'd out) code that's already > there. > > E.g., if you want to simulate N% packet loss (where N is an integer > in the range [0,100], then you could change the "if" condition above > to if ((our_random()%100 >= N) // simulate N% packet loss
Thanks Ross. But actually, I DO want to build it into the product. Because the product is portable, I want to be able to turn on the packet loss feature in the field, and for multiple installations. I also want to things like rearrange the packets so that they arrive in the wrong order, so I can be sure that they are being reordered properly.
But I just wanted to be sure that there wasn't any C++ trick that I hadn't thought of that was preventing me from subclassing this properly so that I can overload the private functions. I guess that I am hacking the library more than the typical user. Also, C++ is not my best language (I'm more of a C and Java guy).
--Andy Stevens _______________________________________________ live-devel mailing list live-devel@lists.live555.com http://lists.live555.com/mailman/listinfo/live-devel