Decoding AAC using MediaCodec API on Android

Posted by Benjamin Reed on Stack Overflow See other posts from Stack Overflow or by Benjamin Reed
Published on 2012-10-17T19:46:59Z Indexed on 2013/06/28 4:21 UTC
Read the original article Hit count: 1342

Filed under:
|

I'm trying to used the MediaCodec API on Android to decode an AAC stream. (It's raw AAC.) I tried using the MediaFormat.createAudioFormat() to create the format object to pass to MediaCodec.configure(), but I kept getting errors when using AAC (audio/mp4a-latm). (It works with MP3 (audio/mpeg) though...)

Finally I created a MediaExtractor for an AAC file and looked at the format object it was producing. I saw that it included the key "csd-0" for a ByteBuffer composed of two bytes both with the value 0x12. If I include that key and value in the format object that I used to configure the AAC codec, everything works.

Does anyone have an idea what is going on? The documentation states that I shouldn't configure that key. Does anyone have a pointer to MediaCodec examples to decode AAC files without using MediaExtractor to generate the format object?

© Stack Overflow or respective owner

Related posts about android

Related posts about aac