Skip to content

Commit 769643e

Browse files
authored
aac: Additional HE-AAC detection in the decoder (#415)
1 parent 3b29ca0 commit 769643e

File tree

1 file changed

+13
-2
lines changed
  • symphonia-codec-aac/src/aac

1 file changed

+13
-2
lines changed

symphonia-codec-aac/src/aac/mod.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,14 @@ impl AacDecoder {
375375
}
376376
for _ in 0..count {
377377
// ext payload
378-
bs.ignore_bits(8)?;
378+
let ext_type = bs.read_bits_leq32(4)?;
379+
380+
// 13 == Parametric Stereo (HE-AAC v2)
381+
// 14 == SBR (HE-AAC)
382+
if ext_type == 13 || ext_type == 14 {
383+
self.m4ainfo.sbr_present = true;
384+
}
385+
bs.ignore_bits(4)?;
379386
}
380387
}
381388
7 => {
@@ -453,7 +460,11 @@ impl Decoder for AacDecoder {
453460

454461
//print!("edata:"); for s in edata.iter() { print!(" {:02X}", *s);}println!("");
455462

456-
if (m4ainfo.otype != M4AType::Lc) || (m4ainfo.channels > 2) || (m4ainfo.samples != 1024) {
463+
if (m4ainfo.otype != M4AType::Lc)
464+
|| (m4ainfo.sbr_present)
465+
|| (m4ainfo.channels > 2)
466+
|| (m4ainfo.samples != 1024)
467+
{
457468
return unsupported_error("aac: aac too complex");
458469
}
459470

0 commit comments

Comments
 (0)