<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 9pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>Hi,<BR>
<BR>
In doGetNextFrame() member fuction of DeviceSource, I want to call "deliverFrame" in a non-blocking fashion,<BR>
<BR>
I wrote my code <SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><A href="http://lists.live555.com/pipermail/live-devel/2005-September/003276.html">(follow the example <U><FONT color=#800080><A href="http://lists.live555.com/pipermail/live-devel/2005-September/003276.html.)">http://lists.live555.com/pipermail/live-devel/2005-September/003276.html</FONT></U></A></SPAN>.)</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); //HasItemForH264 is set non-zero in another thread after it filled the buffer <BR><BR> deliverFrame();<BR> }<BR>
<BR>
<BR>
<BR>void DeviceSource::deliverFrame()<BR>{<BR> <BR> if (!isCurrentlyAwaitingData()) return; // we're not ready for the data yet<BR>
<BR>
pthread_mutex_lock(mutexforH264);<BR>
if(*HasItemForH264==99)<BR> {<BR>
<BR> fFrameSize=*LengthForH264; //LengthForH264 is defined in another thread <BR> if (fFrameSize > fMaxSize) {<BR> fNumTruncatedBytes = fFrameSize - fMaxSize;<BR> fFrameSize = fMaxSize;<BR> }<BR>
<BR> memcpy(fTo, BufferForH264, fFrameSize); //BufferForH264 is defined in another thread<BR> * HasItemForH264=0;<BR>
<BR> <BR>
}<BR> pthread_mutex_unlock(mutexforH264); <BR> <BR> usleep(100);<BR>
<BR> // After delivering the data, inform the reader that it is now available:<BR> <BR>
FramedSource::afterGetting(this);<BR> <BR>printf ("deliverFrame() is end !\n");<BR>}<BR>
<BR><br /><hr />通过 Windows Live Messenger 表达您自己! <a href='http://get.live.com/messenger/overview' target='_new'>Windows Live Messenger!</a></body>
</html>