<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 9pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>Hi Ross,<BR>
<BR>
I am sorry to trouble you again! I hope this will be the last question.<BR>
<BR>
I think I have solved the doEventLoop "delay" problem with your helps,thanks.<BR>
<BR>
But another problem came out:<BR>
<BR>
The program runs fine at the beginning. However, a few minutes later, the doGetNextFrame()<BR>
<BR>
function is called abnormal: After delivering the data, it delays a few seconds, and then call<BR>
<BR>
doGetNextFrame(). In a normal way, I think it should be called immediately after delivering the <BR>
<BR>
data.This lead to my client's playing speed slow down. I have tried both mplayer and openrtsp<BR>
<BR>
in the client, and got the same result. Can you give me some hints?<BR>
<BR>
Thanks<BR>
<BR>
<BR>
My code:<BR>
<BR>
void H264VideoStreamDiscreteFramer::doGetNextFrame()<BR> {<BR> <BR>
dummyTask(Null);<BR>
<BR> envforH264->taskScheduler().doEventLoop(HasItemForH264); <BR><BR> deliverFrame();<BR> <BR>}<BR>
<BR>
<BR>void H264VideoStreamDiscreteFramer::deliverFrame()<BR>{<BR> if (!isCurrentlyAwaitingData()) return; // we're not ready for the data yet<BR>
pthread_mutex_lock(mutexforH264);<BR>
if(*HasItemForH264==99)<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> pthread_mutex_unlock(mutexforH264); <BR> <BR> <BR> // After delivering the data, inform the reader that it is now available:<BR> FramedSource::afterGetting(this);<BR> <BR><BR>}<BR><br /><hr />通过 MSN Spaces,可以直接用电子邮件发布网络日志,上载笑话、照片等。它是免费的! <a href='http://spaces.msn.com' target='_new'>它是免费的!</a></body>
</html>