[Live-devel] Graceful way to shut down a RTP or RTSP server.

Ross Finlayson finlayson at live.com
Thu May 6 01:48:43 PDT 2004


>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).


	Ross Finlayson
	LIVE.COM
	<http://www.live.com/>



More information about the live-devel mailing list