Skip to content

Commit

Permalink
vo: update base_vsync even for initial samples
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
llyyr committed Nov 13, 2024
1 parent 9c61cf2 commit b2503ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion video/out/vo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b2503ef

Please sign in to comment.