From 03a81a9d8526c3c636bd23e18e28dfecf2fb39da Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 29 Nov 2015 17:41:01 +0100 Subject: vo: make using estimated FPS more conservative Don't use the average FPS if there are likely skipped vsyncs. Note that we don't use the normal skip detection, as it is unreliable if the real and assumed display FPS differ too much. The normal skip detection is still in place as it's more reliable in the case when vsync jitters much, but the display FPS is relatively exact. Further improvement over commit 41f2c653. --- video/out/vo.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'video/out/vo.c') diff --git a/video/out/vo.c b/video/out/vo.c index 90018511d4..2920a4669c 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -387,10 +387,16 @@ static void update_vsync_timing_after_swap(struct vo *vo) in->estimated_vsync_interval <= 1e6 / 20.0 && in->estimated_vsync_interval >= 1e6 / 99.0) { + for (int n = 0; n < in->num_vsync_samples; n++) { + if (fabs(in->vsync_samples[n] - in->estimated_vsync_interval) + >= in->estimated_vsync_interval / 4) + goto done; + } double mjitter = vsync_stddef(vo, in->estimated_vsync_interval); double njitter = vsync_stddef(vo, in->nominal_vsync_interval); if (mjitter * 1.01 < njitter) use_estimated = true; + done: ; } if (use_estimated == (in->vsync_interval == in->nominal_vsync_interval)) { if (use_estimated) { -- cgit v1.2.3