]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/cuviddec: set ulMaxDisplayDelay to zero if low_delay flag is set
authorMichal Novotny <michal.novotny@comprimato.com>
Fri, 19 Feb 2021 22:33:25 +0000 (14:33 -0800)
committerTimo Rothenpieler <timo@rothenpieler.org>
Mon, 22 Feb 2021 15:54:28 +0000 (16:54 +0100)
Zero is the recommended value in Nvidia coding samples for low latency use-cases.

Signed-off-by: Michal Novotny <michal.novotny@comprimato.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
libavcodec/cuviddec.c

index 49775b5a09c82fe1f2ac0a4d11c5661028a0a0a9..ec57afdefe76d3efe924b6b268592c0c8d618cd7 100644 (file)
@@ -999,7 +999,7 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
     }
 
     ctx->cuparseinfo.ulMaxNumDecodeSurfaces = ctx->nb_surfaces;
-    ctx->cuparseinfo.ulMaxDisplayDelay = 4;
+    ctx->cuparseinfo.ulMaxDisplayDelay = (avctx->flags & AV_CODEC_FLAG_LOW_DELAY) ? 0 : 4;
     ctx->cuparseinfo.pUserData = avctx;
     ctx->cuparseinfo.pfnSequenceCallback = cuvid_handle_video_sequence;
     ctx->cuparseinfo.pfnDecodePicture = cuvid_handle_picture_decode;