<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>foxmail 5.0</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="images/BG" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY leftMargin=0 topMargin=0>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=BG vAlign=top width=103 background=cid:__0@Foxmail.net><FONT
face=楷体_GB2312></FONT></TD>
<TD vAlign=top>
<DIV>
<DIV><FONT face=宋体></FONT></DIV></DIV>
<DIV>
<DIV><FONT face=宋体>Hi, Ross:<BR> </FONT></DIV>
<DIV><FONT face=宋体> I want streaming video from a usb camera,
capture the source then use TMN 3.0 <BR>encoding to H.263 frames, but the
encoding efficiency is low, in order to eliminate the delay, <BR>I use
multi-thread, so in the OnDemandServerMediaSubsession.cpp I change the
codes and create <BR>two thread like that:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT
face=宋体>OnDemandServerMediaSubsession::startStream(){<BR>..........<BR> hdH263Semaphore
= CreateSemaphore(NULL,1,1,"mysemaphore");</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体> if(hdH263Semaphore ==
NULL){<BR> printf("error when create
semaphore\n");<BR> exit(-1);<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体> hdtmnenc =
CreateThread(NULL,0,tmn_enc,hdH263Semaphore,0,&tmnthreadID);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体> if(hdtmnenc ==
NULL){<BR> printf("error when create thread
tmn\n");<BR> exit(-1);<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体> <BR> hdH263session =
CreateThread(NULL,0,startPlayingthread,(LPVOID)streamState,0,&h263sessionthreadID);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体> if(hdH263session ==
NULL){<BR> printf("error when create thread
tmn\n");<BR> exit(-1);<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>.........................</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>the first thread used to H.263 encode, the second
"startplayingthread" is used to execute the following procedure, <BR>and I
write H263plusSource.cpp like Device source, the TMN encoded frames are
feed to doGetNextFrame,<BR>then wait for encode thread completion and
going on ,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>void H263plusSource::doGetNextFrame()
{<BR>.............<BR>dwResult = WaitForSingleObject(hdH263Semaphore,
INFINITE);<BR>...................<BR>mBuffer =
read_tmn_h263str(h263temp);<BR>...............<BR>nextTask() =
envir().taskScheduler().scheduleDelayedTask(fDurationInMicroseconds,
<BR>(TaskFunc*)FramedSource::afterGetting, this);<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>but the last row, when use schduleDelayedTask the whole
procedure will halt here, if replace the schduleDelayedTask <BR>just
directly use "afterGetting(this)", the procedure could run, but at last
will be wrong because stack overflow error, is </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>the scheduleDelayedTask using for recursive return? so
how did I resolve the paradox?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>Thanks in advance for your help!<BR></FONT></DIV>
<DIV><FONT face=楷体_GB2312></FONT> </DIV>
<DIV><FONT face=宋体 size=2>Best regards! <BR></FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV>
<DIV><FONT face=宋体>
<DIV><FONT size=2><FONT
face=宋体> Jiang
jian<BR></FONT><FONT
face=宋体> <A
href="mailto:jiangjian@ict.ac.cn">jiangjian@ict.ac.cn</A></FONT></FONT></DIV>
<DIV><FONT face=宋体><FONT size=2>
2005-05-19</FONT></FONT></FONT></DIV></DIV></DIV></DIV></TD></TR></TBODY></TABLE></BODY></HTML>