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.

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 ?


On Tue, Nov 15, 2011 at 9:03 AM, Ross Finlayson <finlay...@live555.com>wrote:

> I'm streaming an MPEG-2 TS file using code very similar to
> testMPEG2TransportStreamer.cpp. In one of my use cases, I need to stop the
> stream immediately instead of allowing it to complete. I'm doing this
> currently by passing a watch variable to the taskScheduler().doEventLoop()
> call and allowing another thread to set that variable when I need to stop
> playback.
>
>
> FYI (and this is unrelated to your question below), you might find it
> simpler to use the new 'event trigger' mechanism instead; see
> "UsageEnvironment/include/UsageEnvironment.hh"
>
>
> My question is what do I need to do after that to safely stop and delete
> my related objects (UsageEnvironment, RTPSink, etc) if I leave the
> doEventLoop() early?
>
>
> First, you can always just call "exit(0)" to leave and destroy the process
> (i.e., address space, i.e., application).  The OS will take care of
> closing/reclaiming its sockets.  This is by far the simplest thing to do,
> and it's what you should do - unless you have a very good reason for
> wanting to keep the process around.
>
> But, if you really want to keep the process around, you can reclaim the
> LIVE555 objects by doing the following (generally speaking, you're
> reclaiming objects in the reverse order from the order that you created
> them):
>
>   videoSink->stopPlaying();
>   Medium::close(videoSource);
>   Medium::close(videoSink);
>   delete rtpGroupsock;
>   delete rtcpGroupsock;
>   env->reclaim();
>   delete scheduler;
>
> (I'm basing this on the "testMPEG2TransportStreamer" code, because you
> said you used that code as a model.)
>
>
> I'd like to reuse the RTPsink but give it different parameters on a
> subsequent use.
>
>
> No, you can't do that.  Just delete it (using "Medium::close()"), and
> create a new one next time.
>
> But again, why not just exit the process (application), and launch a new
> one next time?
>
>
> 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
>
>
_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to