[Live-devel] RTSPServer addServerMediaSession

Ross Finlayson finlayson at live555.com
Mon Mar 25 16:23:13 PDT 2013


> In all the examples I have seen, media sessions are added to the server before the event loop is started.
>  
> Is it safe to call addServerMediaSession while the server is already running?

Yes.


> Of course addServerMediaSession is necessarily called form a different thread than the one event loop.

No!  You *cannot* call any LIVE555 library function (except "TaskScheduler::triggerEvent()") from a non-event-loop thread.  I have explained this in the FAQ, and on this mailing list far many more times than I can count!

You can call "addServerMediaSession()" - from the event loop thread - at any time, but if you do this after you've already called "doEventLoop()" - i..e., while you're running in the event loop - then (obviously) you must do this from an event handler.  So, you'll need to set up an event handler function that calls "addServerMediaSession()", and set up an event that gets handled by this event handler.

The best way to do this from a separate thread is to first (in the LIVE555 thread) create an event trigger using "TashScheduler::createEventTrigger()", and then (in the separate thread) call "TaskScheduler::triggerEvent()".  For details, see "UsageEnvironment/include/UsageEnvironment.hh", and also the example in "liveMedia/DeviceSource.cpp".


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20130325/dc6a15d9/attachment.html>


More information about the live-devel mailing list