summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-29 17:41:01 +0100
committerwm4 <wm4@nowhere>2015-11-29 17:56:08 +0100
commit03a81a9d8526c3c636bd23e18e28dfecf2fb39da (patch)
treecc5e714763d58f9d36b1a39dec09dedad1bdbd49
parente2c0e7f5c27e0dfda9271163205c527b8607edad (diff)
downloadmpv-03a81a9d8526c3c636bd23e18e28dfecf2fb39da.tar.bz2
mpv-03a81a9d8526c3c636bd23e18e28dfecf2fb39da.tar.xz
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.
-rw-r--r--video/out/vo.c6
1 files changed, 6 insertions, 0 deletions
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) {