From b2503efbc2052827d7ba39549032f4b5165ffe93 Mon Sep 17 00:00:00 2001 From: llyyr Date: Mon, 4 Nov 2024 12:36:05 +0530 Subject: [PATCH] vo: update base_vsync even for initial samples This is still used for caclulating a/v sync and delay remaining even for initial samples, so we should always update it to the actual vsync for those initial samples so we have something to work with at least. And if we receive bogus values, also reset it to 0 along with prev_vsync. Not having base_vsync set to _some_ value completely breaks vsync_skip_detection, and mpv stays stuck in a permanent mistimed state where every frame is marked as delayed and never recovers from it. --- video/out/vo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/video/out/vo.c b/video/out/vo.c index 69e525c652f02..04a16c614fd20 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -489,11 +489,14 @@ static void update_vsync_timing_after_swap(struct vo *vo, } in->num_successive_vsyncs++; - if (in->num_successive_vsyncs <= DELAY_VSYNC_SAMPLES) + if (in->num_successive_vsyncs <= DELAY_VSYNC_SAMPLES) { + in->base_vsync = vsync_time; return; + } if (vsync_time <= 0 || vsync_time <= prev_vsync) { in->prev_vsync = 0; + in->base_vsync = 0; return; }