Loading services/audioflinger/AudioFlinger.cpp +17 −4 Original line number Diff line number Diff line Loading @@ -1921,6 +1921,18 @@ void AudioFlinger::releaseAudioSessionId(int audioSession) ALOGW_IF(caller != getpid_cached, "session id %d not found for pid %d", audioSession, caller); } bool AudioFlinger::isSessionAcquired_l(int audioSession) { size_t num = mAudioSessionRefs.size(); for (size_t i = 0; i < num; i++) { AudioSessionRef *ref = mAudioSessionRefs.itemAt(i); if (ref->mSessionid == audioSession) { return true; } } return false; } void AudioFlinger::purgeStaleEffects_l() { ALOGV("purging stale effects"); Loading Loading @@ -2253,8 +2265,9 @@ sp<IEffect> AudioFlinger::createEffect( sp<Client> client = registerPid_l(pid); // create effect on selected output thread bool pinned = (sessionId > AUDIO_SESSION_OUTPUT_MIX) && isSessionAcquired_l(sessionId); handle = thread->createEffect_l(client, effectClient, priority, sessionId, &desc, enabled, &lStatus); &desc, enabled, &lStatus, pinned); if (handle != 0 && id != NULL) { *id = handle->id(); } Loading services/audioflinger/AudioFlinger.h +1 −0 Original line number Diff line number Diff line Loading @@ -470,6 +470,7 @@ private: bool isNonOffloadableGlobalEffectEnabled_l(); void onNonOffloadableGlobalEffectEnable(); bool isSessionAcquired_l(int audioSession); class AudioHwDevice { public: Loading services/audioflinger/AudioPolicyService.cpp +6 −8 Original line number Diff line number Diff line Loading @@ -383,17 +383,15 @@ void AudioPolicyService::releaseInput(audio_io_handle_t input) return; } Mutex::Autolock _l(mLock); mpAudioPolicy->release_input(mpAudioPolicy, input); ssize_t index = mInputs.indexOfKey(input); if (index < 0) { return; } if (index >= 0) { InputDesc *inputDesc = mInputs.valueAt(index); setPreProcessorEnabled(inputDesc, false); delete inputDesc; mInputs.removeItemsAt(index); } mpAudioPolicy->release_input(mpAudioPolicy, input); } status_t AudioPolicyService::initStreamVolume(audio_stream_type_t stream, int indexMin, Loading services/audioflinger/Effects.cpp +158 −83 File changed.Preview size limit exceeded, changes collapsed. Show changes services/audioflinger/Effects.h +26 −11 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ public: const wp<AudioFlinger::EffectChain>& chain, effect_descriptor_t *desc, int id, int sessionId); int sessionId, bool pinned); virtual ~EffectModule(); enum effect_state { Loading Loading @@ -93,8 +94,9 @@ public: const wp<ThreadBase>& thread() { return mThread; } status_t addHandle(EffectHandle *handle); size_t disconnect(EffectHandle *handle, bool unpinIfLast); size_t removeHandle(EffectHandle *handle); ssize_t disconnectHandle(EffectHandle *handle, bool unpinIfLast); ssize_t removeHandle(EffectHandle *handle); ssize_t removeHandle_l(EffectHandle *handle); const effect_descriptor_t& desc() const { return mDescriptor; } wp<EffectChain>& chain() { return mChain; } Loading @@ -119,6 +121,7 @@ public: { return (mDescriptor.flags & EFFECT_FLAG_OFFLOAD_SUPPORTED) != 0; } status_t setOffloaded(bool offloaded, audio_io_handle_t io); bool isOffloaded() const; void release_l(); void dump(int fd, const Vector<String16>& args); Loading Loading @@ -201,12 +204,17 @@ public: bool enabled() const { return mEnabled; } // Getters int id() const { return mEffect->id(); } wp<EffectModule> effect() const { return mEffect; } int id() const { sp<EffectModule> effect = mEffect.promote(); if (effect == 0) { return 0; } return effect->id(); } int priority() const { return mPriority; } bool hasControl() const { return mHasControl; } sp<EffectModule> effect() const { return mEffect; } // destroyed_l() must be called with the associated EffectModule mLock held bool destroyed_l() const { return mDestroyed; } bool disconnected() const { return mDisconnected; } void dump(char* buffer, size_t size); Loading @@ -215,7 +223,8 @@ protected: EffectHandle(const EffectHandle&); EffectHandle& operator =(const EffectHandle&); sp<EffectModule> mEffect; // pointer to controlled EffectModule Mutex mLock; // protects IEffect method calls wp<EffectModule> mEffect; // pointer to controlled EffectModule sp<IEffectClient> mEffectClient; // callback interface for client notifications /*const*/ sp<Client> mClient; // client for shared memory allocation, see disconnect() sp<IMemory> mCblkMemory; // shared memory for control block Loading @@ -226,8 +235,7 @@ protected: bool mHasControl; // true if this handle is controlling the effect bool mEnabled; // cached enable state: needed when the effect is // restored after being suspended bool mDestroyed; // Set to true by destructor. Access with EffectModule // mLock held bool mDisconnected; // Set to true by disconnect() }; // the EffectChain class represents a group of effects associated to one audio session. Loading Loading @@ -260,8 +268,15 @@ public: mLock.unlock(); } status_t createEffect_l(sp<EffectModule>& effect, ThreadBase *thread, effect_descriptor_t *desc, int id, int sessionId, bool pinned); status_t addEffect_l(const sp<EffectModule>& handle); size_t removeEffect_l(const sp<EffectModule>& handle); status_t addEffect_ll(const sp<EffectModule>& handle); size_t removeEffect_l(const sp<EffectModule>& handle, bool release = false); int sessionId() const { return mSessionId; } void setSessionId(int sessionId) { mSessionId = sessionId; } Loading Loading
services/audioflinger/AudioFlinger.cpp +17 −4 Original line number Diff line number Diff line Loading @@ -1921,6 +1921,18 @@ void AudioFlinger::releaseAudioSessionId(int audioSession) ALOGW_IF(caller != getpid_cached, "session id %d not found for pid %d", audioSession, caller); } bool AudioFlinger::isSessionAcquired_l(int audioSession) { size_t num = mAudioSessionRefs.size(); for (size_t i = 0; i < num; i++) { AudioSessionRef *ref = mAudioSessionRefs.itemAt(i); if (ref->mSessionid == audioSession) { return true; } } return false; } void AudioFlinger::purgeStaleEffects_l() { ALOGV("purging stale effects"); Loading Loading @@ -2253,8 +2265,9 @@ sp<IEffect> AudioFlinger::createEffect( sp<Client> client = registerPid_l(pid); // create effect on selected output thread bool pinned = (sessionId > AUDIO_SESSION_OUTPUT_MIX) && isSessionAcquired_l(sessionId); handle = thread->createEffect_l(client, effectClient, priority, sessionId, &desc, enabled, &lStatus); &desc, enabled, &lStatus, pinned); if (handle != 0 && id != NULL) { *id = handle->id(); } Loading
services/audioflinger/AudioFlinger.h +1 −0 Original line number Diff line number Diff line Loading @@ -470,6 +470,7 @@ private: bool isNonOffloadableGlobalEffectEnabled_l(); void onNonOffloadableGlobalEffectEnable(); bool isSessionAcquired_l(int audioSession); class AudioHwDevice { public: Loading
services/audioflinger/AudioPolicyService.cpp +6 −8 Original line number Diff line number Diff line Loading @@ -383,17 +383,15 @@ void AudioPolicyService::releaseInput(audio_io_handle_t input) return; } Mutex::Autolock _l(mLock); mpAudioPolicy->release_input(mpAudioPolicy, input); ssize_t index = mInputs.indexOfKey(input); if (index < 0) { return; } if (index >= 0) { InputDesc *inputDesc = mInputs.valueAt(index); setPreProcessorEnabled(inputDesc, false); delete inputDesc; mInputs.removeItemsAt(index); } mpAudioPolicy->release_input(mpAudioPolicy, input); } status_t AudioPolicyService::initStreamVolume(audio_stream_type_t stream, int indexMin, Loading
services/audioflinger/Effects.cpp +158 −83 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/audioflinger/Effects.h +26 −11 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ public: const wp<AudioFlinger::EffectChain>& chain, effect_descriptor_t *desc, int id, int sessionId); int sessionId, bool pinned); virtual ~EffectModule(); enum effect_state { Loading Loading @@ -93,8 +94,9 @@ public: const wp<ThreadBase>& thread() { return mThread; } status_t addHandle(EffectHandle *handle); size_t disconnect(EffectHandle *handle, bool unpinIfLast); size_t removeHandle(EffectHandle *handle); ssize_t disconnectHandle(EffectHandle *handle, bool unpinIfLast); ssize_t removeHandle(EffectHandle *handle); ssize_t removeHandle_l(EffectHandle *handle); const effect_descriptor_t& desc() const { return mDescriptor; } wp<EffectChain>& chain() { return mChain; } Loading @@ -119,6 +121,7 @@ public: { return (mDescriptor.flags & EFFECT_FLAG_OFFLOAD_SUPPORTED) != 0; } status_t setOffloaded(bool offloaded, audio_io_handle_t io); bool isOffloaded() const; void release_l(); void dump(int fd, const Vector<String16>& args); Loading Loading @@ -201,12 +204,17 @@ public: bool enabled() const { return mEnabled; } // Getters int id() const { return mEffect->id(); } wp<EffectModule> effect() const { return mEffect; } int id() const { sp<EffectModule> effect = mEffect.promote(); if (effect == 0) { return 0; } return effect->id(); } int priority() const { return mPriority; } bool hasControl() const { return mHasControl; } sp<EffectModule> effect() const { return mEffect; } // destroyed_l() must be called with the associated EffectModule mLock held bool destroyed_l() const { return mDestroyed; } bool disconnected() const { return mDisconnected; } void dump(char* buffer, size_t size); Loading @@ -215,7 +223,8 @@ protected: EffectHandle(const EffectHandle&); EffectHandle& operator =(const EffectHandle&); sp<EffectModule> mEffect; // pointer to controlled EffectModule Mutex mLock; // protects IEffect method calls wp<EffectModule> mEffect; // pointer to controlled EffectModule sp<IEffectClient> mEffectClient; // callback interface for client notifications /*const*/ sp<Client> mClient; // client for shared memory allocation, see disconnect() sp<IMemory> mCblkMemory; // shared memory for control block Loading @@ -226,8 +235,7 @@ protected: bool mHasControl; // true if this handle is controlling the effect bool mEnabled; // cached enable state: needed when the effect is // restored after being suspended bool mDestroyed; // Set to true by destructor. Access with EffectModule // mLock held bool mDisconnected; // Set to true by disconnect() }; // the EffectChain class represents a group of effects associated to one audio session. Loading Loading @@ -260,8 +268,15 @@ public: mLock.unlock(); } status_t createEffect_l(sp<EffectModule>& effect, ThreadBase *thread, effect_descriptor_t *desc, int id, int sessionId, bool pinned); status_t addEffect_l(const sp<EffectModule>& handle); size_t removeEffect_l(const sp<EffectModule>& handle); status_t addEffect_ll(const sp<EffectModule>& handle); size_t removeEffect_l(const sp<EffectModule>& handle, bool release = false); int sessionId() const { return mSessionId; } void setSessionId(int sessionId) { mSessionId = sessionId; } Loading