<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Scansoft</TITLE>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16441"></HEAD>
<BODY
style="BACKGROUND-COLOR: #e0e0e0; FONT-FAMILY: Trebuchet MS; COLOR: #005080; FONT-SIZE: 10pt"
background="" bgColor=#e0e0e0>
<DIV><SPAN class=799491911-24042012>Hi Ross,</SPAN></DIV>
<DIV><SPAN class=799491911-24042012></SPAN> </DIV>
<DIV><SPAN class=799491911-24042012>I have read the FAQ, and searched this list
for answers. I have found a similar issue and there you advised the user to
actually allow the frames to be dropped, and to set the fNumTruncatedBytes
variable to the correct value. I am using the DeviceSource class to
encapsulate a live source (camera). My downstream object is a
MPEG4VideoStreamDiscreteFramer, which has the correct buffer sizes
etc.</SPAN></DIV>
<DIV><SPAN class=799491911-24042012></SPAN> </DIV>
<DIV><SPAN class=799491911-24042012>I am using the Event Trigger method to
signal that new data has arrived at the camera, but for some reason the stream
"dies" after a few seconds (using VLC to connect to RTSP stream). Looking at the
logs I have added, it is clear that the frames are not being handled
properly.</SPAN></DIV>
<DIV><SPAN class=799491911-24042012></SPAN> </DIV>
<DIV><SPAN class=799491911-24042012>This is a portion of my DeviceSource class
(renamed to InputDeviceSource):</SPAN></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>void InputDeviceSource::deliverFrame0(void *
clientData)<BR>{<BR> reinterpret_cast<InputDeviceSource
*>(clientData)->deliverFrame();<BR>}</DIV>
<DIV> </DIV>
<DIV>void InputDeviceSource::deliverFrame()<BR>{<BR> if
(!isCurrentlyAwaitingData()) return; //if not explicitly waiting for data,
we short-circuit. //this might not be neccessary</DIV>
<DIV> </DIV>
<DIV> fFrameSize = fParams.provider->GetData(fParams.stream, fTo,
fMaxSize); //this performs the copy.<SPAN class=799491911-24042012> Copies
last chunk of previous frame if truncation would occur.</SPAN></DIV>
<DIV> </DIV>
<DIV> if (fFrameSize <=
fMaxSize)<BR> {<BR> fDurationInMicroseconds = 166666; //6
fps<SPAN class=799491911-24042012> - set only when full frames are
delivered</SPAN><BR> gettimeofday(&fPresentationTime,
NULL);<BR> }<BR> else<SPAN
class=799491911-24042012> //set to 0 when copying frame
portions.</SPAN><BR> fDurationInMicroseconds = 0;</DIV>
<DIV> </DIV>
<DIV> LOG((*g_logger), "deliverFrame - frameSize[" << fFrameSize
<<"] fMaxSize[" << fMaxSize <<"] fDuration[" <<
fDurationInMicroseconds <<"]");<SPAN
class=799491911-24042012> //write the log to disk</SPAN></DIV>
<DIV> </DIV>
<DIV> if (fFrameSize > 0) //will be -1 if camera while waiting for
data from camera<BR> FramedSource::afterGetting(this);<SPAN
class=799491911-24042012> //signal that data is
available.</SPAN><BR>}</DIV>
<DIV> </DIV>
<DIV><SPAN class=799491911-24042012>/*</SPAN></DIV>
<DIV><SPAN class=799491911-24042012>Called from external thread when data
becomes available.</SPAN></DIV>
<DIV><SPAN class=799491911-24042012>*/</SPAN></DIV>
<DIV>void InputDeviceSource::SignalDataWaiting(void *
clientData)<BR>{<BR> if (NULL ==
clientData)<BR> return; //sanity check - for some reason this
could be null<BR> InputDeviceSource * source =
reinterpret_cast<InputDeviceSource *>(clientData);<BR> TaskScheduler
* ourScheduler = source->m_scheduler; //added this member (set in
constructor)<BR> if (ourScheduler) //sanity
check.<BR> ourScheduler->triggerEvent(source->eventTriggerId,
source);<BR>} //called from external thread when camera signals that data
is ready</DIV>
<DIV> </DIV>
<DIV><SPAN class=799491911-24042012>I am doing my best to call signalDataWaiting
from the external thread when we detect that only a portion of a frame has been
delivered to the DiscreteStreamFramer. Should I call signalDataWaiting for frame
portions? Or should I truncate the data and allow the following full frame to be
sent?</SPAN></DIV>
<DIV><SPAN class=799491911-24042012></SPAN> </DIV>
<DIV><SPAN class=799491911-24042012>Thank you</SPAN></DIV>
<DIV><SPAN class=799491911-24042012>Regards</SPAN></DIV>
<DIV align=left><STRONG>___________________________________</STRONG></DIV><BR>
<DIV align=left><STRONG>Shaheed Abdol</STRONG></DIV><BR>
<DIV align=left><FONT color=#909090 size=1><STRONG></STRONG></FONT></DIV><IMG
border=0 hspace=0 alt="Scansoft Technologies" align=baseline
src="cid:799491911@24042012-0CCB"><BR>
<DIV align=left><FONT color=#909090 size=1><STRONG>Web: <A
href="http://www.scansoft.co.za/">www.scansoft.co.za</A></DIV>
<DIV align=left><FONT color=#909090 size=1><STRONG>Tel: +27 21 913
8664</STRONG></FONT></DIV>
<DIV align=left><FONT color=#909090 size=1><STRONG>Cell: +27 79 835
8771</STRONG></FONT></DIV></STRONG></FONT>
<DIV> </DIV></BODY></HTML>