[Live-devel] Limiting frame rate for a source

Ross Finlayson finlayson at live555.com
Tue Apr 22 13:38:30 PDT 2014


> However,
> when the client initially connects there is a somewhat strange sequence of calls. First there are the
> expected calls:
> 
> createNewStreamSource()
> createNewRTPSink()
> 
> to my OnDemandServerMediaSubsession subclass. These set up a JPEGVideoSource subclass
> and a standard JPEGVideoRTPSink. Immediately after this the destructor for my JPEGVideoSource 
> is called and the source is cleaned up. After this I again get:
> 
> createNewStreamSource()
> createNewRTPSink()
> 
> and now the streaming starts and never stops. Is it possible to enable some kind of debugging 
> output for Live555?

You don't need 'debugging', because in this case I can tell you exactly what is happening.

"createNewStreamSource()"+"createNewRTPSink()" is called the first time to create a frame source object and a 'dummy' RTP sink object, so that the server can figure out the stream's SDP description.  (This is the code "OnDemandServerMediaSubsession::sdpLines()".)  Then, the server code closes these source and sink objects.  This is when your source class's destructor gets called the first time.

Then, later - when the first RTSP client connects - "createNewStreamSource()"+"createNewRTPSink()" will get called again.  If you have set "reuseFirstSource" to True, then these will not get called again, until all clients have disconnected.  At this time, your source class's destructor will get called again, and then later - when another RTSP client connects - "createNewStreamSource()"+"createNewRTPSink()" will get called once more.  Etc.

The bottom line is that your 'frame source' class must allow for the possibility of the object being destroyed, then recreated - perhaps several times.  However, if you have set "reuseFirstSource" to True, then there will never be more than one of these objects created concurrently.  I.e., the sequence will always be "constructor", "destructor", "constructor", "destructor" ..., never "constructor", "constructor".

When the last RTSP client disconnects, then your 'frame source' class destructor *will* get called.  (If the RTSP client did a "TEARDOWN", then your destructor will get called then.  If the RTSP client disappears without doing a "TEARDOWN", then the client connection will get timed out - and your destructor will get called - 65 seconds later (assuming that you didn't change the server's "reclamationTestSeconds" parameter).)


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/20140422/a579d024/attachment-0001.html>


More information about the live-devel mailing list