summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2015-05-01 17:05:28 +0300
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2015-05-01 19:11:44 +0300
commitffcad1a72b9a3bf5a7ac5ddcbfa71ec19b6faf9b (patch)
tree84df7aadd089a5b253ba470c3fdc6d6fbb84d149 /video
parentd01228058b03df33a3c6be3acbf2757019a9cd83 (diff)
downloadmpv-ffcad1a72b9a3bf5a7ac5ddcbfa71ec19b6faf9b.tar.bz2
mpv-ffcad1a72b9a3bf5a7ac5ddcbfa71ec19b6faf9b.tar.xz
vo: improve frame drop logic on high playback rate
Commit f1746741dee6000b7fd139e7a10f72aba0674b3b changed the drop logic to have more slack (drop more frames but less frequent) to prevent drops due to timing jitter when the clip and screen have similar rates. However, if the clip has higher rate than the screen (or just higher playback rate), then that policy hurts smoothness since these "chunked drops" look worse than one frame drop at a time. This patch restores the old drop logic when the playback frame rate is higher than ~5% above the screen refresh rate, and solves this issue. Fixes #1897
Diffstat (limited to 'video')
-rw-r--r--video/out/vo.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index 70f682263e..0b197763a0 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -608,14 +608,22 @@ static bool render_frame(struct vo *vo)
if (!in->hasframe_rendered)
duration = -1; // disable framedrop
- // if the clip and display have similar/identical fps, it's possible that
+ // If the clip and display have similar/identical fps, it's possible that
// we'll be very slightly late frequently due to timing jitter, or if the
// clip/container timestamps are not very accurate.
- // so if we dropped the previous frame, keep dropping until we're aligned
+ // So if we dropped the previous frame, keep dropping until we're aligned
// perfectly, else, allow some slack (1 vsync) to let it settle into a rhythm.
+ // On low clip fps, we don't drop anyway and the slack logic doesn't matter.
+ // If the clip fps is more than ~5% above screen fps, we remove this slack
+ // and use "normal" logic to allow more regular drops of 1 frame at a time.
+ bool use_slack = duration > (0.95 * in->vsync_interval);
in->dropped_frame = duration >= 0 &&
+ use_slack ?
((in->dropped_frame && end_time < next_vsync) ||
- (end_time < prev_vsync)); // hard threshold - 1 vsync late
+ (end_time < prev_vsync)) // hard threshold - 1 vsync late
+ :
+ end_time < next_vsync; // normal frequent drops
+
in->dropped_frame &= !(vo->driver->caps & VO_CAP_FRAMEDROP);
in->dropped_frame &= (vo->global->opts->frame_dropping & 1);