播放AAC缓冲在Android [英] Play AAC buffer on Android
问题描述
有没有在Android中播放含有AAC一个内存缓冲区(在MP4容器),一个合理的方式?我也写不了中buffer to disk ...它必须从内存中播放。
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.
看来,我唯一的选择就是去code手动PCM和使用AudioTrack由于Android不公开,发挥非PCM内存缓冲区的API。 OpenSL ES有一个记忆源的支持,但是Android不实现这一点。
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.
推荐答案
我能找到,这是否是(在我的问题表示)的唯一方法手动去code中的AAC。有针对Android的做这几包,也许的ffmpeg
是最完善的测试和知名。 的ffmpeg
可蒸馏下降到只有一个AAC德codeR所以内存的需求是非常小的(虽然这是令人沮丧引进德codeR到一个设备已经有一个本身)。
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).
一旦AAC是德coded到PCM,它可以在Java播放( AudioTrack
)或本机(OpenSL ES)。播放延迟是本机选项明显降低,如果这样的事情给你。
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.
这篇关于播放AAC缓冲在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!