mirror of
https://github.com/mpv-player/mpv
synced 2025-03-24 12:22:25 +00:00
player: always require a future frame with display-sync enabled
We need a frame duration even on start, because the number of vsyncs the frame is shown is predetermined. (vo_opengl actually makes use of this property in certain cases.)
This commit is contained in:
parent
f0feea5591
commit
624c9e46ce
@ -611,10 +611,14 @@ static void shift_frames(struct MPContext *mpctx)
|
|||||||
static int get_req_frames(struct MPContext *mpctx, bool eof)
|
static int get_req_frames(struct MPContext *mpctx, bool eof)
|
||||||
{
|
{
|
||||||
// On EOF, drain all frames.
|
// On EOF, drain all frames.
|
||||||
// On the first frame, output a new frame as quickly as possible.
|
if (eof)
|
||||||
if (eof || mpctx->video_pts == MP_NOPTS_VALUE)
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
// On the first frame, output a new frame as quickly as possible.
|
||||||
|
// But display-sync likes to have a correct frame duration always.
|
||||||
|
if (mpctx->video_pts == MP_NOPTS_VALUE)
|
||||||
|
return mpctx->opts->video_sync == VS_DEFAULT ? 1 : 2;
|
||||||
|
|
||||||
int req = vo_get_num_req_frames(mpctx->video_out);
|
int req = vo_get_num_req_frames(mpctx->video_out);
|
||||||
return MPCLAMP(req, 2, MP_ARRAY_SIZE(mpctx->next_frames));
|
return MPCLAMP(req, 2, MP_ARRAY_SIZE(mpctx->next_frames));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user