[mythtv] Reasonable avsync at startup

Bruce Markey bjm at lvcm.com
Sat Aug 28 17:48:24 EDT 2004

Doug Larrick wrote:
> And no, despite the subject line, I have no patch to attach.  I was 
> gonna include my instrumentation code but realized it would need more 
> work to be presentable in public.

The output that you posted had examples of a lot of important
stuff and I learned a few other things while looking it over.

One thing it shows is a long standing problem (at least pre-0.6!)
with the need to slew a lot at startup before audio and video
come into sync. It would be great if you could look into this
to help make the best possible DVR for all of us =).

It seems that audio time and video time are initially set relative
to the system clock. However, video is almost always way ahead
of audio by tens of frames and has to wait for audio to catch up.

This was the maximum delay fix that I put in CalcDelay. Yes, I
agree that this should be handled by the sync calculation in
NuppelVideoPlayer.cpp. Still, I put it in CalcDelay as a last
line of defense as it should have this as a sanity check so
that it doesn't ask WaitForFrame to stall for an unreasonable
amount of time.

If you look at each of your three logs, they follow the same
pattern. The SyncDelay doesn't settle until about frame 150
(5 seconds!). Two iterations of a refresh interval every 4th
frame (avsync_adjust?), lots of frame interval delays on every
other frame then (CalcDelay adjustment?) then lots more
refresh intervals every 4th frame. If you add these all up,
video had to slow down by about 30 frames before it locked in.

It would be great to find a way that the audio and video could
start within a few frames of each other so that they could settle
in the first fraction of a second.

--  bjm

More information about the mythtv-dev mailing list