Previously 10 frames were always allocated here, which is significantly more than is actually required. The new value is bounded below at that, however, in order to preserve compatibility. --- libavfilter/vf_deinterlace_vaapi.c | 7 +++---- libavfilter/vf_scale_vaapi.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/libavfilter/vf_deinterlace_vaapi.c b/libavfilter/vf_deinterlace_vaapi.c index ab2a43291..ed00eb267 100644 --- a/libavfilter/vf_deinterlace_vaapi.c +++ b/libavfilter/vf_deinterlace_vaapi.c @@ -22,6 +22,7 @@ #include <va/va_vpp.h> #include "libavutil/avassert.h" +#include "libavutil/common.h" #include "libavutil/hwcontext.h" #include "libavutil/hwcontext_vaapi.h" #include "libavutil/mem.h" @@ -293,10 +294,8 @@ static int deint_vaapi_config_output(AVFilterLink *outlink) ctx->output_frames->width = ctx->output_width; ctx->output_frames->height = ctx->output_height; - // The number of output frames we need is determined by what follows - // the filter. If it's an encoder with complex frame reference - // structures then this could be very high. - ctx->output_frames->initial_pool_size = 10; + ctx->output_frames->initial_pool_size = + FFMAX(10, 4 + avctx->extra_hw_frames); err = av_hwframe_ctx_init(ctx->output_frames_ref); if (err < 0) { diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c index 50be68eee..3cc7d2437 100644 --- a/libavfilter/vf_scale_vaapi.c +++ b/libavfilter/vf_scale_vaapi.c @@ -22,6 +22,7 @@ #include <va/va_vpp.h> #include "libavutil/avassert.h" +#include "libavutil/common.h" #include "libavutil/hwcontext.h" #include "libavutil/hwcontext_vaapi.h" #include "libavutil/mem.h" @@ -191,10 +192,8 @@ static int scale_vaapi_config_output(AVFilterLink *outlink) ctx->output_frames->width = ctx->output_width; ctx->output_frames->height = ctx->output_height; - // The number of output frames we need is determined by what follows - // the filter. If it's an encoder with complex frame reference - // structures then this could be very high. - ctx->output_frames->initial_pool_size = 10; + ctx->output_frames->initial_pool_size = + FFMAX(10, 4 + avctx->extra_hw_frames); err = av_hwframe_ctx_init(ctx->output_frames_ref); if (err < 0) { -- 2.11.0 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel