Is there a reasonable way to play a memory buffer containing AAC (in an MP4 container) in Android? I cannot write this buffer to disk... it must be played from memory.
Seems that my only option is to decode to PCM manually and use AudioTrack since Android doesn't expose any API that plays non-PCM memory buffers. OpenSL ES has support for memory sources, but Android doesn't implement this.
The only way I can find that does this is (as indicated in my question) to manually decode the AAC. There are a few packages for Android that do this, perhaps ffmpeg
is the most well-tested and well-known. ffmpeg
can be distilled down to just an AAC decoder so the memory needs are quite small (although it's frustrating to introduce a decoder to a device that already has one natively).
Once AAC is decoded into PCM, it can be played in Java (AudioTrack
), or natively (OpenSL ES). The playback latency is notably lower for the native option, if such matters to you.