[Live-devel] Graceful way to shut down a RTP or RTSP server.
Dixon Siu
dixonsiu at mediaglue.co.jp
Fri May 7 13:08:48 PDT 2004
Hi Ross,
I read the faq and it does suggest that I can do the following:
1. env->taskScheduler().doEventLoop(stopRTSP);
2. stopRTSP = "0";
So that the doEventLoop with keep an eye on the variable stopRTSP. The
reason I want to do this is that when I use Medium::close(rtspServer), the
thread that starts the call to doEventLoop keeps hanging there, wasting
memory. So I want to exit from the doEventLoop manually, then call the
Medium::close(rtspServer) to clean up everything at the end.
I put the code in. However, when I set stopRTSP to "0", the loop cannot
exit. Am I missing something? I suspect that prodecure SingleStep (called
inside doEventLoop) is in a while loop so that it doesn't come back to
check the watchVariable in procedure doEventLoop. Please comment on this.
Thanks.
Regards,
Dixon
> >In my application, I have created a thread to start a RTSP server that
> >stream video1. Then on demand, I will create another thread just to add
> >session to the RTSP server that stream video2.
>
> NO! You can't do this! See
> <http://www.live.com/liveMedia/faq.html#threads>
>
> >I want to shutdown the server by using one of the
> >following methods:
> >1. RTSPServer::RTSPClientSession::handleCmd_TEARDOWN();
> >2. env->taskScheduler().doEventLoop("STOP");
>
> Both of these are very wrong. (The first is how the server (internally)
> closes down a client session; the second will just return
> immediately (see
> "BasicTaskScheduler0.cpp").)
>
> Instead, just call
> Medium::close(rtspServer);
> (if "rtspServer" is a pointer to your RTSP Server object).
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.677 / Virus Database: 439 - Release Date: 2004/05/04
More information about the live-devel
mailing list