summaryrefslogtreecommitdiffstats
path: root/video/out/vo.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-14 15:40:02 +0100
committerDudemanguy <random342@airmail.cc>2023-11-18 22:54:29 +0000
commitd9e0ae737ab7a590527d88dd913fcc06d550df24 (patch)
tree644ec373751202b930a10f4df52c58f251246042 /video/out/vo.c
parent01b4b2064376d171472e2f4a937d92ff29d8d47b (diff)
downloadmpv-d9e0ae737ab7a590527d88dd913fcc06d550df24.tar.bz2
mpv-d9e0ae737ab7a590527d88dd913fcc06d550df24.tar.xz
vo: avoid overshooting the expected end of the frame during pause
The `current_frame` can be redrawn even if the remaining `num_vsync` is equal to 0. In this scenario, the vsync offset would be incremented beyond the target point.
Diffstat (limited to 'video/out/vo.c')
-rw-r--r--video/out/vo.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index 8027763eab..50129fb306 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -898,8 +898,13 @@ static bool render_frame(struct vo *vo)
// frame currently drawn, while in->current_frame is the potentially next.)
in->current_frame->repeat = true;
if (frame->display_synced) {
- in->current_frame->vsync_offset += in->current_frame->vsync_interval;
- in->current_frame->ideal_frame_vsync += in->current_frame->ideal_frame_vsync_duration;
+ // Increment the offset only if it's not the last vsync. The current_frame
+ // can still be reused. This is mostly important for redraws that might
+ // overshoot the target vsync point.
+ if (in->current_frame->num_vsyncs > 1) {
+ in->current_frame->vsync_offset += in->current_frame->vsync_interval;
+ in->current_frame->ideal_frame_vsync += in->current_frame->ideal_frame_vsync_duration;
+ }
in->dropped_frame |= in->current_frame->num_vsyncs < 1;
}
if (in->current_frame->num_vsyncs > 0)