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 CAA9D49408 for ; Wed, 10 Apr 2024 03:01:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5885D68D0B5; Wed, 10 Apr 2024 06:01:23 +0300 (EEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 18EF368C8F2 for ; Wed, 10 Apr 2024 06:01:15 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712718081; x=1744254081; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=F4ha7n2u3ZSIJvVTGGzfSGiN5hkXl3D1XTJHE4Z5OHM=; b=D1q5N63JPHv9xWwHAk2ZGxo4V0+ZojIjYwFKweBzWFM1X95TJEoSO4KP 6ew7ehZXfJLPPidZuVPQURVLjdg4n17c176y6IF16VCDQnGYRic9FH6SV uRs3P5kOZz4s7QGqr+GMIMurG3+lI4ydPNOA7hkFrpjF3+QVPnVZD+guc S6HrLVZkUn4+nEQDlHsnTpZ2XYh61W+GR/A5VL8nQHFlU+tqt6aLzxvF/ mApBvWKm1ZrUJQ9VNCbk0rvMq/f7hGaR85vg+MVNKyc0KFC5pDLclrzZT cfJJ9kJ6TjnBQIknaTCP7aDMr96spvK/lv903K4mw+oOZGK8c2Ks/0srK w==; X-CSE-ConnectionGUID: /OjrDvR1QrqyEAi8JMrATg== X-CSE-MsgGUID: GBg2Q/8DQgWBw2DfKFHM2A== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="11901362" X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="11901362" 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:13 -0700 X-CSE-ConnectionGUID: Q1Kah7LJQIOziRhUqu7A9w== X-CSE-MsgGUID: LDWk1mmyRuKVMKO4T/yiHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="24897110" 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:13 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Wed, 10 Apr 2024 11:01:02 +0800 Message-Id: <20240410030103.520402-1-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/2] lavc/vaapi_decode: Use dynamic frame pool 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 libva2 doesn't require a fixed surface-array any more, so we may use dynamic frame pool for decoding when libva2 is available, which allows a downstream element stores more frames from VAAPI decoders and fixes the error below: $ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi \ -i input.mp4 -c:v hevc_vaapi -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 5665639dd7..21b273cd0f 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -599,22 +599,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".