diff options
author | Ricardo Garcia <rago@google.com> | 2014-08-12 16:04:45 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-11 17:59:47 +0000 |
commit | e7a1737c92cf2e84754ffbc52cfec8edeffcbc75 (patch) | |
tree | a455b627387548eb77e11e88fb7b54612516c296 /services/audioflinger | |
parent | dbdaa08cbed61b9ba4afc43f0ce0230346a1ca2f (diff) | |
parent | 726b6a7540ac997928df1a14dfede872a82f6210 (diff) | |
download | frameworks_av-e7a1737c92cf2e84754ffbc52cfec8edeffcbc75.zip frameworks_av-e7a1737c92cf2e84754ffbc52cfec8edeffcbc75.tar.gz frameworks_av-e7a1737c92cf2e84754ffbc52cfec8edeffcbc75.tar.bz2 |
Merge "Fix to support mono in effect buffer allocation." into lmp-dev
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/Effects.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp index ec3d731..365f271 100644 --- a/services/audioflinger/Effects.cpp +++ b/services/audioflinger/Effects.cpp @@ -44,6 +44,8 @@ #define ALOGVV(a...) do { } while(0) #endif +#define min(a, b) ((a) < (b) ? (a) : (b)) + namespace android { // ---------------------------------------------------------------------------- @@ -1391,7 +1393,8 @@ void AudioFlinger::EffectChain::clearInputBuffer_l(sp<ThreadBase> thread) // and sample format changes for effects. // Currently effects processing is only available for stereo, AUDIO_FORMAT_PCM_16_BIT // (4 bytes frame size) - const size_t frameSize = audio_bytes_per_sample(AUDIO_FORMAT_PCM_16_BIT) * FCC_2; + const size_t frameSize = + audio_bytes_per_sample(AUDIO_FORMAT_PCM_16_BIT) * min(FCC_2, thread->channelCount()); memset(mInBuffer, 0, thread->frameCount() * frameSize); } |