[Live-devel] How to set fPresentationTime in my framedsource

阳海件 erduhai at qq.com
Fri Oct 19 04:09:07 PDT 2012


Hi Ross,
I add a class  H264VideoUDPSource to live555 for my IP Camera project. when  played by VLC, its picture does not updated,and i can see a lot of picture drop in VLC information. 
code is like this:class H264VideoUDPSource: public FramedSource


void H264VideoUDPSource::doGetNextFrame() {
//fill a h264 frame
...
//set timestamp, since it is live source, i guess it can be wall clock time?
 gettimeofday(&fPresentationTime, NULL);
//live source don't need set duration
//fDurationInMicroseconds
  nextTask() = envir().taskScheduler().scheduleDelayedTask(0,
				(TaskFunc*)FramedSource::afterGetting, this);

}




//------
I also  try another way, when played in VLC, video is ok, but it get pause every few seconds.
  // Set the 'presentation time':
  if (fPresentationTime.tv_sec == 0 && fPresentationTime.tv_usec == 0) 
    gettimeofday(&fPresentationTime, NULL);
  else 
  	{
    // Increment by the play time of the previous frame:
    unsigned uSeconds = fPresentationTime.tv_usec + 1000000/25; //25fps, the real frame speed from camera is about 5~7frames/s
    fPresentationTime.tv_sec += uSeconds/1000000;
    fPresentationTime.tv_usec = uSeconds%1000000;
  }





Thank you!
jerry yang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20121019/14442258/attachment.html>


More information about the live-devel mailing list