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 7B5804C99F for ; Sun, 11 May 2025 15:43:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0A62568BF7B; Sun, 11 May 2025 18:43:23 +0300 (EEST) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AD76C68BE4C for ; Sun, 11 May 2025 18:43:16 +0300 (EEST) Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-30c3a038acfso3455190a91.3 for ; Sun, 11 May 2025 08:43:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746978194; x=1747582994; 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=tlzxvEt4+QySQqXu5ufxrShU2ZQpAmxrkaExScxHShI=; b=eUQpNAqPdWE7cCjKWqi3l81y0LDVumgD3CF8LuuaTnXe1rjtd340Re1t3MOFb7sN36 fcBbUaxaaj+OCZbaBtaLPTAGrcd8ddTKVippP3g2KAlBqLZIojjRWpYa7LHohDd5MAgx 4fgPNMuksiOm9sfWQaQ+PC+9drZ0jg3+l3UZonefKFeALX7unU7UVLRvstfnz1JeojSG UWDdn4vX4L7bnEXtlmZyQaqlm+EDdqE41bQc/shzrCbeg4vT4Uil/6uteT1TB1l7CKRq lukfnCFiuPl/vwCveMb0gOAxiTXR4y8wwZEFyMQFEyRDHJK218W5JkvkvBkjKfZnu8sC BScA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746978194; x=1747582994; 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=tlzxvEt4+QySQqXu5ufxrShU2ZQpAmxrkaExScxHShI=; b=Bmd5fIwLWp2TZTU04+1QDae9GAJl+jnBW4qGgBN3yrk4/rBhnhThTa16vqEno/Wy9q Bcrz5Lt7zqzkszuosQOAYGQfHaFsPooGHbaLlE7fKI0wdOroWrXyyeFnowfs4I3RRsOp VMVtZvhyP4Ht9AQdZxJnuhFtAwIPHDNB5Ztq+2c40GgTS6xhgZvkgnsIF148FlcQ85ui 9EL9W4/grXZ/PVPRyZiV6n41lQFrHaumQLor0fz/XERvHEi+iJXBd7SVS0AyBiUghc6v j0lxNgI3LNNht6bk6Yiql7Dz+sv8MnSdq86+NYS6eAvoG6MI9ZApnlw4R6yOoY/ruWjZ aBsg== X-Gm-Message-State: AOJu0YxZGUkHXrq861FJ518/z7NdHYD/qO1HX1flPujJriWCgxBMDXX/ 4PeZo1F0zcZ2bLNYa0tP5z7zujDeNW0nfaMJeSLd3N0Y2l9Cgk0PeyU90zoZuzoHpg== X-Gm-Gg: ASbGncthneHi/yRJ6rBn1Qsg8pgb5ySHnb0EY/jkJNOTb2MhnWJZwas6CUTzqLJV9S9 Wop7ov77LJj48NQqBO6LqHU2xo9MIg480zZUt0cuj5xre5lxKmjCrNNgEsiF5bICRuAhJMoby7B GU1BNb2ho2rAOJS2M7LHkSICM4EZ+xvt+aTz9crlEMHApPIPI2RqyCD630aZ4Im1QrCFnnKA/20 30fQ/m42redclhApqfkIdVWpRuIT/yGz+/orf5IO3LMhvBqiTObndW0t6iqrcTtxV1sK0njEfsB lrcGXJij6nv5XZeWHvMh33xvgHl9el3aleHomfxprfWe1z7PrC88qwTo8I/Zp3Ox/m4vXRjaPyP AGA== X-Google-Smtp-Source: AGHT+IEUroKBPKB1oUwYOiEvhnsAmu+bqqcYzNgXQ6xBhzuyK1xnQfx53mHqzrtfS2NTkaHnQkmC4w== X-Received: by 2002:a17:90b:1807:b0:309:d115:b5f7 with SMTP id 98e67ed59e1d1-30c3d628b4bmr16819614a91.24.1746978194521; Sun, 11 May 2025 08:43:14 -0700 (PDT) Received: from xiongweixiao-ubt.. ([59.174.181.76]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b23493257d6sm4200288a12.15.2025.05.11.08.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 May 2025 08:43:14 -0700 (PDT) From: xiongweixiao To: ffmpeg-devel@ffmpeg.org Date: Sun, 11 May 2025 23:43:08 +0800 Message-Id: <20250511154308.2078518-1-xiongweixiaoxxw@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] 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 --- libavformat/vvcdec.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/libavformat/vvcdec.c b/libavformat/vvcdec.c index 0a0e24b71c..1d7be17258 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".