[Live-devel] Multi-threading

Němec Alexandr a.nemec at atlas.cz
Fri Dec 11 05:53:33 PST 2009


Hi,

I would suggest to review your code, we use it the same way in our testing environment for many IP cameras using one thread for each camera and we can safely exit each doEventLoop and the corresponding thread. You must ensure that you start to clean up all the objects _after_ the event loop has finished which is NOT directly after setting the watch variable, you must do a correct synchronization in your code to use live555 safely in a multithreaded environment.

Hope this helps.

Regards
Alex

>---------------------------------------------------------
>Od: Josep Aguilera
>Přijato: 11.12.2009 14:41:31
>Předmět: [Live-devel] Multi-threading
>
>Hi Ross,
>
>
>
>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. 
>
>Each camera creates an instance of the class and launch a thread passing the
>
>parameters of the class instance.
>
>
>
>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.
>
>
>
>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. See the crash code below.
>
>
>
>
>
>memmove(unsigned char * 0x00000000, unsigned char * 0x07e6db04, unsigned
>
>long 1460) line 171
>
>GRABADORA5! BufferedPacket::use(unsigned char *,unsigned int,unsigned int
>
>&,unsigned int &,unsigned short &,unsigned int &,struct timeval &,unsigned
>
>int &,unsigned int &) + 110 bytes
>
>GRABADORA5! MultiFramedRTPSource::doGetNextFrame1(void) + 232 bytes
>
>GRABADORA5! MultiFramedRTPSource::networkReadHandler(class
>
>MultiFramedRTPSource *,int) + 577 bytes
>
>GRABADORA5! BasicTaskScheduler::SingleStep(unsigned int) + 441 bytes
>
>GRABADORA5! BasicTaskScheduler0::doEventLoop(char *) + 26 bytes
>
>CRTSPCamera::ThreadFunc(void * 0x07e53840) line 376 + 39 bytes
>
>GRABADORA5! const DelayQueue::`vftable' address 0x0069ed28
>
>GRABADORA5! BasicTaskScheduler0::~BasicTaskScheduler0(void) + 47 bytes
>
>
>
>
>
>Thank you in advance.
>
>
>
>Josep Aguilera.
>
>
>
>-----Mensaje original-----
>
>De: live-devel-bounces at ns.live555.com
>
>[mailto:live-devel-bounces at ns.live555.com] En nombre de Ross Finlayson
>
>Enviado el: jueves, 10 de diciembre de 2009 18:14
>
>Para: LIVE555 Streaming Media - development & use
>
>Asunto: Re: [Live-devel] Crash on TaskScheduler DoEventLoop
>
>
>
>>We implemented a code to obtain raw data from cameras IP via RTSP 
>
>>using Live 555.
>
>>In order to obtain it, we create a class which each time a new 
>
>>camera it is connected
>
>>a new thread of the class is started.
>
>
>
>Have you read the FAQ entry about threads?
>
>-- 
>
>
>
>Ross Finlayson
>
>Live Networks, Inc.
>
>http://www.live555.com/
>
>_______________________________________________
>
>live-devel mailing list
>
>live-devel at lists.live555.com
>
>http://lists.live555.com/mailman/listinfo/live-devel
>
>
>
>_______________________________________________
>
>live-devel mailing list
>
>live-devel at lists.live555.com
>
>http://lists.live555.com/mailman/listinfo/live-devel
>
>
>
>


More information about the live-devel mailing list