Loading services/audioflinger/Effects.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -207,6 +207,24 @@ AudioFlinger::EffectHandle *AudioFlinger::EffectModule::controlHandle_l() return NULL; } // unsafe method called when the effect parent thread has been destroyed ssize_t AudioFlinger::EffectModule::disconnectHandle(EffectHandle *handle, bool unpinIfLast) { ALOGV("disconnect() %p handle %p", this, handle); Mutex::Autolock _l(mLock); ssize_t numHandles = removeHandle_l(handle); if ((numHandles == 0) && (!mPinned || unpinIfLast)) { AudioSystem::unregisterEffect(mId); sp<AudioFlinger> af = mAudioFlinger.promote(); if (af != 0) { mLock.unlock(); af->updateOrphanEffectChains(this); mLock.lock(); } } return numHandles; } bool AudioFlinger::EffectModule::updateState() { Mutex::Autolock _l(mLock); Loading Loading @@ -1260,6 +1278,13 @@ void AudioFlinger::EffectHandle::disconnect(bool unpinIfLast) } if (thread != 0) { thread->disconnectEffectHandle(this, unpinIfLast); } else { ALOGW("%s Effect handle %p disconnected after thread destruction", __FUNCTION__, this); // try to cleanup as much as we can sp<EffectModule> effect = mEffect.promote(); if (effect != 0) { effect->disconnectHandle(this, unpinIfLast); } } if (mClient != 0) { Loading services/audioflinger/Effects.h +1 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ public: const wp<ThreadBase>& thread() { return mThread; } status_t addHandle(EffectHandle *handle); ssize_t disconnectHandle(EffectHandle *handle, bool unpinIfLast); ssize_t removeHandle(EffectHandle *handle); ssize_t removeHandle_l(EffectHandle *handle); Loading services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -400,7 +400,6 @@ void AudioPolicyService::releaseInput(audio_io_handle_t input, sp<AudioPolicyEffects>audioPolicyEffects; { Mutex::Autolock _l(mLock); mAudioPolicyManager->releaseInput(input, session); audioPolicyEffects = mAudioPolicyEffects; } if (audioPolicyEffects != 0) { Loading @@ -410,6 +409,10 @@ void AudioPolicyService::releaseInput(audio_io_handle_t input, ALOGW("Failed to release effects on input %d", input); } } { Mutex::Autolock _l(mLock); mAudioPolicyManager->releaseInput(input, session); } } status_t AudioPolicyService::initStreamVolume(audio_stream_type_t stream, Loading Loading
services/audioflinger/Effects.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -207,6 +207,24 @@ AudioFlinger::EffectHandle *AudioFlinger::EffectModule::controlHandle_l() return NULL; } // unsafe method called when the effect parent thread has been destroyed ssize_t AudioFlinger::EffectModule::disconnectHandle(EffectHandle *handle, bool unpinIfLast) { ALOGV("disconnect() %p handle %p", this, handle); Mutex::Autolock _l(mLock); ssize_t numHandles = removeHandle_l(handle); if ((numHandles == 0) && (!mPinned || unpinIfLast)) { AudioSystem::unregisterEffect(mId); sp<AudioFlinger> af = mAudioFlinger.promote(); if (af != 0) { mLock.unlock(); af->updateOrphanEffectChains(this); mLock.lock(); } } return numHandles; } bool AudioFlinger::EffectModule::updateState() { Mutex::Autolock _l(mLock); Loading Loading @@ -1260,6 +1278,13 @@ void AudioFlinger::EffectHandle::disconnect(bool unpinIfLast) } if (thread != 0) { thread->disconnectEffectHandle(this, unpinIfLast); } else { ALOGW("%s Effect handle %p disconnected after thread destruction", __FUNCTION__, this); // try to cleanup as much as we can sp<EffectModule> effect = mEffect.promote(); if (effect != 0) { effect->disconnectHandle(this, unpinIfLast); } } if (mClient != 0) { Loading
services/audioflinger/Effects.h +1 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ public: const wp<ThreadBase>& thread() { return mThread; } status_t addHandle(EffectHandle *handle); ssize_t disconnectHandle(EffectHandle *handle, bool unpinIfLast); ssize_t removeHandle(EffectHandle *handle); ssize_t removeHandle_l(EffectHandle *handle); Loading
services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -400,7 +400,6 @@ void AudioPolicyService::releaseInput(audio_io_handle_t input, sp<AudioPolicyEffects>audioPolicyEffects; { Mutex::Autolock _l(mLock); mAudioPolicyManager->releaseInput(input, session); audioPolicyEffects = mAudioPolicyEffects; } if (audioPolicyEffects != 0) { Loading @@ -410,6 +409,10 @@ void AudioPolicyService::releaseInput(audio_io_handle_t input, ALOGW("Failed to release effects on input %d", input); } } { Mutex::Autolock _l(mLock); mAudioPolicyManager->releaseInput(input, session); } } status_t AudioPolicyService::initStreamVolume(audio_stream_type_t stream, Loading