From 8660b4c9f08d2cfab9e3a72330d68597777827bb Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 7 Jul 2016 16:10:13 +0200 Subject: [PATCH] video: limit number of frames sent to VO to the VO requested amount vo_frame can have more than 1 frame - the extra frames are future references, which are sometimes useful for filtering (vo_opengl interpolation). There's no harm in reducing the number of frames sent to the VO requested amount of future frames, so do that. Doesn't actually reduce the number of concurrently in use frames in practice. --- player/video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/player/video.c b/player/video.c index d413ffe4fb..9819fe4705 100644 --- a/player/video.c +++ b/player/video.c @@ -1419,11 +1419,13 @@ void write_video(struct MPContext *mpctx) }; calculate_frame_duration(mpctx); + int req = vo_get_num_req_frames(mpctx->video_out); + assert(req >= 1 && req <= VO_MAX_REQ_FRAMES); struct vo_frame dummy = { .pts = pts, .duration = -1, .still = mpctx->step_frames > 0, - .num_frames = MPMIN(mpctx->num_next_frames, VO_MAX_REQ_FRAMES), + .num_frames = MPMIN(mpctx->num_next_frames, req), .num_vsyncs = 1, }; for (int n = 0; n < dummy.num_frames; n++)