[mythtv] DVD playback issues, patch
Mark Spieth
mark at digivation.com.au
Mon Nov 16 00:10:56 UTC 2009
>> also on dvd pts change, avsync_delay should be set to avsync_avg so that
>> there is no discontinuity in avsync_avg
>> determination.
>
>I'm not sure if I understand what you mean by pts change. The following
>line:
>
> if (! (avsync_delay > 2000000 && player_ctx->buffer->isDVD()))
> avsync_avg = (avsync_delay + (avsync_avg * 3)) / 4;
>
>... changes avsync_avg only if there is no large discontinuity in the video
>timecode. Doesn't that have the same effect? (Or were you referring to
>something else altogether? - when does pts change?)
it probably should be something like this
if (avsync_avg == MAXINT)
avsync_avg = avsync_delay;
// prevents major jitter when pts resets during dvd title
if (labs(avsync_delay) > 2000000 && player_ctx->buffer->isDVD())
avsync_delay = avsync_avg;
#define AVSYNC_TC 8
avsync_avg = (avsync_delay + (avsync_avg * (AVSYNC_TC-1))) /
AVSYNC_TC;
and in the constructor
set avsync_avg to MAXINT.
alternatively use a bool to indicate avsync_avg has not been set.
also notice the labs for dvd check. I think that is also important though
its only a guess.
however is 2 seconds enough for dvd?
I like the idea to smooth avg a bit more. would require some experimentation
to determine good values.
>Also:
>> a big problem is that the initial value of avsync_avg is 0 which is not
>> correct.
>> somehow it should be set to avsync_delay if it hasnt been set before.
>
>That would certainly be possible but I think the real problem is the
>av_delay calculation doesn't take the previous delay into account. That is,
>instead of (in pseudo code):
>
> avsync_delay = video.timecode - audio.timecode
>
>It should be:
>
> avsync_delay = video.timecode - audio.timecode + avsync_adjustment
no as avsync_adjustment is for realigning, not measuring and is based on the
refresh rate not the delivered rate.
avsync_delay is the instantaneous estimation of avsync.
avsync_avg is smoothed so that any minor variations dont cause excessive
frame double/skip jerkiness.
avsync_adjustment is not part of the delay estimation algo and shouldnt be.
I do see some jerkiness currently watching say motor racing at 1.8. or 1.75.
if the delived rate is not a close multiple of the refresh rate you notice a
bit more jerkiness. not that it's too noticable though.
cheers
mark
More information about the mythtv-dev
mailing list