[Live-devel] RTSP Server suddenly stops streaming

Ross Finlayson finlayson at live555.com
Mon Oct 19 07:56:31 PDT 2015


(First, note that if you are receiving the mailing list as a ‘digest’, you should fix the “Subject:” line of your emails when you compose a reply.)


>> Why are you delaying the call to "FramedSource::afterGetting(this)" by 50 ms?
> 
> 
> But why not?

Because it’s putting the delay in the wrong place - i.e., after the data has been delivered to the downstream object, but before a RTP packet has been sent.  In other words, you’re unnecessarily delaying the sending of the first (and subsequent) RTP packets.

If you want to introduce a delay between sending RTP packets, then the right way to do this is to set the “fDurationInMicroseconds” member variable when you deliver the frame data.  This will cause the RTP packet to get sent immediately, but will delay the subsequent call to “doGetNextFrame()” (to request the next frame of data).


> If, e.g., my source has a 1fps frame rate, why not wait 900ms avoid a busy-wait?

If your source has a 1 fps frame rate, then you *may* set “fDurationInMicroseconds” to 1000000 (i.e., 1 million) each time you deliver a frame’s data (i.e., each time you copy data to the pointer pointed to by “fTo”).  *Then*, you notify the downstream object that the frame delivery has been done, by calling
	FramedSource::afterGetting(this);
i.e., without any delay.

However, because you are streaming from a ‘live’ source, you don’t really need to set “fDurationInMicroseconds” at all (in which case it will be left at its default value of 0).  But your use of the term “busy-wait” suggests that you are thinking about this code wrong - i.e., you think that you need to periodically ‘poll’ your encoder for data.  This is wrong.  LIVE555-based applications are event driven.  The right way to get data from an external encoder is to make the arrival of data an asynchronous ‘event’ - either by reading from a socket (if the encoder is an open file or pipe), or by encapsulating your encoder in a separate thread that calls “triggerEvent()” (the only LIVE555 function that can be called from an external thread) when new encoded data becomes available.  I suggest that you read “liveMedia/DeviceSource.cpp” once again - noting in particular the comments in that file.


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/20151019/f492492c/attachment.html>


More information about the live-devel mailing list