diff options
author | Eric Laurent <elaurent@google.com> | 2011-01-19 18:36:13 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2011-01-20 12:05:25 -0800 |
commit | ab1fe306aeaa3753d33d7052df5d7300c75b86f1 (patch) | |
tree | a1f299f3b08385af5e8da771a57721a533f7e1a4 /services | |
parent | 65d39eeb9b032e5507a01daa25afff62b29bffe4 (diff) | |
download | frameworks_base-ab1fe306aeaa3753d33d7052df5d7300c75b86f1.zip frameworks_base-ab1fe306aeaa3753d33d7052df5d7300c75b86f1.tar.gz frameworks_base-ab1fe306aeaa3753d33d7052df5d7300c75b86f1.tar.bz2 |
do not merge - Fix issue 3371096.
EffectModule::process() was copying effect chain input buffer to
output buffer if no effect was active instead of accumulating it.
Change-Id: If4ca75601ea69a088d0f71d88aec53e90a1dec89
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index cd9b07e..5071555 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -5433,19 +5433,21 @@ void AudioFlinger::EffectModule::process() // clear auxiliary effect input buffer for next accumulation if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY) { - memset(mConfig.inputCfg.buffer.raw, 0, mConfig.inputCfg.buffer.frameCount*sizeof(int32_t)); + memset(mConfig.inputCfg.buffer.raw, 0, + mConfig.inputCfg.buffer.frameCount*sizeof(int32_t)); } } else if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_INSERT && - mConfig.inputCfg.buffer.raw != mConfig.outputCfg.buffer.raw){ - // If an insert effect is idle and input buffer is different from output buffer, copy input to - // output + mConfig.inputCfg.buffer.raw != mConfig.outputCfg.buffer.raw) { + // If an insert effect is idle and input buffer is different from output buffer, + // accumulate input onto output sp<EffectChain> chain = mChain.promote(); if (chain != 0 && chain->activeTracks() != 0) { - size_t size = mConfig.inputCfg.buffer.frameCount * sizeof(int16_t); - if (mConfig.inputCfg.channels == CHANNEL_STEREO) { - size *= 2; + size_t frameCnt = mConfig.inputCfg.buffer.frameCount * 2; //always stereo here + int16_t *in = mConfig.inputCfg.buffer.s16; + int16_t *out = mConfig.outputCfg.buffer.s16; + for (size_t i = 0; i < frameCnt; i++) { + out[i] = clamp16((int32_t)out[i] + (int32_t)in[i]); } - memcpy(mConfig.outputCfg.buffer.raw, mConfig.inputCfg.buffer.raw, size); } } } |