Loading services/audioflinger/Effects.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -2574,8 +2574,13 @@ bool EffectChain::hasVolumeControlEnabled_l() const { return false; } // setVolume_l() must be called with IAfThreadBase::mutex() or EffectChain::mutex() held bool EffectChain::setVolume_l(uint32_t *left, uint32_t *right, bool force) bool EffectChain::setVolume_l(uint32_t* left, uint32_t* right, bool force) { audio_utils::lock_guard _l(mutex()); return setVolume_ll(left, right, force); } // setVolume_l() must be called with IAfThreadBase::mutex() and EffectChain::mutex() held bool EffectChain::setVolume_ll(uint32_t *left, uint32_t *right, bool force) { uint32_t newLeft = *left; uint32_t newRight = *right; Loading services/audioflinger/Effects.h +8 −5 Original line number Diff line number Diff line Loading @@ -401,7 +401,7 @@ class EffectChain : public IAfEffectChain { public: EffectChain(const sp<IAfThreadBase>& thread, audio_session_t sessionId); void process_l() final; void process_l() final REQUIRES(audio_utils::ThreadBase_Mutex); audio_utils::mutex& mutex() const final { return mMutex; } Loading @@ -423,8 +423,11 @@ public: std::vector<int> getEffectIds() const final; // FIXME use float to improve the dynamic range bool setVolume_l(uint32_t *left, uint32_t *right, bool force = false) final; void resetVolume_l() final; bool setVolume_l(uint32_t* left, uint32_t* right, bool force = false) final REQUIRES(audio_utils::ThreadBase_Mutex) EXCLUDES_EffectChain_Mutex; bool setVolume_ll(uint32_t* left, uint32_t* right, bool force = false) final REQUIRES(audio_utils::ThreadBase_Mutex, mutex()); void resetVolume_l() final REQUIRES(audio_utils::ThreadBase_Mutex); void setDevices_l(const AudioDeviceTypeAddrVector &devices) final; void setInputDevice_l(const AudioDeviceTypeAddr &device) final; void setMode_l(audio_mode_t mode) final; Loading Loading @@ -570,7 +573,7 @@ private: // check if effects should be suspended/restored when a given effect is enable/disabled void checkSuspendOnEffectEnabled(const sp<IAfEffectBase>& effect, bool enabled, bool threadLocked) override; void resetVolume() override; void resetVolume() override REQUIRES(audio_utils::ThreadBase_Mutex); product_strategy_t strategy() const override; int32_t activeTrackCnt() const override; void onEffectEnable(const sp<IAfEffectBase>& effect) override; Loading Loading @@ -745,7 +748,7 @@ private: void checkSuspendOnEffectEnabled(const sp<IAfEffectBase>& effect __unused, bool enabled __unused, bool threadLocked __unused) override {} void resetVolume() override {} void resetVolume() override REQUIRES(audio_utils::ThreadBase_Mutex) {} product_strategy_t strategy() const override { return static_cast<product_strategy_t>(0); } int32_t activeTrackCnt() const override { return 0; } void onEffectEnable(const sp<IAfEffectBase>& effect __unused) override; Loading services/audioflinger/IAfEffect.h +4 −1 Original line number Diff line number Diff line Loading @@ -241,7 +241,10 @@ public: virtual sp<IAfEffectModule> getEffectFromId_l(int id) const = 0; virtual sp<IAfEffectModule> getEffectFromType_l(const effect_uuid_t *type) const = 0; virtual std::vector<int> getEffectIds() const = 0; virtual bool setVolume_l(uint32_t *left, uint32_t *right, bool force = false) = 0; virtual bool setVolume_l(uint32_t* left, uint32_t* right, bool force = false) REQUIRES(audio_utils::ThreadBase_Mutex) EXCLUDES_EffectChain_Mutex = 0; virtual bool setVolume_ll(uint32_t* left, uint32_t* right, bool force = false) REQUIRES(audio_utils::ThreadBase_Mutex, audio_utils::EffectChain_Mutex) = 0; virtual void resetVolume_l() = 0; virtual void setDevices_l(const AudioDeviceTypeAddrVector &devices) = 0; virtual void setInputDevice_l(const AudioDeviceTypeAddr &device) = 0; Loading services/audioflinger/Threads.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -5497,6 +5497,7 @@ PlaybackThread::mixer_state MixerThread::prepareTracks_l( if (masterMute) { masterVolume = 0; } // Delegate master volume control to effect in output mix effect chain if needed sp<IAfEffectChain> chain = getEffectChain_l(AUDIO_SESSION_OUTPUT_MIX); if (chain != 0) { Loading Loading @@ -5836,7 +5837,7 @@ PlaybackThread::mixer_state MixerThread::prepareTracks_l( mixedTracks++; // track->mainBuffer() != mSinkBuffer or mMixerBuffer means // track->mainBuffer() != mSinkBuffer and mMixerBuffer means // there is an effect chain connected to the track chain.clear(); if (track->mainBuffer() != mSinkBuffer && Loading Loading
services/audioflinger/Effects.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -2574,8 +2574,13 @@ bool EffectChain::hasVolumeControlEnabled_l() const { return false; } // setVolume_l() must be called with IAfThreadBase::mutex() or EffectChain::mutex() held bool EffectChain::setVolume_l(uint32_t *left, uint32_t *right, bool force) bool EffectChain::setVolume_l(uint32_t* left, uint32_t* right, bool force) { audio_utils::lock_guard _l(mutex()); return setVolume_ll(left, right, force); } // setVolume_l() must be called with IAfThreadBase::mutex() and EffectChain::mutex() held bool EffectChain::setVolume_ll(uint32_t *left, uint32_t *right, bool force) { uint32_t newLeft = *left; uint32_t newRight = *right; Loading
services/audioflinger/Effects.h +8 −5 Original line number Diff line number Diff line Loading @@ -401,7 +401,7 @@ class EffectChain : public IAfEffectChain { public: EffectChain(const sp<IAfThreadBase>& thread, audio_session_t sessionId); void process_l() final; void process_l() final REQUIRES(audio_utils::ThreadBase_Mutex); audio_utils::mutex& mutex() const final { return mMutex; } Loading @@ -423,8 +423,11 @@ public: std::vector<int> getEffectIds() const final; // FIXME use float to improve the dynamic range bool setVolume_l(uint32_t *left, uint32_t *right, bool force = false) final; void resetVolume_l() final; bool setVolume_l(uint32_t* left, uint32_t* right, bool force = false) final REQUIRES(audio_utils::ThreadBase_Mutex) EXCLUDES_EffectChain_Mutex; bool setVolume_ll(uint32_t* left, uint32_t* right, bool force = false) final REQUIRES(audio_utils::ThreadBase_Mutex, mutex()); void resetVolume_l() final REQUIRES(audio_utils::ThreadBase_Mutex); void setDevices_l(const AudioDeviceTypeAddrVector &devices) final; void setInputDevice_l(const AudioDeviceTypeAddr &device) final; void setMode_l(audio_mode_t mode) final; Loading Loading @@ -570,7 +573,7 @@ private: // check if effects should be suspended/restored when a given effect is enable/disabled void checkSuspendOnEffectEnabled(const sp<IAfEffectBase>& effect, bool enabled, bool threadLocked) override; void resetVolume() override; void resetVolume() override REQUIRES(audio_utils::ThreadBase_Mutex); product_strategy_t strategy() const override; int32_t activeTrackCnt() const override; void onEffectEnable(const sp<IAfEffectBase>& effect) override; Loading Loading @@ -745,7 +748,7 @@ private: void checkSuspendOnEffectEnabled(const sp<IAfEffectBase>& effect __unused, bool enabled __unused, bool threadLocked __unused) override {} void resetVolume() override {} void resetVolume() override REQUIRES(audio_utils::ThreadBase_Mutex) {} product_strategy_t strategy() const override { return static_cast<product_strategy_t>(0); } int32_t activeTrackCnt() const override { return 0; } void onEffectEnable(const sp<IAfEffectBase>& effect __unused) override; Loading
services/audioflinger/IAfEffect.h +4 −1 Original line number Diff line number Diff line Loading @@ -241,7 +241,10 @@ public: virtual sp<IAfEffectModule> getEffectFromId_l(int id) const = 0; virtual sp<IAfEffectModule> getEffectFromType_l(const effect_uuid_t *type) const = 0; virtual std::vector<int> getEffectIds() const = 0; virtual bool setVolume_l(uint32_t *left, uint32_t *right, bool force = false) = 0; virtual bool setVolume_l(uint32_t* left, uint32_t* right, bool force = false) REQUIRES(audio_utils::ThreadBase_Mutex) EXCLUDES_EffectChain_Mutex = 0; virtual bool setVolume_ll(uint32_t* left, uint32_t* right, bool force = false) REQUIRES(audio_utils::ThreadBase_Mutex, audio_utils::EffectChain_Mutex) = 0; virtual void resetVolume_l() = 0; virtual void setDevices_l(const AudioDeviceTypeAddrVector &devices) = 0; virtual void setInputDevice_l(const AudioDeviceTypeAddr &device) = 0; Loading
services/audioflinger/Threads.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -5497,6 +5497,7 @@ PlaybackThread::mixer_state MixerThread::prepareTracks_l( if (masterMute) { masterVolume = 0; } // Delegate master volume control to effect in output mix effect chain if needed sp<IAfEffectChain> chain = getEffectChain_l(AUDIO_SESSION_OUTPUT_MIX); if (chain != 0) { Loading Loading @@ -5836,7 +5837,7 @@ PlaybackThread::mixer_state MixerThread::prepareTracks_l( mixedTracks++; // track->mainBuffer() != mSinkBuffer or mMixerBuffer means // track->mainBuffer() != mSinkBuffer and mMixerBuffer means // there is an effect chain connected to the track chain.clear(); if (track->mainBuffer() != mSinkBuffer && Loading