aboutsummaryrefslogtreecommitdiffhomepage
path: root/video
diff options
context:
space:
mode:
authorGravatar Avi Halachmi (:avih) <avihpit@yahoo.com>2015-03-17 13:12:11 +0200
committerGravatar wm4 <wm4@nowhere>2015-04-09 20:34:56 +0200
commitf1746741dee6000b7fd139e7a10f72aba0674b3b (patch)
tree498d437575cf7b58c8696e7f6a832bc81da5d750 /video
parentd453600b4fe3fb7080cc41f0af11513140693eed (diff)
opengl: drop less frames when clip and display have similar fps
adds 1 vsync interval "slack" before deciding to drop the first frame. it should help on cases of timing jitter (sleep duration, container timestamps, compositor vsync timing, etc). once the drop threshold has been crossed, it will keep dropping until perfect timing alignment. this prevents crossing the drop threshold back and forth repeatedly and therefore more resilient to frame drops
Diffstat (limited to 'video')
-rw-r--r--video/out/vo.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index e9b1cbfc1d..13727fad01 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -605,7 +605,15 @@ static bool render_frame(struct vo *vo)
if (!in->hasframe_rendered)
duration = -1; // disable framedrop
- in->dropped_frame = duration >= 0 && end_time < next_vsync;
+ // 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
+ // perfectly, else, allow some slack (1 vsync) to let it settle into a rhythm.
+ in->dropped_frame = duration >= 0 &&
+ ((in->dropped_frame && end_time < next_vsync) ||
+ (end_time < prev_vsync)); // hard threshold - 1 vsync late
+
in->dropped_frame &= !(vo->driver->caps & VO_CAP_FRAMEDROP);
in->dropped_frame &= (vo->global->opts->frame_dropping & 1);
// Even if we're hopelessly behind, rather degrade to 10 FPS playback,