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:09:00 +0200 |
commit | 19546cfef103bdc967b0e06ec35c96766e3febec (patch) | |
tree | b9e2a67b9f4e15563882b214d911422958bb601f /libavcodec | |
parent | 40c4b9dad0f8a38c4e09f2083bcb046d15498977 (diff) | |
download | ffmpeg-streaming-19546cfef103bdc967b0e06ec35c96766e3febec.zip ffmpeg-streaming-19546cfef103bdc967b0e06ec35c96766e3febec.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/cuviddec.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c index 4d3caf9..f21273c 100644 --- a/libavcodec/cuviddec.c +++ b/libavcodec/cuviddec.c @@ -378,7 +378,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) |