summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/video.c10
1 files changed, 7 insertions, 3 deletions
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;