summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.cpp
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-03-13 13:59:29 -0700
committerAndy Hung <hunga@google.com>2014-03-13 15:39:43 -0700
commit5b10a2037a835e790994b9ebec3c2e55052f1f3b (patch)
treef886a67e0d6ae5f9d6d192b76fab7e4bfaa2209a /services/audioflinger/Threads.cpp
parent010a1a1a552cdaad362cea8a0333b8906402dbcb (diff)
downloadframeworks_av-5b10a2037a835e790994b9ebec3c2e55052f1f3b.zip
frameworks_av-5b10a2037a835e790994b9ebec3c2e55052f1f3b.tar.gz
frameworks_av-5b10a2037a835e790994b9ebec3c2e55052f1f3b.tar.bz2
Fix Offload playback in AudioFlinger
This fixes Offload playback regression introduced by adding flexible format to mSinkBuffer. Test case is AAC file playback. Bug: 13450717 Change-Id: I0fa11978295ed4793be90c565e5b8abedf156914 Signed-off-by: Andy Hung <hunga@google.com>
Diffstat (limited to 'services/audioflinger/Threads.cpp')
-rw-r--r--services/audioflinger/Threads.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 8aee194..1c46c27 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -1786,8 +1786,9 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l()
// Originally this was int16_t[] array, need to remove legacy implications.
free(mSinkBuffer);
mSinkBuffer = NULL;
- const size_t sinkBufferSize = mNormalFrameCount * mChannelCount
- * audio_bytes_per_sample(mFormat);
+ // For sink buffer size, we use the frame size from the downstream sink to avoid problems
+ // with non PCM formats for compressed music, e.g. AAC, and Offload threads.
+ const size_t sinkBufferSize = mNormalFrameCount * mFrameSize;
(void)posix_memalign(&mSinkBuffer, 32, sinkBufferSize);
// We resize the mMixerBuffer according to the requirements of the sink buffer which