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 ESMTPS id 3C7724E6F2 for ; Sun, 11 May 2025 23:36:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 492D668BD10; Mon, 12 May 2025 02:36:51 +0300 (EEST) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 05B5468B7CC for ; Mon, 12 May 2025 02:36:45 +0300 (EEST) Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-af548cb1f83so3283107a12.3 for ; Sun, 11 May 2025 16:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747006602; x=1747611402; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fKbsgtKGKT34nKqWRdjRyEogS7YXZBgHCcVTVldTWkk=; b=KRvBw01O9v0JAN9Kp73KI9WAak5BSnCGi/u9HjN7Wmn3as2DDEgVKfl9t4prMRya4k 4eZe8p2JcqwMhEFulfMTgx6nAzq3mwaHA7FUHbdVwMt9YWyaRUw3EySwchXQj+OzUFnM QZmjsAgjXur2InZV0Cs7rRmjKzCaeFgzwf+HZBE4aBsQsGH1Rkz1pEYC9pELAPinYSOp SqXmGdsjjlhbtUU4+koB6XQpjBawLQ9LWd1hLKyxhuWuZGFnOAdwqoQUEwDZWTmB0iR/ TUz15+CP5ja2WSl25T5uPjMGqvvjShLhcIOInlwu6d4hql+Ub4G2rOrb40F1kdQRWnvn a/YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747006602; x=1747611402; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fKbsgtKGKT34nKqWRdjRyEogS7YXZBgHCcVTVldTWkk=; b=TDrBU06nrBJd9srtTvsblR4CLviEhGqfcOj+bipv3DINZehB5i5vMpd5ZLVAbBgK0o wlrY0iGU1knqRX0tO+BL7NEJZL+GOSmc5dt+m7kg0AP28Y+KrkXhbwQRamTPGwHL4jYg 6LZ8XBeXlX/vQgYwjjTXMG++WgtD65R3okV9OriPgEbve/ErzBfUkqkWghZK3/lgxnhU FAInilu9B/5CpIRHAnysjMPwnTcg7WlnD1VYRoaMd5le+ITsF15QrBifHljqOXc25S40 Np1zse02YX+47jb74j86w/He0B9r26wtxbxrWXhaP+nYFqQQ8iCYc7UTafNM9v5Op1bA 0oKQ== X-Gm-Message-State: AOJu0Yx9cw263hCDE6PCg//nmZJkZfwdDet3y6JLVwCwbcDkY273sglw UfhFyXJaP5hNe+HgmZZzBoIPOZd6kqEtvDj+9jyNATwoEnqQrlZa8FPaqhHfXR5Kaw== X-Gm-Gg: ASbGncuWrobcvktciJQsRaD/KCizrWWZuEwuUZ8Pr7g+cPtcCju3ggJtmWmiCLxs9YB ableJ9ahwgLAGrSSZa5f1HtZBg3PMEzFUXQA03/ZFlN3LtwShIWUU9kB8WuCfmQMRBEeExWnc3o vJj0jesoY6/9GcZYvailYCzVMn5YS0ZafQo9sa5ydEoRkRIG1SHQvHyJk6gJoXimJld1IKtTQEl iNz2km3cmx/VnbfmYvplVcQeLpS1chCls9SCFf7qt94BezBfET8LBp16zb+A80d/UgSCB466ZBm M3uueH1GdzaADqAb0Efm77e9MYzsXk5oYPgSvn1LPUPLif2dVuJGTpbHHzH2yKIIYur/ikvJZPU rcw== X-Google-Smtp-Source: AGHT+IEV8Qn+LVN0MTBDsz7mLrxQPU2szERldGYCya/5Rs8zgMO7WVtYetWSJ2TZWO4DWQJDkT3Lsw== X-Received: by 2002:a17:903:2f84:b0:22e:4dc4:5e91 with SMTP id d9443c01a7336-22fc91ca2b6mr188620025ad.53.1747006602502; Sun, 11 May 2025 16:36:42 -0700 (PDT) Received: from xiongweixiao-ubt.. ([59.174.181.76]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22fc8271aacsm50439315ad.152.2025.05.11.16.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 May 2025 16:36:42 -0700 (PDT) From: xiongweixiao To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 May 2025 07:36:35 +0800 Message-Id: <20250511233635.2961367-1-xiongweixiaoxxw@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3] lavf: vvc_probe: enforce SPS -> PPS -> IRAP detection order to fix invalid stream detection 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: xiongweixiao 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: The current vvc_probe function checks for SPS, PPS, and IRAP NAL units but does not enforce their detection order. This can lead to false positives when PPS or IRAP appear before SPS, causing malformed or non-compliant bitstreams to be incorrectly identified as valid VVC streams. This patch modifies the logic to use boolean flags and enforces the correct detection sequence: SPS must be detected before PPS, and PPS before IRAP. This ensures more accurate probing and prevents invalid bitstreams from being misidentified. This change addresses issues reported in: - https://trac.ffmpeg.org/ticket/11496 - https://trac.ffmpeg.org/ticket/11087 Signed-off-by: xiongweixiao [v2] lavf: vvc_probe: fix based on review feedback Changes since v1: - Added a flag to force sps, pps, iraq to appear in order; - Modified score where pps, iraq appeared in the wrong position; - Set a smaller score for incomplete sps, pps, iraq to deal with situations that may look like vvc format Signed-off-by: xiongweixiao [v3] lavf fix code format remove trailing whitspace --- libavformat/vvcdec.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/libavformat/vvcdec.c b/libavformat/vvcdec.c index 0a0e24b71c..1bfa1b5d69 100644 --- a/libavformat/vvcdec.c +++ b/libavformat/vvcdec.c @@ -44,6 +44,7 @@ static int vvc_probe(const AVProbeData *p) { uint32_t code = -1; int sps = 0, pps = 0, irap = 0; + int valid_pps = 0, valid_irap = 0; int i; for (i = 0; i < p->buf_size - 1; i++) { @@ -60,17 +61,29 @@ static int vvc_probe(const AVProbeData *p) switch (type) { case VVC_SPS_NUT: sps++; break; - case VVC_PPS_NUT: pps++; break; + case VVC_PPS_NUT: + pps++; + if (sps) + valid_pps++; + break; case VVC_IDR_N_LP: case VVC_IDR_W_RADL: case VVC_CRA_NUT: - case VVC_GDR_NUT: irap++; break; + case VVC_GDR_NUT: + irap++; + if (valid_pps) + valid_irap++; + break; } } } - if (sps && pps && irap) + if (valid_irap) return AVPROBE_SCORE_EXTENSION + 1; // 1 more than .mpg + if (sps && pps && irap) + return AVPROBE_SCORE_EXTENSION / 2; + if (sps || pps || irap) + return AVPROBE_SCORE_EXTENSION / 4; return 0; } -- 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".