Browse Source

avcodec/cuviddec: properly take deinterlacing and display delay into account for buffer_full check

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
tags/n3.3.9
Timo Rothenpieler 7 years ago
parent
commit
5c98f8d80a
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      libavcodec/cuvid.c

+ 5
- 1
libavcodec/cuvid.c View File

@@ -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) {


Loading…
Cancel
Save