From 466658ee7e64aa5c4dc7de30b0912c7c7a27282c Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 28 Oct 2015 23:50:37 +0100 Subject: player: fix display sync A/V difference estimation on drops When dropping or repeating frames, we essentially influence when the frame after the next frame will be shown, not the next frame. This led to dropping/repeating frames 2 times, because the A/V difference had a delay of one frame. Compensate it with the expected value. --- player/video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/player/video.c b/player/video.c index 5f85c7bab3..dfacbb7c3d 100644 --- a/player/video.c +++ b/player/video.c @@ -1040,6 +1040,8 @@ static void handle_display_sync_frame(struct MPContext *mpctx, // align frame timings on the vsync boundaries. This is unavoidable, and // for the sake of the video sync calculations we pretend it's perfect. mpctx->time_frame -= mpctx->display_sync_error; + // Likewise, we know sync is off, but is going to be compensated. + mpctx->time_frame += drop_repeat * vsync; mpctx->time_frame /= opts->playback_speed * video_speed_correction; mpctx->total_avsync_change = 0; -- cgit v1.2.3