[Live-devel] simulate RTP packet loss

Ross Finlayson finlayson at live555.com
Wed Sep 5 15:38:54 PDT 2012


> 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

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120905/e547479b/attachment.html>


More information about the live-devel mailing list