aacparse: incorrect sampling rate in ADTS header for SBR streams
Submitted by A Ashley
An HE-AAC stream contains an AAC-LC stream that uses a given sampling frequency combined with an AAC-SBR enhancement layer that is used to double the sampling frequency of the AAC-LC layer.
When generating ADTS headers, the sampling frequency of the AAC-LC stream should be used, so that AAC decoders that only understand the LC layer can correctly decode them.
Currently aacparse is using the extended sampling rate (either from caps or parsing LOAS) when generating the ADTS header. For example an HE-AAC stream that contains a 24KHz AAC-LC stream plus SBR data to convert it to 48KHz should have the sampling frequency index field of the ADTS header set to 24KHz (to match the AAC-LC stream) but currently it is being set to 48KHz. This causes the stream to fail to decode.