summaryrefslogtreecommitdiffstats
path: root/video/out/vo.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-20 15:14:43 +0200
committerwm4 <wm4@nowhere>2014-09-20 15:17:12 +0200
commit68b7217d41f3f5344e60001b0b365d47a180d6e8 (patch)
tree3a43eb03d3b521945832fd3fbdf5f34040176644 /video/out/vo.c
parent461c78e4d9d02c36f52a9846cea4160614ff42d0 (diff)
downloadmpv-68b7217d41f3f5344e60001b0b365d47a180d6e8.tar.bz2
mpv-68b7217d41f3f5344e60001b0b365d47a180d6e8.tar.xz
vo_vdpau: better integration with the generic framedrop code
vo_vdpau uses its own framedrop code, mostly for historic reasons. It has some tricky heuristics, of which I'm not sure how they work, or if they have any effect at all, but in any case, I want to keep this code for now. One day it might get fully ported to the vo.c framedrop code, or just removed. But improve its interaction with the user-visible framedrop controls. Make --framedrop actually enable and disable the vo_vdpau framedrop code, and increment the number of dropped frames correctly. The code path for other VOs should be equivalent. The vo_vdpau behavior should, except for the improvements mentioned above, be mostly equivalent as well. One minor change is that frames "shown" during preemption are always count as dropped. Remove the statement from the manpage that vo_vdpau is the default; this hasn't been the case for a while.
Diffstat (limited to 'video/out/vo.c')
-rw-r--r--video/out/vo.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index 890052d67f..774d2e2bd4 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -558,17 +558,17 @@ static bool render_frame(struct vo *vo)
int64_t next_vsync = prev_sync(vo, mp_time_us()) + in->vsync_interval;
int64_t end_time = pts + duration;
+ if (!(vo->global->opts->frame_dropping & 1) || !in->hasframe_rendered ||
+ vo->driver->untimed || vo->driver->encode)
+ duration = -1; // disable framedrop
+
in->dropped_frame = duration >= 0 && end_time < next_vsync;
- in->dropped_frame &= in->hasframe_rendered;
- in->dropped_frame &= !!(vo->global->opts->frame_dropping & 1);
- in->dropped_frame &= !(vo->driver->caps & VO_CAP_FRAMEDROP) &&
- !vo->driver->untimed && !vo->driver->encode;
+ in->dropped_frame &= !(vo->driver->caps & VO_CAP_FRAMEDROP);
// Even if we're hopelessly behind, rather degrade to 10 FPS playback,
// instead of just freezing the display forever.
in->dropped_frame &= mp_time_us() - in->last_flip < 100 * 1000;
if (in->dropped_frame) {
- in->drop_count += 1;
in->dropped_image = img;
} else {
in->hasframe_rendered = true;
@@ -587,8 +587,9 @@ static bool render_frame(struct vo *vo)
mp_sleep_us(target - now);
}
+ bool drop = false;
if (vo->driver->flip_page_timed)
- vo->driver->flip_page_timed(vo, pts, duration);
+ drop = vo->driver->flip_page_timed(vo, pts, duration) < 1;
else
vo->driver->flip_page(vo);
@@ -606,8 +607,12 @@ static bool render_frame(struct vo *vo)
MP_STATS(vo, "end video");
pthread_mutex_lock(&in->lock);
+ in->dropped_frame = drop;
}
+ if (in->dropped_frame)
+ in->drop_count += 1;
+
vo->want_redraw = false;
in->request_redraw = false;