[Live-devel] Sorry about that, but I forgot my name... (How to add remove a ServerMediaSubssesion on the fly?)
Σκαζίκης Ιωάννης
iskaz at intracomdefense.com
Fri Mar 27 06:21:59 PDT 2009
Hi Ross,
I have written an mpeg4 streamer based on live555 using (My)DeviceSource
class, (My)VideoFileServerMediaSubsession class, and the
MPEG4VideoStreamDiscreteFramer (based on your testOnDemandRTSPServer
example).
Everything works fine, but I would like to ask you the following:
While an rtsp client is connected to the server I would like to remove
the mediaSession and set up another one. How to do that?
I have a function which add's an sms:
fnct_add(){
ServerMediaSession* sms
= ServerMediaSession::createNew(*env, streamName, streamName,
descriptionString);
sms->addSubsession(XvidVideoFileServerMediaSubsession::createNew(*env,
inputFileName, reuseFirstSource));
rtspServer->addServerMediaSession(sms);
}
and one function which removes the sms:
fnct_remove(){
sms->close(*env,streamName);
sms->~ServerMediaSession();
}
I run the
env->taskScheduler().doEventLoop(&watch_event_loop);
in its on process (new thread) and i use the watch_event_loop + a
dummyTask(Null) to control the event loop.
In order to remove an sms I do:
1) set watch_event_loop =1 ion order to stop the endless loop
2) remove the sms ( sms->close(*env,streamName); and
sms->~ServerMediaSession();
3)stop the tread which runs the
env->taskScheduler().doEventLoop(&watch_event_loop);
in order to add a new sms I do:
1) add a new sms with
ServerMediaSession* sms
= ServerMediaSession::createNew(*env, streamName, streamName,
descriptionString);
sms->addSubsession(XvidVideoFileServerMediaSubsession::createNew(*env,
inputFileName, reuseFirstSource));
rtspServer->addServerMediaSession(sms);
2) set watch_event_loop=0
3) create a new thread which runs the
env->taskScheduler().doEventLoop(&watch_event_loop);
Generally this process seems to work, but while the client (mplayer) is
connected and the server is streaming, if we remove the sms the client
stops playing the video stream but it does not close the connection with
the server and therefore live555 does not call the deconstructor of
(My)DeviceSource class (which it does, if I stop the client first).
if I call again the function which add a new sms, then and only then
live555 call's the deconstructor of (My)DeviceSource class first (which
stops my frame grabber card) and then initialize a new instance of
(My)DeviceSource (which starts my frame grabber card) when a client
atemps to connect to the server again.
Why after the execution of sms->~ServerMediaSession(); does not call
the deconstructor of (My)DeviceSource class?
Why the connection between client and server does not close, when I
remove the sms?
Which is the right way to add /remove an sms during a connection between
server and client?
Thanks in advance,
Ioannis Skazikis
Intracom Defense Electronics.
More information about the live-devel
mailing list