Hello,
I am trying to parse an AAC stream and extract at frame (or packet, sorry if I don't have the right terminology) boundaries. When parsing an MP3 stream, I can take the frame length from the header and expect to see a sync word at header offset + frame length. In every AAC stream I've looked at taking the frame length as a byte count (according to an old version of ISO 14496-3 that I have) and adding that to the frame header offset always seems to put me at an arbitrary offset (i.e. non-syncword) in the stream.
Can anyone tell me how to determine from the ADTS header (if possible) the total length of the compressed packet? I'd really like to be able to fill a buffer with a "whole" frame and expect to see the syncword as the next byte in the stream.
I'm asking for two reasons:
1) because I need to send a complete packet to the decoder, and
2) because I'd like to do an integrity check on the stream, i.e. if a syncword shows up at the a calculated offset then I can probably assume the frame was transmitted correctly.
Is it possible the spec I have is out of data and the AAC frame length field is the number of bits for a single channel, where the total frame bytes would then be (frame length * channel count / 8)?
Thank you!