summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-12 22:31:29 +0100
committerDudemanguy <random342@airmail.cc>2023-11-14 15:09:03 +0000
commit39cab760b3a335942219bf0534ebcc35e2a924a2 (patch)
tree243c5e007b5aade61085f35b9e0ac8bb39f1b850 /video
parent4420dfee2aef72e8dc2359270459b9b69b145e6e (diff)
downloadmpv-39cab760b3a335942219bf0534ebcc35e2a924a2.tar.bz2
mpv-39cab760b3a335942219bf0534ebcc35e2a924a2.tar.xz
vo: delay vsync samples by at least 10 refreshes
This filters out vastly inaccurate values from presentation feedback that can happen shortly after restarting playback or seeking. Makes estimated vsync converge almost instantly instead of waiting until those outliers are dropped from the past samples.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index 3e75cc57b8..8027763eab 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -423,6 +423,7 @@ static double vsync_stddef(struct vo *vo, double ref_vsync)
}
#define MAX_VSYNC_SAMPLES 1000
+#define DELAY_VSYNC_SAMPLES 10
// Check if we should switch to measured average display FPS if it seems
// "better" then the system-reported one. (Note that small differences are
@@ -507,7 +508,7 @@ static void update_vsync_timing_after_swap(struct vo *vo,
}
in->num_successive_vsyncs++;
- if (in->num_successive_vsyncs <= vo->opts->swapchain_depth)
+ if (in->num_successive_vsyncs <= DELAY_VSYNC_SAMPLES)
return;
if (vsync_time <= 0 || vsync_time <= prev_vsync) {