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:
wm4 2015-11-13 22:42:42 +01:00
parent f0feea5591
commit 624c9e46ce
1 changed files with 6 additions and 2 deletions

View File

@ -611,10 +611,14 @@ static void shift_frames(struct MPContext *mpctx)
static int get_req_frames(struct MPContext *mpctx, bool eof)
{
// On EOF, drain all frames.
// On the first frame, output a new frame as quickly as possible.
if (eof || mpctx->video_pts == MP_NOPTS_VALUE)
if (eof)
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);
return MPCLAMP(req, 2, MP_ARRAY_SIZE(mpctx->next_frames));
}