diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2018-10-13 23:44:30 +0200 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2018-10-14 18:21:11 +0200 |
commit | e225db5d758ccad0fd84bfa0649f77385faafd44 (patch) | |
tree | 361a27e9b29c962f319edadd2caa92555b616e4b /libavcodec | |
parent | c50dc77ac708e98d02da7c422a6b9cbf9f565aa5 (diff) | |
download | ffmpeg-e225db5d758ccad0fd84bfa0649f77385faafd44.tar.gz |
avcodec/cuviddec: properly take deinterlacing and display delay into account for buffer_full check
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/cuvid.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c index 2ba8e00c6a..68671f0ecc 100644 --- a/libavcodec/cuvid.c +++ b/libavcodec/cuvid.c @@ -373,7 +373,11 @@ static int cuvid_is_buffer_full(AVCodecContext *avctx) { CuvidContext *ctx = avctx->priv_data; - return (av_fifo_size(ctx->frame_queue) / sizeof(CuvidParsedFrame)) + 2 > ctx->nb_surfaces; + int delay = ctx->cuparseinfo.ulMaxDisplayDelay; + if (ctx->deint_mode != cudaVideoDeinterlaceMode_Weave && !ctx->drop_second_field) + delay *= 2; + + return (av_fifo_size(ctx->frame_queue) / sizeof(CuvidParsedFrame)) + delay >= ctx->nb_surfaces; } static int cuvid_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt) |