video: limit maximum number of VO frames correctly

Otherwise, vo_frame.frames can be unintentionally overflown, leading to
undefined behavior in corner cases.
This commit is contained in:
wm4 2016-01-24 18:09:14 +01:00
parent 809786df42
commit 75d29b1457
1 changed files with 1 additions and 1 deletions

View File

@ -1291,7 +1291,7 @@ void write_video(struct MPContext *mpctx, double endpts)
.pts = pts,
.duration = -1,
.still = mpctx->step_frames > 0,
.num_frames = mpctx->num_next_frames,
.num_frames = MPMIN(mpctx->num_next_frames, VO_MAX_REQ_FRAMES),
.num_vsyncs = 1,
};
for (int n = 0; n < dummy.num_frames; n++)