]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/nvdec: Increase frame pool size to help deinterlacing
authorPhilip Langdale <philipl@overt.org>
Thu, 25 Oct 2018 01:38:44 +0000 (18:38 -0700)
committerPhilip Langdale <philipl@overt.org>
Fri, 2 Nov 2018 18:27:13 +0000 (11:27 -0700)
With the cuda yadif filter in use, the number of mapped decoder
frames could increase by two, as the filter holds on to additional
frames.

libavcodec/nvdec.c

index 4dd6b1acf3ade95ad837423468517b114941d545..0426c9b3197f861f5652cdfccfb84a57db2b45b5 100644 (file)
@@ -601,7 +601,11 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
     frames_ctx->format            = AV_PIX_FMT_CUDA;
     frames_ctx->width             = (avctx->coded_width + 1) & ~1;
     frames_ctx->height            = (avctx->coded_height + 1) & ~1;
-    frames_ctx->initial_pool_size = dpb_size;
+    /*
+     * We add two extra frames to the pool to account for deinterlacing filters
+     * holding onto their frames.
+     */
+    frames_ctx->initial_pool_size = dpb_size + 2;
 
     frames_ctx->free = nvdec_free_dummy;
     frames_ctx->pool = av_buffer_pool_init(0, nvdec_alloc_dummy);