[Live-devel] DeviceSource and RTSP server

Ross Finlayson finlayson at live555.com
Sun Jun 26 12:35:20 PDT 2011


>2011/6/26 Ross Finlayson <finlayson at live555.com>:
>>  Actually, you have this backwards.  Because you are streaming from a live
>>  input source, you want only one instance of your "DeviceSource" class to be
>>  created at a time, even if more than one client is connecting concurrently.
>
>All right, I've moved the initialization of DeviceSource and needed
>framer object outside *MediaSubsession implementation. I'm not sure
>what exactly the createNewStreamSource() function shall contain in
>this case.

It should do exactly the same as it always did: Create a new source 
object, hook it into a 'framer' (if necessary), and then return the 
resulting data source.  However, because you set "reuseFirstSource" 
to True in the call to the "OnDemandServerMediaSubsession" 
constructor, "createNewStreamSource()" will be called just once if 
two or more clients are accessing the stream concurrently.

However, this doesn't mean that "createNewStreamSource()" will be 
called *only* once.  Instead, if a client begins streaming, then 
closes the stream, then another client begins streaming, then 
"createNewStreamSource() will be called twice (with a call to 
"~DeviceSource()" inbetween.  (Also, "createNewStreamSource()" and 
then "~DeviceSource()" are also called to handle the very first RTSP 
"DESCRIBE" - so set up the stream's SDP description.)  You need to be 
prepared for "createNewStreamSource()" and "~DeviceSource()" to be 
called several times, in succession.


>I don't know why the
>~DeviceSource() is called after createNewRTPSink() execution.

See above.
-- 

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


More information about the live-devel mailing list