From 750c29766f9f2ef3df62613fa8eccb6fca0e2de2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 19 Oct 2015 23:45:43 +0200 Subject: player: be slightly less prone to framedrop in display sync mode 1 to 2 frames desync is still tolerable, and will be quickly compensated (if everything works). --- player/video.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'player') diff --git a/player/video.c b/player/video.c index 5b3ef0a783..7d423cb50c 100644 --- a/player/video.c +++ b/player/video.c @@ -960,10 +960,14 @@ static void handle_display_sync_frame(struct MPContext *mpctx, // If we are too far ahead/behind, attempt to drop/repeat frames. In // particular, don't attempt to change speed for them. - if (drop) { + if (drop) drop_repeat = -av_diff / vsync; // round towards 0 - av_diff += drop_repeat * vsync; - } + + // Tolerate at least 1 video frame desync. + if (abs(drop_repeat) <= 1) + drop_repeat = 0; + + av_diff += drop_repeat * vsync; if (resample) { double audio_factor = 1.0; -- cgit v1.2.3