[Live-devel] Stopping an RTP stream safely/Deleting objects

Emile Semmes emile.semmes at e6group.com
Thu Nov 17 14:45:31 PST 2011


Hi Ross,

Thanks for the quick and good advice. I wasn't too keen on using the 
watch variable to interrupt the doEventLoop() call. Using event triggers 
works great for me.

I'm no longer 'reusing' the videosink as I'll just recreate another one 
when the other one is disposed as you suggested.
As for exiting and restarting the process, what I'd like to do is 
actually have a single process with multiple thread with different RTP 
servers (not RTSP) in each. Is this possible using a single environment 
variable for the whole process but individual task schedulers per thread 
or should there be one of each (task scheduler and environment var) per 
thread. I'm betting that's what Sambhav is trying to do as well.
Also, are there any thread safety issue with this approach? Is this why 
you're suggesting a single process per server and exiting to delete 
allocated objects?

As an aside, I'm an experienced Gstreamer developer (plugin and 
application development) and I have to say it was significantly easier 
to get an RTP server to stream a file than it is do with Gstreamer; 
streaming live sources is Gstreamer's strength. (Hopefully 'Gstreamer' 
isn't a curse word here :) ).

I do wish the documentation was a bit more clearer than just Doxygen 
output though; are you the sole maintainer? Need some help?

-- 
Emile Semmes
Software Consultant
e6 Group, LLC
Office: (630) 376-0626
www.e6group.com

>> I have a similar use case in which the application has to start and stop the OnDemandRTSPServer before the EOF without the process being killed.
> Why?  It would be much better to just leave the server running, but add/remove "ServerMediaSubsession" objects as appropriate.
>
>
>> I am using the code of h264ESVideoTest of testOnDemandRTSPServer
>>
>> To stop the server i set the watchVariable to a non null value.
>> when the  doEventLoop(&watchVariable); returns
>>
>> I am doing the following.
>>        rtspServer->removeServerMediaSession(sms);
>>        delete sms;
>>        env->reclaim();
>>        delete scheduler;
>>
>> Next time when I start the server, port binding is failing.
>> Anything I am missing here ?
> A lot, unfortunately.
>
> First, after you call "removeServerMediaSubsession(sms)", you *must not* then do "delete sms" (or "Medium::close(sms)"), because that will cause the object to be deleted twice.
>
> Second, you shouldn't reclaim the "UsageEnvironment" object, unless you first delete all of the objects that use it.  In particular, you must first do
> 	Medium::close(rtspServer);
> but note that if you do that, then this will automatically remove all "ServerMediaSession" objects, so you won't need to do that yourself.
>
> But once again: Rather than doing all this, why not just exit() and then recreate a new process?  This would be much simpler.
>
>
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
>
>


More information about the live-devel mailing list