<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Texto de globo Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EstiloCorreo17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.TextodegloboCar
        {mso-style-name:"Texto de globo Car";
        mso-style-priority:99;
        mso-style-link:"Texto de globo";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=ES link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>Hi Ross,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span lang=EN-US>We implemented a code to obtain raw data
from cameras IP via RTSP using Live 555.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>In order to obtain it, we create a class
which each time a new camera it is connected<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>a new thread of the class is started. You
can see the code below which is working properly<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>where each time the function AfterReadingFrame
is called a frame in the variable m_FrameBuffer<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>is available.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>The problem comes when we want to stop and
restart the class. Then we assign to the variable blockingValue a value<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>different to 0 and it crash the function <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>env->taskScheduler().doEventLoop(&blockingValue);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>with the following debug info as output<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>memmove(unsigned char * 0x00000000,
unsigned char * 0x07e6db04, unsigned long 1460) line 171<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>GRABADORA5! BufferedPacket::use(unsigned
char *,unsigned int,unsigned int &,unsigned int &,unsigned short
&,unsigned int &,struct timeval &,unsigned int &,unsigned int
&) + 110 bytes<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>GRABADORA5! MultiFramedRTPSource::doGetNextFrame1(void)
+ 232 bytes<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>GRABADORA5!
MultiFramedRTPSource::networkReadHandler(class MultiFramedRTPSource *,int) +
577 bytes<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>GRABADORA5!
BasicTaskScheduler::SingleStep(unsigned int) + 441 bytes<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>GRABADORA5!
BasicTaskScheduler0::doEventLoop(char *) + 26 bytes<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>CRTSPCamera::ThreadFunc(void * 0x07e53840)
line 376 + 39 bytes<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>GRABADORA5! const DelayQueue::`vftable'
address 0x0069ed28<o:p></o:p></span></p>
<p class=MsoNormal>GRABADORA5! BasicTaskScheduler0::~BasicTaskScheduler0(void)
+ 47 bytes<o:p></o:p></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>I checked in the mailing lists and it seems
that it is working well to everybody! <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>I also called a dummy function before the
doEventLoop obtaining the same crash.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Thank you in advance! <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US> ---- Source Code
--------------------------------------------<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>void CRTSP_PlayerDlg::dummyTask(void*
pData) <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>{<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> // Call this again, after a brief delay:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> CRTSP_PlayerDlg *pDlg =
(CRTSP_PlayerDlg*) pData;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> if(pDlg)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> {<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> int
uSecsToDelay = 100000; // 100 ms<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> pDlg->env->taskScheduler().scheduleDelayedTask(uSecsToDelay,(TaskFunc*)dummyTask,
NULL);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>}<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>char blockingValue = 0;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>UINT CRTSP_PlayerDlg::ThreadFunc(LPVOID
pParam)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>{<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US> CRTSP_PlayerDlg
*pCaptureFrame = (CRTSP_PlayerDlg *)pParam;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US> MediaSubsessionIterator
iter(*(pCaptureFrame->mediaSession));<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> iter.reset();<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> while ((subsession =
iter.next()) != NULL)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> {<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> if( subsession->readSource()
== NULL ) continue;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> else<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> {<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> unsigned
flags = 0;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> if
(strcmp(subsession->mediumName(), "audio") == 0) <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> {<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> }
<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> else
if (strcmp(subsession->mediumName(), "video") == 0) <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> {<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> subsession->readSource()->getNextFrame(m_FrameBuffer,MAX_RTP_FRAME_SIZE,AfterReadingFrame,subsession,onSourceClosure,subsession);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> }<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal style='text-indent:35.4pt'><span lang=EN-US>//dummyTask(this);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> env->taskScheduler().doEventLoop(&blockingValue);
<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>return 1;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>}<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>void
CRTSP_PlayerDlg::AfterReadingFrame(void* clientData, unsigned frameSize,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> unsigned
/*numTruncatedBytes*/,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> struct
timeval presentationTime,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> unsigned
/*durationInMicroseconds*/)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>{ <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> MediaSubsession*
bufferQueue = (MediaSubsession*)clientData;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> ZeroMemory(m_FrameBuffer,frameSize);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> bufferQueue->readSource()->getNextFrame(m_FrameBuffer,MAX_RTP_FRAME_SIZE,AfterReadingFrame,bufferQueue,onSourceClosure,bufferQueue);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>}<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Best Regards,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Josep Aguilera<o:p></o:p></p>
</div>
</body>
</html>