summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-28 23:50:37 +0100
committerwm4 <wm4@nowhere>2015-10-28 23:57:24 +0100
commit466658ee7e64aa5c4dc7de30b0912c7c7a27282c (patch)
treed223a24d34b7d5b5a28a2db6ee04674d61fd4340
parentcf18922d197babf74891d0d5950f602a80734e89 (diff)
downloadmpv-466658ee7e64aa5c4dc7de30b0912c7c7a27282c.tar.bz2
mpv-466658ee7e64aa5c4dc7de30b0912c7c7a27282c.tar.xz
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.
-rw-r--r--player/video.c2
1 files changed, 2 insertions, 0 deletions
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;