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
44{44{
45 uint32_t code = -1;45 uint32_t code = -1;
46 int sps = 0, pps = 0, irap = 0;46 int sps = 0, pps = 0, irap = 0;
47 int valid_pps = 0, valid_irap = 0;
47 int i;48 int i;
48 49
49 for (i = 0; i < p->buf_size - 1; i++) {50 for (i = 0; i < p->buf_size - 1; i++) {
@@ -60,17 +61,29 @@ static int vvc_probe(const AVProbeData *p) · 10 unmodified lines
60 61
61 switch (type) {62 switch (type) {
62 case VVC_SPS_NUT: sps++; break;63 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;
64 case VVC_IDR_N_LP:69 case VVC_IDR_N_LP:
65 case VVC_IDR_W_RADL:70 case VVC_IDR_W_RADL:
66 case VVC_CRA_NUT:71 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;
68 }77 }
69 }78 }
70 }79 }
71 80
72 if (sps && pps && irap)81 if (valid_irap)
73 return AVPROBE_SCORE_EXTENSION + 1; // 1 more than .mpg82 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;
74 return 0;87 return 0;
75}88}
76 89

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