Loading services/audioflinger/Effects.cpp +24 −7 Original line number Diff line number Diff line Loading @@ -279,12 +279,29 @@ void AudioFlinger::EffectModule::process() mConfig.inputCfg.buffer.s32, mConfig.inputCfg.buffer.frameCount/2); } int ret; if (isProcessImplemented()) { // do the actual processing in the effect engine int ret = (*mEffectInterface)->process(mEffectInterface, ret = (*mEffectInterface)->process(mEffectInterface, &mConfig.inputCfg.buffer, &mConfig.outputCfg.buffer); } else { if (mConfig.inputCfg.buffer.raw != mConfig.outputCfg.buffer.raw) { size_t frameCnt = mConfig.inputCfg.buffer.frameCount * FCC_2; //always stereo here int16_t *in = mConfig.inputCfg.buffer.s16; int16_t *out = mConfig.outputCfg.buffer.s16; if (mConfig.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) { for (size_t i = 0; i < frameCnt; i++) { out[i] = clamp16((int32_t)out[i] + (int32_t)in[i]); } } else { memcpy(mConfig.outputCfg.buffer.raw, mConfig.inputCfg.buffer.raw, frameCnt * sizeof(int16_t)); } } ret = -ENODATA; } // force transition to IDLE state when engine is ready if (mState == STOPPED && ret == -ENODATA) { mDisableWaitCnt = 1; Loading @@ -301,7 +318,7 @@ void AudioFlinger::EffectModule::process() // accumulate input onto output sp<EffectChain> chain = mChain.promote(); if (chain != 0 && chain->activeTrackCnt() != 0) { size_t frameCnt = mConfig.inputCfg.buffer.frameCount * 2; //always stereo here size_t frameCnt = mConfig.inputCfg.buffer.frameCount * FCC_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++) { Loading services/audioflinger/Effects.h +2 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,8 @@ public: { return (mDescriptor.flags & EFFECT_FLAG_OFFLOAD_SUPPORTED) != 0; } bool isImplementationSoftware() const { return (mDescriptor.flags & EFFECT_FLAG_HW_ACC_MASK) == 0; } bool isProcessImplemented() const { return (mDescriptor.flags & EFFECT_FLAG_NO_PROCESS) == 0; } status_t setOffloaded(bool offloaded, audio_io_handle_t io); bool isOffloaded() const; void addEffectToHal_l(); Loading services/audioflinger/Threads.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -1272,6 +1272,12 @@ status_t AudioFlinger::RecordThread::checkEffectCompatibility_l( desc->name, mThreadName); return BAD_VALUE; } // always allow effects without processing load or latency if ((desc->flags & EFFECT_FLAG_NO_PROCESS_MASK) == EFFECT_FLAG_NO_PROCESS) { return NO_ERROR; } audio_input_flags_t flags = mInput->flags; if (hasFastCapture() || (flags & AUDIO_INPUT_FLAG_FAST)) { if (flags & AUDIO_INPUT_FLAG_RAW) { Loading Loading @@ -1328,6 +1334,11 @@ status_t AudioFlinger::PlaybackThread::checkEffectCompatibility_l( break; } } // always allow effects without processing load or latency if ((desc->flags & EFFECT_FLAG_NO_PROCESS_MASK) == EFFECT_FLAG_NO_PROCESS) { break; } if (flags & AUDIO_OUTPUT_FLAG_RAW) { ALOGW("checkEffectCompatibility_l(): effect %s on playback thread in raw mode", desc->name); Loading Loading
services/audioflinger/Effects.cpp +24 −7 Original line number Diff line number Diff line Loading @@ -279,12 +279,29 @@ void AudioFlinger::EffectModule::process() mConfig.inputCfg.buffer.s32, mConfig.inputCfg.buffer.frameCount/2); } int ret; if (isProcessImplemented()) { // do the actual processing in the effect engine int ret = (*mEffectInterface)->process(mEffectInterface, ret = (*mEffectInterface)->process(mEffectInterface, &mConfig.inputCfg.buffer, &mConfig.outputCfg.buffer); } else { if (mConfig.inputCfg.buffer.raw != mConfig.outputCfg.buffer.raw) { size_t frameCnt = mConfig.inputCfg.buffer.frameCount * FCC_2; //always stereo here int16_t *in = mConfig.inputCfg.buffer.s16; int16_t *out = mConfig.outputCfg.buffer.s16; if (mConfig.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) { for (size_t i = 0; i < frameCnt; i++) { out[i] = clamp16((int32_t)out[i] + (int32_t)in[i]); } } else { memcpy(mConfig.outputCfg.buffer.raw, mConfig.inputCfg.buffer.raw, frameCnt * sizeof(int16_t)); } } ret = -ENODATA; } // force transition to IDLE state when engine is ready if (mState == STOPPED && ret == -ENODATA) { mDisableWaitCnt = 1; Loading @@ -301,7 +318,7 @@ void AudioFlinger::EffectModule::process() // accumulate input onto output sp<EffectChain> chain = mChain.promote(); if (chain != 0 && chain->activeTrackCnt() != 0) { size_t frameCnt = mConfig.inputCfg.buffer.frameCount * 2; //always stereo here size_t frameCnt = mConfig.inputCfg.buffer.frameCount * FCC_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++) { Loading
services/audioflinger/Effects.h +2 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,8 @@ public: { return (mDescriptor.flags & EFFECT_FLAG_OFFLOAD_SUPPORTED) != 0; } bool isImplementationSoftware() const { return (mDescriptor.flags & EFFECT_FLAG_HW_ACC_MASK) == 0; } bool isProcessImplemented() const { return (mDescriptor.flags & EFFECT_FLAG_NO_PROCESS) == 0; } status_t setOffloaded(bool offloaded, audio_io_handle_t io); bool isOffloaded() const; void addEffectToHal_l(); Loading
services/audioflinger/Threads.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -1272,6 +1272,12 @@ status_t AudioFlinger::RecordThread::checkEffectCompatibility_l( desc->name, mThreadName); return BAD_VALUE; } // always allow effects without processing load or latency if ((desc->flags & EFFECT_FLAG_NO_PROCESS_MASK) == EFFECT_FLAG_NO_PROCESS) { return NO_ERROR; } audio_input_flags_t flags = mInput->flags; if (hasFastCapture() || (flags & AUDIO_INPUT_FLAG_FAST)) { if (flags & AUDIO_INPUT_FLAG_RAW) { Loading Loading @@ -1328,6 +1334,11 @@ status_t AudioFlinger::PlaybackThread::checkEffectCompatibility_l( break; } } // always allow effects without processing load or latency if ((desc->flags & EFFECT_FLAG_NO_PROCESS_MASK) == EFFECT_FLAG_NO_PROCESS) { break; } if (flags & AUDIO_OUTPUT_FLAG_RAW) { ALOGW("checkEffectCompatibility_l(): effect %s on playback thread in raw mode", desc->name); Loading