Loading media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +209 −125 File changed.Preview size limit exceeded, changes collapsed. Show changes media/libeffects/lvm/wrapper/Bundle/EffectBundle.h +2 −1 Original line number Diff line number Diff line Loading @@ -88,12 +88,13 @@ struct BundledEffectContext{ int positionSaved; bool bMuteEnabled; /* Must store as mute = -96dB level */ bool bStereoPositionEnabled; int frameCount; LVM_Fs_en SampleRate; int SamplesPerSecond; int SamplesToExitCountEq; int SamplesToExitCountBb; int SamplesToExitCountVirt; LVM_INT16 *workBuffer; int frameCount; #ifdef LVM_PCM FILE *PcmInPtr; FILE *PcmOutPtr; Loading services/audioflinger/AudioFlinger.cpp +32 −8 Original line number Diff line number Diff line Loading @@ -5332,6 +5332,15 @@ size_t AudioFlinger::EffectModule::removeHandle(const wp<EffectHandle>& handle) } } // Release effect engine here so that it is done immediately. Otherwise it will be released // by the destructor when the last strong reference on the this object is released which can // happen after next process is called on this effect. if (size == 0 && mEffectInterface != NULL) { // release effect engine EffectRelease(mEffectInterface); mEffectInterface = NULL; } return size; } Loading Loading @@ -6145,23 +6154,38 @@ sp<AudioFlinger::EffectModule> AudioFlinger::EffectChain::getEffectFromId_l(int // Must be called with EffectChain::mLock locked void AudioFlinger::EffectChain::process_l() { sp<ThreadBase> thread = mThread.promote(); if (thread == 0) { LOGW("process_l(): cannot promote mixer thread"); return; } PlaybackThread *playbackThread = (PlaybackThread *)thread.get(); bool isGlobalSession = (mSessionId == AudioSystem::SESSION_OUTPUT_MIX) || (mSessionId == AudioSystem::SESSION_OUTPUT_STAGE); bool tracksOnSession = false; if (!isGlobalSession) { tracksOnSession = playbackThread->hasAudioSession(mSessionId) & PlaybackThread::TRACK_SESSION; } size_t size = mEffects.size(); // do not process effect if no track is present in same audio session if (isGlobalSession || tracksOnSession) { for (size_t i = 0; i < size; i++) { mEffects[i]->process(); } } for (size_t i = 0; i < size; i++) { mEffects[i]->updateState(); } // if no track is active, input buffer must be cleared here as the mixer process // will not do it if (mSessionId > 0 && activeTracks() == 0) { sp<ThreadBase> thread = mThread.promote(); if (thread != 0) { size_t numSamples = thread->frameCount() * thread->channelCount(); if (tracksOnSession && activeTracks() == 0) { size_t numSamples = playbackThread->frameCount() * playbackThread->channelCount(); memset(mInBuffer, 0, numSamples * sizeof(int16_t)); } } } // addEffect_l() must be called with PlaybackThread::mLock held status_t AudioFlinger::EffectChain::addEffect_l(const sp<EffectModule>& effect) Loading Loading
media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +209 −125 File changed.Preview size limit exceeded, changes collapsed. Show changes
media/libeffects/lvm/wrapper/Bundle/EffectBundle.h +2 −1 Original line number Diff line number Diff line Loading @@ -88,12 +88,13 @@ struct BundledEffectContext{ int positionSaved; bool bMuteEnabled; /* Must store as mute = -96dB level */ bool bStereoPositionEnabled; int frameCount; LVM_Fs_en SampleRate; int SamplesPerSecond; int SamplesToExitCountEq; int SamplesToExitCountBb; int SamplesToExitCountVirt; LVM_INT16 *workBuffer; int frameCount; #ifdef LVM_PCM FILE *PcmInPtr; FILE *PcmOutPtr; Loading
services/audioflinger/AudioFlinger.cpp +32 −8 Original line number Diff line number Diff line Loading @@ -5332,6 +5332,15 @@ size_t AudioFlinger::EffectModule::removeHandle(const wp<EffectHandle>& handle) } } // Release effect engine here so that it is done immediately. Otherwise it will be released // by the destructor when the last strong reference on the this object is released which can // happen after next process is called on this effect. if (size == 0 && mEffectInterface != NULL) { // release effect engine EffectRelease(mEffectInterface); mEffectInterface = NULL; } return size; } Loading Loading @@ -6145,23 +6154,38 @@ sp<AudioFlinger::EffectModule> AudioFlinger::EffectChain::getEffectFromId_l(int // Must be called with EffectChain::mLock locked void AudioFlinger::EffectChain::process_l() { sp<ThreadBase> thread = mThread.promote(); if (thread == 0) { LOGW("process_l(): cannot promote mixer thread"); return; } PlaybackThread *playbackThread = (PlaybackThread *)thread.get(); bool isGlobalSession = (mSessionId == AudioSystem::SESSION_OUTPUT_MIX) || (mSessionId == AudioSystem::SESSION_OUTPUT_STAGE); bool tracksOnSession = false; if (!isGlobalSession) { tracksOnSession = playbackThread->hasAudioSession(mSessionId) & PlaybackThread::TRACK_SESSION; } size_t size = mEffects.size(); // do not process effect if no track is present in same audio session if (isGlobalSession || tracksOnSession) { for (size_t i = 0; i < size; i++) { mEffects[i]->process(); } } for (size_t i = 0; i < size; i++) { mEffects[i]->updateState(); } // if no track is active, input buffer must be cleared here as the mixer process // will not do it if (mSessionId > 0 && activeTracks() == 0) { sp<ThreadBase> thread = mThread.promote(); if (thread != 0) { size_t numSamples = thread->frameCount() * thread->channelCount(); if (tracksOnSession && activeTracks() == 0) { size_t numSamples = playbackThread->frameCount() * playbackThread->channelCount(); memset(mInBuffer, 0, numSamples * sizeof(int16_t)); } } } // addEffect_l() must be called with PlaybackThread::mLock held status_t AudioFlinger::EffectChain::addEffect_l(const sp<EffectModule>& effect) Loading