File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
src/AudioTools/AudioCodecs Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -20,12 +20,19 @@ class HeaderParserAAC {
20
20
bool isValid (const uint8_t * data, int len) {
21
21
if (len < 7 ) return false ;
22
22
parser.begin ();
23
- return parser.parse ((uint8_t *)data);
23
+ // regular validation
24
+ if (!parser.parse ((uint8_t *)data)) return false ;
25
+ // check if we have a valid 2nd frame
26
+ if (len > getFrameLength ()) {
27
+ int pos = findSyncWord (data, len, getFrameLength ());
28
+ if (pos == -1 ) return false ;
29
+ }
30
+ return true ;
24
31
}
25
32
26
- int getSampleRate () { return parser.getSampleRate (); }
33
+ int getSampleRate () { return parser.getSampleRate (); }
27
34
28
- uint8_t getChannels () { return parser.data ().channel_cfg ; }
35
+ uint8_t getChannels () { return parser.data ().channel_cfg ; }
29
36
30
37
// / Determines the frame length
31
38
int getFrameLength () { return parser.getFrameLength (); }
You can’t perform that action at this time.
0 commit comments