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.
This commit is contained in:
wm4 2015-10-28 23:50:37 +01:00
parent cf18922d19
commit 466658ee7e
1 changed files with 2 additions and 0 deletions

View File

@ -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;