<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">Hi All:</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><font face="Times New Roman"><span lang="EN-US">I would like to stream live video (encoded from my webcam) to the </span><span lang="EN-US">Darwin</span>
<span lang="EN-US"> streaming server, and I started from testMPEG4VideoToDarwin project in testprog. But there is one problem when trying to stop the project.</span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><span lang="EN-US"><font face="Times New Roman">Here is the code I modified in testMPEG4VideoToDarwin.cpp</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">char ThreadFlag = 0; </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">int live_streamer_main(const char *program_name, const char *server_ip)</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">{</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>TaskScheduler* scheduler = BasicTaskScheduler::createNew();</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>env = BasicUsageEnvironment::createNew(*scheduler);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>DarwinInjector* injector = DarwinInjector::createNew(*env, programName);</font></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>/* Create 'groupsocks' for RTP and RTCP here.*/</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>videoSink = MPEG4ESVideoRTPSink::createNew(*env, &rtpGroupsockVideo, 96);</font>
</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>play();</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>awaitConfigInfo(videoSink);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>/* Create (and start) a 'RTCP instance' for this RTP sink here: */</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>injector->addStream(videoSink, videoRTCP);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>injector->setDestination(dssNameOrAddress, remoteStreamName,</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-tab-count: 4"> </span>programName, "LIVE555 Streaming Media");</font>
</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>env->taskScheduler().doEventLoop(&ThreadFlag);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>afterPlaying(NULL);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>return 0; // only to prevent compiler warning</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">}</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">void afterPlaying(void* clientData) {</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>videoSink->stopPlaying();</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>Medium::close(videoSource);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">}</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">void play() {</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>videofileSource</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>= DeviceSource::createNew(*env, *DeviceParameters::createNew(inputvideoFileName,10));
</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>videoES = videofileSource;</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>videoSource = MPEG4VideoStreamFramer::createNew(*env, videoES);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>videoSink->startPlaying(*videoSource, afterPlaying, videoSink);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">}</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><span lang="EN-US"><font face="Times New Roman">When I set the ThreadFlag as -1, the program run to the afterplaying(), and crashed in the Medium::close(videoSource). I have traced the code and found it crashed in destructor of StreamParser. Is there something I forgot to stop? Please help me~
</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">Thank you.</font></span></p>