summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-28 18:40:25 +0100
committerwm4 <wm4@nowhere>2015-11-28 18:40:25 +0100
commit50d43a1db4577965ef9123bbefc72fb8194181b3 (patch)
tree270c1733adab00c9f506f967e76f29a4e2d62bb6
parent318e9801f2ac649ecc6c7d4fb83c7c46fa5b581d (diff)
downloadmpv-50d43a1db4577965ef9123bbefc72fb8194181b3.tar.bz2
mpv-50d43a1db4577965ef9123bbefc72fb8194181b3.tar.xz
vo: wait longer before abandoning system-reported display-fps
Further improvement over commit 41f2c653.
-rw-r--r--video/out/vo.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index a3254d8866..a9071ef221 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -143,6 +143,7 @@ struct vo_internal {
int64_t vsync_interval;
int64_t *vsync_samples;
int num_vsync_samples;
+ int64_t num_total_vsync_samples;
int64_t prev_vsync;
int64_t base_vsync;
int drop_point;
@@ -324,6 +325,7 @@ static void reset_vsync_timings(struct vo *vo)
{
struct vo_internal *in = vo->in;
in->num_vsync_samples = 0;
+ in->num_total_vsync_samples = 0;
in->drop_point = 0;
in->estimated_vsync_interval = 0;
in->estimated_vsync_jitter = -1;
@@ -361,6 +363,7 @@ static void update_vsync_timing_after_swap(struct vo *vo)
MP_TARRAY_INSERT_AT(in, in->vsync_samples, in->num_vsync_samples, 0,
now - in->prev_vsync);
in->drop_point = MPMIN(in->drop_point + 1, in->num_vsync_samples);
+ in->num_total_vsync_samples += 1;
if (in->base_vsync) {
in->base_vsync += in->vsync_interval;
} else {
@@ -378,7 +381,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 &&
+ if (in->num_total_vsync_samples >= max_samples * 2 &&
fabs((in->nominal_vsync_interval - in->estimated_vsync_interval))
>= 0.01 * in->nominal_vsync_interval &&
in->estimated_vsync_interval <= 1e6 / 20.0 &&