From 2bee47fd27f4ee544f1db15fcedf8cd94df89610 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 27 Nov 2015 21:56:29 +0100 Subject: vo: switch back to system-reported display FPS if possible If we switched away from the system FPS, we were remaining in this mode ssentially forever. There's no reason to do so; switch back if the estimated FPS gets worse again. Improvement over commit 41f2c653. --- video/out/vo.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'video') diff --git a/video/out/vo.c b/video/out/vo.c index 2c122f0b05..7d39c7e613 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -377,6 +377,7 @@ static void update_vsync_timing_after_swap(struct vo *vo) // Switch to assumed display FPS if it seems "better". (Note that small // differences are handled as drift instead.) + bool use_estimated = false; if (in->num_vsync_samples == max_samples && fabs((in->nominal_vsync_interval - in->estimated_vsync_interval)) >= 0.01 * in->nominal_vsync_interval && @@ -385,15 +386,16 @@ static void update_vsync_timing_after_swap(struct vo *vo) { double mjitter = vsync_stddef(vo, in->estimated_vsync_interval); double njitter = vsync_stddef(vo, in->nominal_vsync_interval); - if (mjitter * 1.01 < njitter) { - if (in->vsync_interval == in->nominal_vsync_interval) { - MP_WARN(vo, "Reported display FPS seems incorrect.\n" - "Assuming a value closer to %.3f Hz.\n", - 1e6 / in->estimated_vsync_interval); - } - in->vsync_interval = in->estimated_vsync_interval; - } + if (mjitter * 1.01 < njitter) + use_estimated = true; + } + if (use_estimated && in->vsync_interval == in->nominal_vsync_interval) { + MP_WARN(vo, "Reported display FPS seems incorrect.\n" + "Assuming a value closer to %.3f Hz.\n", + 1e6 / in->estimated_vsync_interval); } + in->vsync_interval = use_estimated ? (int64_t)in->estimated_vsync_interval + : in->nominal_vsync_interval; MP_STATS(vo, "value %f jitter", in->estimated_vsync_jitter); MP_STATS(vo, "value %f vsync-diff", in->vsync_samples[0] / 1e6); -- cgit v1.2.3