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.
This commit is contained in:
llyyr authored and Kacper Michajłow committed 2024-12-11 16:42:13 +01:00
1 parent bd915439d0
commit 7fffaf8557
1 file changed
+4 -1
+4 -1
View File
@@ -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;
}