[mythtv] DVD playback issues, from revision 22120 onwards
davmac at davmac.org
Sun Nov 8 13:15:57 UTC 2009
On 31/10/09 17:13, Johnny Stenback wrote:
> Others have seen this too, including myself. Thanks for doing the
> legwork to figure out when this broke! This is filed as ticket:
> among a few other tickets as well.
Some more on this problem. I've been digging in the source and have
found some interesting things, but I need help to make sense of them.
Basically, NuppelVideoPlayer and VideoSync seem to have different ideas
about the delay parameter to VideoSync::WaitForFrame(). VideoSync treats
it as a cumulative (the delay provided will always adjust the target
time for the next frame, represented in m_nexttrigger) whereas NVP
treats it as (kind of) an absolute, specifically, it provides a negative
value if video is behind audio or a positive value if video is ahead of
audio. The problem is it might not be VideoSync which is delaying the
video (more on this in a bit) in which case NVP will keep providing
negative values (in NVP::AVSync()) and VideoSync will tally these up
until eventually m_nexttrigger is a long way in the past (even though
the video might only be a bit behind the audio).
Sure enough, when that happens, VideoSync returns without actually
delaying, but as I mentioned, there may be something else delaying the
video. In the problem I see, AVSync() calls videoOutput->Show() which
results (at least for a while or in some situation) in an exactly
equivalent delay. Now that in itself seems wrong to me, but that is what
is happening (possibly this is while a still frame is showing, but I'd
need to investigate to be certain). Eventually the video gets ahead /
videoOutput->Show() stops delaying (end of still frame?), and when that
happens the video just races because m_nexttrigger is so far in the past
that calling WaitForNextFrame() with a positive delay value still
returns immediately (m_delay is too small).
Note that VideoSync (in CalcDelay()) specifically contains code to limit
the trigger time to 2 frames away. However it has no similar mechanism
to prevent the trigger from being too far in the past.
Given that NuppelVideoPlayer is the only user of VideoSync, it seems
that the nature of the delay parameter should be sorted out one way or
the other - as either an absolute or an accumlative delta.
More information about the mythtv-dev