summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-27 21:56:29 +0100
committerwm4 <wm4@nowhere>2015-11-27 21:56:29 +0100
commit2bee47fd27f4ee544f1db15fcedf8cd94df89610 (patch)
tree435abd26a528dd56c9565ac788667fad04d5263b /video
parentc8e0e35709ffd487673847973e5cd02507d0c16c (diff)
downloadmpv-2bee47fd27f4ee544f1db15fcedf8cd94df89610.tar.bz2
mpv-2bee47fd27f4ee544f1db15fcedf8cd94df89610.tar.xz
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.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo.c18
1 files changed, 10 insertions, 8 deletions
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);