> 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/

_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to