<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 9pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>Hi Ross,<BR>
<BR>
I want to ask another question before you answer my previous question :)<BR>
<BR>
In DeviceSource::doGetNextFrame() ,it mentiond a "non-blocking fashion ", I read the maillist and <BR>
<BR>
write my own code ,but it doesn't work. Where is my fault? <BR>
<BR>
Thanks in advance.<BR>
<BR>
void H264VideoStreamDiscreteFramer::doGetNextFrame()<BR> {<BR> <BR><BR>//**************************non-blocking fashion**************************//<BR>while(1){<BR>
<BR>
envforH264->taskScheduler().doEventLoop(HasItemForH264);<BR><BR>
pthread_mutex_lock(&mutexforH264);<BR>
<BR>
if(*HasItemForH264==99)<BR> {<BR> deliverFrame();<BR> * HasItemForH264=0;<BR> } <BR> <BR> pthread_mutex_unlock(&mutexforH264); <BR>
<BR>
sleep(1);<BR> <BR> } <BR> <BR>
//if (0 /* the source stops being readable */) {<BR> // handleClosure(this);<BR> // return;<BR> // }<BR> <BR> <BR>}<BR><BR><BR><BR><BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #008080 2px solid; MARGIN-RIGHT: 0px">
<HR id=EC_stopSpelling>
From: zjuchenjun@hotmail.com<BR>To: live-devel@ns.live555.com<BR>Date: Wed, 17 Jan 2007 10:35:24 +0800<BR>Subject: Re: [Live-devel] "createNewStreamSource()" member function<BR><BR>
<META content="Microsoft SafeHTML" name=Generator>
<STYLE>
.ExternalClass P
{padding:0px;}
.ExternalClass
{font-size:9pt;font-family:Tahoma;}
</STYLE>
<FONT size=2>Hi ROSS,</FONT><BR><FONT size=2>Thanks for your reply!</FONT><BR><FONT size=2>I had defined "H264VideoStreamDiscreteFramer" to be a subclass of ""H264VideoStreamFramer".And the class "H264VideoStreamDiscreteFramer" included </FONT><BR><FONT size=2>two member function(I read your reply in maillist):void H264VideoStreamDiscreteFramer::doGetNextFrame(),</FONT><BR><FONT size=2> </FONT><FONT size=2> Boolean H264VideoStreamDiscreteFramer::currentNALUnitEndsAccessUnit().</FONT><BR><FONT size=2>Is it right ?</FONT><BR><FONT size=2> </FONT><BR><FONT size=2>According to your reply, I rewrite my code like this :</FONT><BR><FONT size=2></FONT> <BR><FONT size=2>//************************************************************************************************************************************//<BR>FramedSource* H264VideoLiveServerMediaSubsession<BR>::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) {</FONT><BR><FONT size=2> estBitrate = 320; // kbps, estimate ; see my notebook</FONT><BR><FONT size=2></FONT> <BR><BR><FONT size=2> // Create the video source:<BR>H264VideoStreamDiscreteFramer *liveSource<BR> =H264VideoStreamDiscreteFramer::createNew(*env_H264, NULL, buffers_H264, length_H264, bufferhasitem_H264, mutex_H264);<BR> if (liveSource == NULL) return NULL;<BR> <BR> return liveSource;<BR> <BR>}<BR><BR>//***********************************************************************************************************************************//</FONT><BR><FONT size=2></FONT> <BR><FONT size=2>Is it right?</FONT><BR><FONT size=3></FONT> <BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #008080 2px solid; MARGIN-RIGHT: 0px">
<HR id=EC_EC_stopSpelling>
Date: Tue, 16 Jan 2007 06:13:07 -0800<BR>To: live-devel@ns.live555.com<BR>From: finlayson@live555.com<BR>Subject: Re: [Live-devel] "createNewStreamSource()" member function<BR><BR>
<STYLE>
.ExternalClass blockquote, .ExternalClass dl, .ExternalClass ul, .ExternalClass ol, .ExternalClass li
{padding-top:0;padding-bottom:0;}
</STYLE>
<BLOCKQUOTE><FONT face="Times New Roman"> return H264VideoStreamFramer::createNew(envir(),liveSource); </FONT></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>You can't do this, because "H264VideoStreamFramer" is a virtual base class. Instead, you should define your own class "H263VideoStreamDiscreteFramer" to be a subclass of ""H264VideoStreamFramer". Then, your "H263VideoStreamDiscreteFramer" object can be the value returned by your implementation of "createNewStreamSource()".</DIV><PRE>--
</PRE>
<DIV><BR>Ross Finlayson<BR>Live Networks, Inc.<BR>http://www.live555.com/</DIV></BLOCKQUOTE><BR>
<HR>
ÂÊÏȳ¢ÊÔ Windows Live Mail¡£ <A href="http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d" target=_blank>Windows Live Mail</A> </BLOCKQUOTE><br /><hr />ÂÊÏȳ¢ÊÔ Windows Live Mail¡£ <a href='http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d' target='_new'>Windows Live Mail</a></body>
</html>