[Live-devel] Streaming from a live source

Shaheed Abdol Shaheed at scansoft.co.za
Tue Apr 24 04:38:26 PDT 2012


Hi Ross,
 
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.
 
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.
 
This is a portion of my DeviceSource class (renamed to
InputDeviceSource):
 
 
void InputDeviceSource::deliverFrame0(void * clientData)
{
 reinterpret_cast<InputDeviceSource *>(clientData)->deliverFrame();
}
 
void InputDeviceSource::deliverFrame()
{
 if (!isCurrentlyAwaitingData()) return; //if not explicitly waiting for
data, we short-circuit. //this might not be neccessary
 
 fFrameSize = fParams.provider->GetData(fParams.stream, fTo, fMaxSize);
//this performs the copy. Copies last chunk of previous frame if
truncation would occur.
 
 if (fFrameSize <= fMaxSize)
 {
  fDurationInMicroseconds = 166666; //6 fps - set only when full frames
are delivered
  gettimeofday(&fPresentationTime, NULL);
 }
 else    //set to 0 when copying frame portions.
  fDurationInMicroseconds = 0;
 
 LOG((*g_logger), "deliverFrame - frameSize[" << fFrameSize <<"]
fMaxSize[" << fMaxSize <<"] fDuration[" << fDurationInMicroseconds
<<"]");    //write the log to disk
 
 if (fFrameSize > 0) //will be -1 if camera while waiting for data from
camera
  FramedSource::afterGetting(this);    //signal that data is available.
}
 
/*
Called from external thread when data becomes available.
*/
void InputDeviceSource::SignalDataWaiting(void * clientData)
{
 if (NULL == clientData)
  return; //sanity check - for some reason this could be null
 InputDeviceSource * source = reinterpret_cast<InputDeviceSource
*>(clientData);
 TaskScheduler * ourScheduler = source->m_scheduler; //added this member
(set in constructor)
 if (ourScheduler) //sanity check.
  ourScheduler->triggerEvent(source->eventTriggerId, source);
} //called from external thread when camera signals that data is ready
 
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?
 
Thank you
Regards
___________________________________

Shaheed Abdol

 

Web: www.scansoft.co.za <http://www.scansoft.co.za/> 
Tel:  +27 21 913 8664
Cell: +27 79 835 8771
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120424/03d8f6c6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 32497 bytes
Desc: SST Email.png
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120424/03d8f6c6/attachment-0001.png>


More information about the live-devel mailing list