mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user