From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id BE58149D77 for ; Wed, 10 Apr 2024 03:01:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 673F868D120; Wed, 10 Apr 2024 06:01:28 +0300 (EEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0DEBB68C7F8 for ; Wed, 10 Apr 2024 06:01:21 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712718087; x=1744254087; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4uupQrwimWKZ5re7HbjXE/KB0Cak7AnVZIBnB4SzoU0=; b=dPHi4cUj3l3gajCmPRpJ6jLiy+qVhGgFZMgMoGmxSotF6QqdLQrDDVVW wUl2FDCVoUcw8P/bV9BCu6GJHiRA6Uf0pB94nsziLqt7h4gdXpxNdgfVv DS8K6Pla+R3Y72eQbVx/YCSxp8GZbZ8jV2dGy29ixrALyjsOVoTCUQ9Iz PGLupEmqzymPdtA05NctBNT61B7JTKVZwiVv9jURSdBi5C9SpX/T8ltXp +93iVIeHrIeiKrn3hhhfqtPtEfsiELRdz0Xc21kAWrhWpmI8WbkfC1Zyw webSlLu/bkFhxFrWy4bRyWhvGjBCi3HN7Lc2ehEbB1ZfNaPKSqQMJTe8h A==; X-CSE-ConnectionGUID: lAjpa4JSS5S+aN3uh0YxTQ== X-CSE-MsgGUID: um5uMLf3RViVzoTYQh6THw== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="11901364" X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="11901364" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 20:01:14 -0700 X-CSE-ConnectionGUID: jfP970VdSAGPA6NI1JTzkQ== X-CSE-MsgGUID: YYmaFAd5Srm3BpfsN06YDQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="24897115" Received: from unknown (HELO xhh-dg264.sh.intel.com) ([10.238.2.76]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 20:01:14 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Wed, 10 Apr 2024 11:01:03 +0800 Message-Id: <20240410030103.520402-2-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240410030103.520402-1-haihao.xiang@intel.com> References: <20240410030103.520402-1-haihao.xiang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/2] lavfi/vaapi_vpp: Use dynamic frame pool in outlink if possible X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Haihao Xiang Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Haihao Xiang This can avoid to exhaust the buffers within outlink when libva2 is available. For example: $ ffmpeg -hwaccel_output_format vaapi -hwaccel vaapi -i input.mp4 \ -vf 'scale_vaapi=w=720:h=480' -c:v hevc_vaapi -f null - ... [vf#0:0 @ 0x55acad91f400] Error while filtering: Cannot allocate memory [vf#0:0 @ 0x55acad91f400] Task finished with error code: -12 (Cannot allocate memory) [vf#0:0 @ 0x55acad91f400] Terminating thread with return code -12 (Cannot allocate memory) Signed-off-by: Haihao Xiang --- libavfilter/vaapi_vpp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c index ace1153a23..9ef7a289fb 100644 --- a/libavfilter/vaapi_vpp.c +++ b/libavfilter/vaapi_vpp.c @@ -204,7 +204,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) @@ -220,6 +223,8 @@ int ff_vaapi_vpp_config_output(AVFilterLink *outlink) va_frames = output_frames->hwctx; av_assert0(ctx->va_context == VA_INVALID_ID); + av_assert0(output_frames->initial_pool_size || + (va_frames->surface_ids == NULL && va_frames->nb_surfaces == 0)); vas = vaCreateContext(ctx->hwctx->display, ctx->va_config, ctx->output_width, ctx->output_height, VA_PROGRESSIVE, -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".