[FFmpeg-cvslog] avcodec/cuviddec: properly take deinterlacing and display delay into account for buffer_full check
Timo Rothenpieler
git at videolan.org
Sun Oct 14 19:41:01 EEST 2018
ffmpeg | branch: release/3.3 | Timo Rothenpieler <timo at rothenpieler.org> | Sun Oct 14 18:33:55 2018 +0200| [5c98f8d80a50fb012deb1e4e24864dd52372a367] | committer: Timo Rothenpieler
avcodec/cuviddec: properly take deinterlacing and display delay into account for buffer_full check
Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c98f8d80a50fb012deb1e4e24864dd52372a367
---
libavcodec/cuvid.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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) {
More information about the ffmpeg-cvslog
mailing list