[Live-devel] RTSP Server Packet Loss

Ross Finlayson finlayson at live555.com
Fri Nov 27 08:23:32 PST 2015


No, there is no bug here (and so, there will be no change to the code).  UDP packets are not expected to be sent/received reliably; occasional packet loss can (and in general, will) occur.  This can occur for several reasons - including congestion on your network, which is the case here.

If a UDP socket write fails with a ‘would block’ error, then this is because you are - at least temporarily - exceeding the capacity of your network (by trying to send too much data too fast).  In this case it’s completely correct for the server to discard (i.e., not transmit) the outgoing UDP packet.  If the server were, instead, to ‘block’ until it became possible to transmit the packet, then this could take an arbitrary amount of time, and would also block the server from handling other events (including handling requests from and/or streaming to other concurrent clients) during that time.  (Note that LIVE555-based applications are event-based, using a single-threaded event loop for concurrency; that’s why I/O - including network I/O - is asynchronous (i.e., non-blocking).)


Note, however, that the Operating System has its own buffer for outgoing packets, and if your stream(s) happen to be especially bursty, then it it possible to increase the size of this buffer - so that it becomes less likely that transmission of outgoing packets will fail in this way.  This can be done using the “increaseSendBufferTo()” function.  By default, this buffer size is set to at least 50 kBytes (for each socket); note the call to “increaseSendBufferTo()” in “liveMedia/RTPInterface.cpp”.  If you wished, you *could* increase the size of this buffer even more by making another call to “increaseSendBufferTo()” (e.g., in your own “createNewRTPSink()” function, in your own “OnDemandServerMediaSubsession” subclass).  (The default size (50 kBytes) seems to be enough for most people, however.)


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




More information about the live-devel mailing list