Play AAC buffer on Android

Is there any reasonable way to play back a memory buffer containing AAC (in an MP4 container) in Android? I cannot write this buffer to disk ... it must be played from memory.

It seems like my only option is to decode to PCM manually and use AudioTrack, since Android does not provide an API that plays memory buffers other than PCM. OpenSL ES supports memory sources, but Android does not implement this.

+1
source share
1 answer

The only way to find this (as stated in my question) is to manually decode AAC. There are several Android packages that do this, perhaps the ffmpegmost tested and well known. ffmpegcan be separated to only an AAC decoder, so the memory requirement is quite small (although this disappoints the introduction of the decoder into a device that already has one initially).

Once AAC is decoded in PCM, it can be played in Java ( AudioTrack) or natively (OpenSL ES). Playback latency is noticeably lower for the native option, if that matters to you.

0
source

All Articles