diff mbox series

[FFmpeg-devel,13/13] lavfi/vaapi_vpp: use dynamic frame pool for output link with libva2

Message ID 20230906060052.698620-13-haihao.xiang@intel.com
State New
Headers show
Series [FFmpeg-devel,01/13] lavu/hwcontext_qsv: update AVQSVFramesContext to support dynamic frame pools | expand

Commit Message

Xiang, Haihao Sept. 6, 2023, 6 a.m. UTC
From: Haihao Xiang <haihao.xiang@intel.com>

This can avoid out of memory with vaapi filters since commit 5fa00b3.

Example:
$ ffmpeg -init_hw_device vaapi=hw:/dev/dri/renderD128
-hwaccel_output_format vaapi -hwaccel vaapi -i input.mp4 -vf
'scale_vaapi=w=720:h=480' -vframes 1 -f null -
...
[vf#0:0 @ 0x55ffe793ba80] Error while filtering: Cannot allocate memory

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavfilter/vaapi_vpp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
index cf2592e068..818bc7d58a 100644
--- a/libavfilter/vaapi_vpp.c
+++ b/libavfilter/vaapi_vpp.c
@@ -199,7 +199,10 @@  int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
     output_frames->width     = ctx->output_width;
     output_frames->height    = ctx->output_height;
 
-    output_frames->initial_pool_size = 4;
+    if (CONFIG_VAAPI_1)
+        output_frames->initial_pool_size = 0;
+    else
+        output_frames->initial_pool_size = 4;
 
     err = ff_filter_init_hw_frames(avctx, outlink, 10);
     if (err < 0)