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.
This commit is contained in:
wm4 2015-11-29 17:41:01 +01:00
parent e2c0e7f5c2
commit 03a81a9d85
1 changed files with 6 additions and 0 deletions

View File

@ -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) {