aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2018-10-14 18:33:55 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2018-10-14 18:33:55 +0200
commit5c98f8d80a50fb012deb1e4e24864dd52372a367 (patch)
tree817af86e6edb4955ee083d1bb90a9346e8e02f00
parent660e4c0c961c41c2ae5fc2f40c25bff30ec64133 (diff)
downloadffmpeg-5c98f8d80a50fb012deb1e4e24864dd52372a367.tar.gz
avcodec/cuviddec: properly take deinterlacing and display delay into account for buffer_full check
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
-rw-r--r--libavcodec/cuvid.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index 916d7e9987..da31693036 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -367,13 +367,17 @@ static int cuvid_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt)
AVPacket filter_packet = { 0 };
AVPacket filtered_packet = { 0 };
int ret = 0, eret = 0, is_flush = ctx->decoder_flushing;
+ int delay = ctx->cuparseinfo.ulMaxDisplayDelay;
av_log(avctx, AV_LOG_TRACE, "cuvid_decode_packet\n");
if (is_flush && avpkt && avpkt->size)
return AVERROR_EOF;
- if ((av_fifo_size(ctx->frame_queue) / sizeof(CuvidParsedFrame)) + 2 > ctx->nb_surfaces && avpkt && avpkt->size)
+ if (ctx->deint_mode != cudaVideoDeinterlaceMode_Weave && !ctx->drop_second_field)
+ delay *= 2;
+
+ if ((av_fifo_size(ctx->frame_queue) / sizeof(CuvidParsedFrame)) + delay >= ctx->nb_surfaces && avpkt && avpkt->size)
return AVERROR(EAGAIN);
if (ctx->bsf && avpkt && avpkt->size) {