History

lavf: vvc_probe: lower probe score for invalid SPS/PPS/IRAP order to avoid misdetection of mp3 as VVC

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 commit 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. For streams with wrong ordering a lower score is returned This change addresses issues reported in: - https://trac.ffmpeg.org/ticket/11496 - https://trac.ffmpeg.org/ticket/11087

xiongweixiao committed 1 year ago

Commit 8ce32a71 parent 1cda5fe1 file · +16 −3Browse files

Unified · Split

libavformat/vvcdec.c+16−3
@@ -44,6 +44,7 @@ static int vvc_probe(const AVProbeData *p) · 43 unmodified lines
4444 {
4545 uint32_t code = -1;
4646 int sps = 0, pps = 0, irap = 0;
47+ int valid_pps = 0, valid_irap = 0;
4748 int i;
4849
4950 for (i = 0; i < p->buf_size - 1; i++) {
@@ -60,17 +61,29 @@ static int vvc_probe(const AVProbeData *p) · 10 unmodified lines
6061
6162 switch (type) {
6263 case VVC_SPS_NUT: sps++; break;
63− case VVC_PPS_NUT: pps++; break;
64+ case VVC_PPS_NUT:
65+ pps++;
66+ if (sps)
67+ valid_pps++;
68+ break;
6469 case VVC_IDR_N_LP:
6570 case VVC_IDR_W_RADL:
6671 case VVC_CRA_NUT:
67− case VVC_GDR_NUT: irap++; break;
72+ case VVC_GDR_NUT:
73+ irap++;
74+ if (valid_pps)
75+ valid_irap++;
76+ break;
6877 }
6978 }
7079 }
7180
72− if (sps && pps && irap)
81+ if (valid_irap)
7382 return AVPROBE_SCORE_EXTENSION + 1; // 1 more than .mpg
83+ if (sps && pps && irap)
84+ return AVPROBE_SCORE_EXTENSION / 2;
85+ if (sps || pps || irap)
86+ return AVPROBE_SCORE_EXTENSION / 4;
7487 return 0;
7588 }
7689

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t