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 {
2020 bool isValid (const uint8_t * data, int len) {
2121 if (len < 7 ) return false ;
2222 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 ;
2431 }
2532
26- int getSampleRate () { return parser.getSampleRate (); }
33+ int getSampleRate () { return parser.getSampleRate (); }
2734
28- uint8_t getChannels () { return parser.data ().channel_cfg ; }
35+ uint8_t getChannels () { return parser.data ().channel_cfg ; }
2936
3037 // / Determines the frame length
3138 int getFrameLength () { return parser.getFrameLength (); }
You can’t perform that action at this time.
0 commit comments