Loading services/audioflinger/AudioFlinger.cpp +18 −21 Original line number Diff line number Diff line Loading @@ -2104,9 +2104,6 @@ sp<IEffect> AudioFlinger::createEffect( } { Mutex::Autolock _l(mLock); if (!EffectIsNullUuid(&pDesc->uuid)) { // if uuid is specified, request effect descriptor lStatus = EffectGetDescriptor(&pDesc->uuid, &desc); Loading Loading @@ -2179,6 +2176,15 @@ sp<IEffect> AudioFlinger::createEffect( // return effect descriptor *pDesc = desc; if (io == 0 && sessionId == AUDIO_SESSION_OUTPUT_MIX) { // if the output returned by getOutputForEffect() is removed before we lock the // mutex below, the call to checkPlaybackThread_l(io) below will detect it // and we will exit safely io = AudioSystem::getOutputForEffect(&desc); ALOGV("createEffect got output %d", io); } Mutex::Autolock _l(mLock); // If output is not specified try to find a matching audio session ID in one of the // output threads. Loading @@ -2192,14 +2198,6 @@ sp<IEffect> AudioFlinger::createEffect( lStatus = BAD_VALUE; goto Exit; } if (sessionId == AUDIO_SESSION_OUTPUT_MIX) { // if the output returned by getOutputForEffect() is removed before we lock the // mutex below, the call to checkPlaybackThread_l(io) below will detect it // and we will exit safely io = AudioSystem::getOutputForEffect(&desc); ALOGV("createEffect got output %d", io); } if (io == 0) { // look for the thread where the specified audio session is present for (size_t i = 0; i < mPlaybackThreads.size(); i++) { if (mPlaybackThreads.valueAt(i)->hasAudioSession(sessionId) != 0) { Loading @@ -2215,7 +2213,6 @@ sp<IEffect> AudioFlinger::createEffect( } } } } // If no output thread contains the requested session ID, default to // first output. The effect chain will be moved to the correct output // thread when a track with the same session ID is created Loading services/audioflinger/Effects.h +4 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,10 @@ // state changes or resource modifications. Always respect the following order // if multiple mutexes must be acquired to avoid cross deadlock: // AudioFlinger -> ThreadBase -> EffectChain -> EffectModule // In addition, methods that lock the AudioPolicyService mutex (getOutputForEffect(), // startOutput()...) should never be called with AudioFlinger or Threadbase mutex locked // to avoid cross deadlock with other clients calling AudioPolicyService methods that in turn // call AudioFlinger thus locking the same mutexes in the reverse order. // The EffectModule class is a wrapper object controlling the effect engine implementation // in the effect library. It prevents concurrent calls to process() and command() functions Loading Loading
services/audioflinger/AudioFlinger.cpp +18 −21 Original line number Diff line number Diff line Loading @@ -2104,9 +2104,6 @@ sp<IEffect> AudioFlinger::createEffect( } { Mutex::Autolock _l(mLock); if (!EffectIsNullUuid(&pDesc->uuid)) { // if uuid is specified, request effect descriptor lStatus = EffectGetDescriptor(&pDesc->uuid, &desc); Loading Loading @@ -2179,6 +2176,15 @@ sp<IEffect> AudioFlinger::createEffect( // return effect descriptor *pDesc = desc; if (io == 0 && sessionId == AUDIO_SESSION_OUTPUT_MIX) { // if the output returned by getOutputForEffect() is removed before we lock the // mutex below, the call to checkPlaybackThread_l(io) below will detect it // and we will exit safely io = AudioSystem::getOutputForEffect(&desc); ALOGV("createEffect got output %d", io); } Mutex::Autolock _l(mLock); // If output is not specified try to find a matching audio session ID in one of the // output threads. Loading @@ -2192,14 +2198,6 @@ sp<IEffect> AudioFlinger::createEffect( lStatus = BAD_VALUE; goto Exit; } if (sessionId == AUDIO_SESSION_OUTPUT_MIX) { // if the output returned by getOutputForEffect() is removed before we lock the // mutex below, the call to checkPlaybackThread_l(io) below will detect it // and we will exit safely io = AudioSystem::getOutputForEffect(&desc); ALOGV("createEffect got output %d", io); } if (io == 0) { // look for the thread where the specified audio session is present for (size_t i = 0; i < mPlaybackThreads.size(); i++) { if (mPlaybackThreads.valueAt(i)->hasAudioSession(sessionId) != 0) { Loading @@ -2215,7 +2213,6 @@ sp<IEffect> AudioFlinger::createEffect( } } } } // If no output thread contains the requested session ID, default to // first output. The effect chain will be moved to the correct output // thread when a track with the same session ID is created Loading
services/audioflinger/Effects.h +4 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,10 @@ // state changes or resource modifications. Always respect the following order // if multiple mutexes must be acquired to avoid cross deadlock: // AudioFlinger -> ThreadBase -> EffectChain -> EffectModule // In addition, methods that lock the AudioPolicyService mutex (getOutputForEffect(), // startOutput()...) should never be called with AudioFlinger or Threadbase mutex locked // to avoid cross deadlock with other clients calling AudioPolicyService methods that in turn // call AudioFlinger thus locking the same mutexes in the reverse order. // The EffectModule class is a wrapper object controlling the effect engine implementation // in the effect library. It prevents concurrent calls to process() and command() functions Loading