<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
--></style><title>Re: [Live-devel] "no-blocking fashion" in
doGetNextFrame()</title></head><body>
<blockquote type="cite" cite>In doGetNextFrame() member fuction of
DeviceSource, I want to call "deliverFrame" in a
non-blocking fashion,<br>
</blockquote>
<blockquote type="cite" cite>I wrote my code <a
href=
"http://lists.live555.com/pipermail/live-devel/2005-September/003276.html"
>(follow the example</a> <a
href=
"http://lists.live555.com/pipermail/live-devel/2005-September/003276.html.)"
><font
color="#800080"><u
>http://lists.live555.com/pipermail/live-devel/2005-September/003276.<span
></span>html</u></font></a>.)<br>
<br>
It works,but another problem came out: it returns immediately when
"watchVarible==0"(no data is currntly available),<br>
<br>
but it still wait a long time even "watchVarible"
already became non-zero.<br>
<br>
My purpose is implementing the "deliverFrame" as soon as
possible when "watchVarible!=0".<br>
<br>
Could anyone help me? Thanks very much!<br>
<br>
Here is my code:<br>
<br>
void DeviceSource::doGetNextFrame()<br>
{<br>
<br>
envforH264->taskScheduler().doEventLoop(HasItemForH264); //Ha<span
></span>sItemForH264 is set non-zero in another thread after
it filled the buffer <br>
<br>
deliverFrame();</blockquote>
<blockquote type="cite" cite> }</blockquote>
<div><br></div>
<div>The problem with this is that - if no new data is currently
available - you will be executing the event loop forever, but the
"HasItemForH264" will never get set, because nothing will
ever call "deliverFrame()".</div>
<div><br></div>
<div>Instead, the solution is for your *other* thread - the one that
handles your H.264 encoding - to be the one that sets the
"HasItemForH264" variable.</div>
<div><br></div>
<blockquote type="cite" cite> usleep(100);</blockquote>
<div><br></div>
<div>Don't do this - it will delay the whole application for 100ms,
and nothing else will get done during this time.</div>
<x-sigsep><pre>--
</pre></x-sigsep>
<div><br>
Ross Finlayson<br>
Live Networks, Inc.<br>
http://www.live555.com/</div>
</body>
</html>