[Live-devel] Multi-threading

Ross Finlayson finlayson at live555.com
Fri Dec 11 05:49:28 PST 2009


>Following the FAQ list where is explained that the library assumes only a
>thread of execution we created a
>class where the UsageEnvironment variable as well as MediaSession,
>MediaSubsession are defined.

You will also need a separate "TaskScheduler" object for each.  And 
*no* "liveMedia" objects at all can be shared between different 
threads; each thread must create and use completely separate objects.


>Each camera creates an instance of the class and launch a thread passing the
>parameters of the class instance.

You probably don't need multiple threads for this.  Instead, your 
application should still be able to use a single event loop, even 
with multiple data sources.


>Therefore as you say in the FAQ, if each thread has its own UsageEnvironment
>and event loop, it is possible to access simultaneously
>different threads to the library.

Yes, although this has not been well tested, and is still not recommended.


>However still when we are trying to close the event loop (doEventLoop) and
>we have more than one camera (with one works fine) the
>library crash.

Unfortunately you're going to have to figure this out yourself.  It's 
possible that there is still some shared memory somewhere that is 
getting messed up when accessed by more than one thread.  If you find 
this, please let us know.

Alternatively, as I noted above, you could just have your multiple 
cameras use a single event loop.

-- 

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


More information about the live-devel mailing list