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 CBC7C465BB for ; Wed, 20 Dec 2023 07:12:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 54BC768D1B3; Wed, 20 Dec 2023 09:11:32 +0200 (EET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BC66068D1A3 for ; Wed, 20 Dec 2023 09:11:26 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703056286; x=1734592286; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z5pc/UPRhf5r4nOWIynzt9pzs0wHPvsZ1KOKtOFdI1E=; b=gjxX0RV0JsGztHTK+H3P8slNpFzUQZ7H4zIo7NVpU/SFhvvLpSw3T3SI zZkSOckHepCLpPdphwYE1TiNn52y+gUDwKcRal/DYlfbWYmhK4VYwwKhk aDGdTP+QH8XKG3NH372xmq/HHxCjqS3eVK32+sYMbXLQEewn9JVi563KW eZjQdevGdWF1+NpnB48XBYofgNz8fp8kf/DIqSppcqLozUl+jNyl5w4WV bdcMkg/N+U2QMu0kUETQmgV9WOqSNxJ9WBj0hwQs3aIbwfFfB8jk3F2YQ QGVBOC1qChgmqxbtYktsJSQDuHBOf2G6srfwnljnPvmOD4ufgDA8kSFEf A==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="426921057" X-IronPort-AV: E=Sophos;i="6.04,290,1695711600"; d="scan'208";a="426921057" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 23:11:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,290,1695711600"; d="scan'208";a="18191923" Received: from xhh-dg264.sh.intel.com ([10.238.2.76]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 23:11:19 -0800 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Wed, 20 Dec 2023 15:10:49 +0800 Message-Id: <20231220071050.3175819-11-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231220071050.3175819-1-haihao.xiang@intel.com> References: <20231220071050.3175819-1-haihao.xiang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 11/12] lavc/vaapi_decode: use dynamic frame pool for output frames with libva2 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 allows a downstream element stores more frames from VAAPI decoders and fixes error in get_buffer() $ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input_100frames.mp4 \ -vf reverse -an -f null - ... [h264 @ 0x557a075a1400] get_buffer() failed [h264 @ 0x557a075a1400] thread_get_buffer() failed [h264 @ 0x557a075a1400] decode_slice_header error [h264 @ 0x557a075a1400] no frame! Signed-off-by: Haihao Xiang --- libavcodec/vaapi_decode.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index ceac769c52..8cc29e96f9 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -601,22 +601,26 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, if (err < 0) goto fail; - frames->initial_pool_size = 1; - // Add per-codec number of surfaces used for storing reference frames. - switch (avctx->codec_id) { - case AV_CODEC_ID_H264: - case AV_CODEC_ID_HEVC: - case AV_CODEC_ID_AV1: - frames->initial_pool_size += 16; - break; - case AV_CODEC_ID_VP9: - frames->initial_pool_size += 8; - break; - case AV_CODEC_ID_VP8: - frames->initial_pool_size += 3; - break; - default: - frames->initial_pool_size += 2; + if (CONFIG_VAAPI_1) + frames->initial_pool_size = 0; + else { + frames->initial_pool_size = 1; + // Add per-codec number of surfaces used for storing reference frames. + switch (avctx->codec_id) { + case AV_CODEC_ID_H264: + case AV_CODEC_ID_HEVC: + case AV_CODEC_ID_AV1: + frames->initial_pool_size += 16; + break; + case AV_CODEC_ID_VP9: + frames->initial_pool_size += 8; + break; + case AV_CODEC_ID_VP8: + frames->initial_pool_size += 3; + break; + default: + frames->initial_pool_size += 2; + } } } -- 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".