[mythtv] DVD playback issues, patch

Davin McCall davmac at davmac.org
Sun Nov 15 22:49:13 UTC 2009

On 16/11/09 07:55, Mark Spieth wrote:
> 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 

             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?)

> 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

(With some details omitted. For instance, avsync_adjustment has already 
been reset to 0 so we need to move that reset until after the 
calculation of avsync_delay)

Anyway it looks like we are getting closer to a real solution. I intend 
to post another patch soon.


More information about the mythtv-dev mailing list