<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">The call to doGetNextFrame (<span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; ">doGetNextFrame(<span style="color: #aa0d91">void</span> *data, <span style="color: #aa0d91">int</span> len) in my code</span>) only happens when data is present. &nbsp;Than in (<span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; ">doGetNextFrame(<span style="color: #aa0d91">void</span> *data, <span style="color: #aa0d91">int</span> len) </span>in my code)&nbsp;function I call&nbsp;<span class="Apple-style-span" style="color: rgb(38, 71, 75); font-family: Monaco; font-size: 10px; ">deliverFrame<span style="color: #000000">(data, len);</span></span>&nbsp;function passing the data.<div><br></div><div>But the function&nbsp;<span class="Apple-style-span" style="color: rgb(38, 71, 75); font-family: Monaco; font-size: 10px; ">deliverFrame<span style="color: rgb(0, 0, 0); ">(data, len); <font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">the if statement</span></font><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">&nbsp;<span class="Apple-style-span" style="color: rgb(0, 116, 0); font-family: Monaco; font-size: 10px; "><span style="color: #aa0d91"><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">if</span></font></span><span style="color: #000000"> (!</span><span style="color: #26474b">isCurrentlyAwaitingData</span><span style="color: #000000">()) </span><span style="color: #aa0d91">return</span><span style=""><font class="Apple-style-span" color="#000000">; <font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">(part of deviceSource.cpp)</span></font></font></span><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;</span></font></span><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; ">returns most of the time, so only 1 frame in ~5 make into&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; ">fTo<span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">.</span></span></span></span></span></span></span></div><div><br></div><div>In deliverFrame function, which of the following is correct?</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(63, 110, 116); "><span style="color: #000000">&nbsp; </span>FramedSource<span style="color: #000000">::</span><span style="color: #26474b">afterGetting</span><span style="color: #000000">(</span><span style="color: #aa0d91">this</span><span style="color: #000000">); &nbsp;<font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">&lt;-only 1 and 5 frames</span></font></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(63, 110, 116); "><font class="Apple-style-span" color="#000000">or<span class="Apple-style-span" style="color: rgb(0, 116, 0); "></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(63, 110, 116); "><font class="Apple-style-span" color="#000000"><span class="Apple-style-span" style="color: rgb(0, 116, 0); ">&nbsp;&nbsp;nextTask() = <span class="Apple-tab-span" style="white-space:pre">        </span>envir().taskScheduler().scheduleDelayedTask(0,&nbsp;(TaskFunc*)afterGetting, this); &nbsp;<font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><font class="Apple-style-span" color="#101010">&lt;-this gives the error "</font></span></font><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><font class="Apple-style-span" color="#101010">g</font></span></font><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; ">etNextFrame(): attempting to read more than once at the same time!"</span></span></font></div><div><font class="Apple-style-span" color="#007400" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div></div><div><span class="Apple-style-span" style="color: rgb(0, 116, 0); font-family: Monaco; font-size: 10px; "><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; "><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">Thanks</span></span></span></span></div><div>Austin</div><div><br></div><div><div><div>On Dec 26, 2008, at 7:59 PM, Ross Finlayson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><blockquote type="cite">Hello All,<br></blockquote><blockquote type="cite">I have created my own deviceSource.cpp for my live input from QTKit, I call doGetNextFrame with my data and than pass it to deliverFrame. I have based my streaming from MPEG4ToVideoStreamer, which blocks at env->taskScheduler().doEventLoop(); // does not return and does not allow my live input code to continue. &nbsp;It there a way to allow my other code to continue.<br></blockquote><br>"deliverFrame()" should be called *only when* data is available to be delivered to the downstream object. &nbsp;(Your "doGetNextFrame()" implementation should return immediately - without calling "deliverFrame()" - if no data is currently available to be delivered.)<br><br>This means that the availabllty of new data needs to be recognized/handled as an 'event' by the event loop.<br><br>Unfortunately there's no one standard way of handling the arrival of new data as an 'event', because it depends on your particular environment (in particular, the nature of your input device). &nbsp;If your input device can be treated as an open file, then it's easy, because you can use the event loop's existing "select()" mechanism, by calling "TaskScheduler:: turnOnBackgroundReadHandling()" (see the comments in "DeviceSource.cpp"). &nbsp;You should do it this way, if you can.<br><br>If, however, your input device cannot be treated as an open file, then you have to do something else to handle the arrival of new data as an 'event'. &nbsp;Some people use the optional "watchVariable" parameter (to "TaskScheduler::doEventLoop()") for this purpose. (See, for example, &lt;<a href="http://lists.live555.com/pipermail/live-devel/2005-September/003276.html">http://lists.live555.com/pipermail/live-devel/2005-September/003276.html</a>>. Note, however, that if you use the 'watchVariable' feature, you should also note this point: &lt;<a href="http://lists.live555.com/pipermail/live-devel/2006-March/004192.html">http://lists.live555.com/pipermail/live-devel/2006-March/004192.html</a>>)<br><br>An alternative way to recognize the arrival of new data as an event would be to subclass "TaskScheduler" to implement your own event loop - but that is more difficult.<br>-- <br><br>Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a><br>_______________________________________________<br>live-devel mailing list<br>live-devel@lists.live555.com<br>http://lists.live555.com/mailman/listinfo/live-devel<br></div></blockquote></div><br></div></body></html>