[Live-devel] Ever-slowing frame-rate =(

Chad Ata Chad_Ata at Brightcom.com
Tue Oct 16 19:01:04 PDT 2007


Hi All,

I've written an MPEG1 DeviceSource which I'm feeding to an
MPEG1or2VideoStreamDiscreteFramer, which is being broadcast by a
DarwinInjector. I'm testing receiving the MPEG stream with QuickTime
Player. The incoming video stream plays fine for about 1 or 2 seconds, then
the frame rate starts to slow down and eventually reaches as low as 0.5fps

Here's some code snippets from deliverFrame():
      ...
      memcpy( fTo, currentData+offset, copySize ); // TODO - error - check
against max size
      offset += copySize;
      currentDataSize -= copySize;
      if( currentDataSize > 0 )
            fNumTruncatedBytes = currentDataSize;
      else
            fNumTruncatedBytes = 0;
      fFrameSize = copySize;
      fDurationInMicroseconds = 1000000/25;
      if ( fPresentationTime.tv_sec == 0 && fPresentationTime.tv_usec == 0
)
      {
            gettimeofday ( &fPresentationTime, NULL );
      }
      else
      {
            unsigned uSeconds = fPresentationTime.tv_usec +
fDurationInMicroseconds;
            fPresentationTime.tv_sec += uSeconds/1000000;
            fPresentationTime.tv_usec = uSeconds%1000000;
      }
      ...
I've tried setting fDurationInMicroseconds to 0 and fPresentationTime to
gettimeofday(...), but that didn't help.
I looked at the   MPEG1or2VideoStreamDiscreteFramer code, and noticed that
it got it's frame rate from fTo[7] - so I printed that out and it displays
the correct frame rate (25fps) once every 12 or so frames. The rest of the
time it is 60fps.

Anybody have any suggestions? Is it a problem with my encoder? are my
presentationTimes incorrect? should I not be using the ..DiscreteFramer?
Any help is greatly appreciated!

Thanks! =)

-Chad



More information about the live-devel mailing list