vo: minor simplification for queue size handling

Instead of calling it "future frames" and adding or subtracting 1 from
it, always call it "requested frames". This simplifies it a bit.

MPContext.next_frames had 2 added to it; this was mainly to ensure a
minimum size of 2. Drop it and assume VO_MAX_REQ_FRAMES is at least 2;
together with the other changes, this can be the exact size of the
array.
This commit is contained in:
wm4
2015-07-20 21:12:46 +02:00
parent 6f7d04be21
commit 4a1657da01
6 changed files with 17 additions and 18 deletions

View File

@@ -229,7 +229,7 @@ typedef struct MPContext {
struct vo *video_out;
// next_frame[0] is the next frame, next_frame[1] the one after that.
struct mp_image *next_frames[2 + VO_MAX_FUTURE_FRAMES];
struct mp_image *next_frames[VO_MAX_REQ_FRAMES];
int num_next_frames;
struct mp_image *saved_frame; // for hrseek_lastframe

View File

@@ -604,10 +604,10 @@ static int get_req_frames(struct MPContext *mpctx, bool eof)
if (eof || mpctx->video_pts == MP_NOPTS_VALUE)
return 1;
int req = 1 + vo_get_num_future_frames(mpctx->video_out);
int req = vo_get_num_req_frames(mpctx->video_out);
if (opts->frame_dropping & 1)
req = MPMAX(req, 2);
return req;
return MPMIN(req, MP_ARRAY_SIZE(mpctx->next_frames));
}
// Whether it's fine to call add_new_frame() now.