It seems that AudioFlinger can play sound up to 1 MB at any given time. Heap errors occur if this limit is exceeded. This assumption is based on some code that I found in the AudioFlinger source code:
AudioFlinger::Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid) : RefBase(), mAudioFlinger(audioFlinger), mMemoryDealer(new MemoryDealer(1024*1024)), mPid(pid) {
And this:
size_t size = sizeof(audio_track_cblk_t); size_t bufferSize = frameCount*channelCount*sizeof(int16_t); if (sharedBuffer == 0) { size += bufferSize; } mCblkMemory = client->heap()->allocate(size); if (mCblkMemory != 0) { ... } else { LOGE("not enough memory for AudioTrack size=%u", size); client->heap()->dump("AudioTrack"); }
Is anyone even better informed?
volley
source share