Loading services/audioflinger/Effects.cpp +12 −1 Original line number Original line Diff line number Diff line Loading @@ -1395,7 +1395,11 @@ status_t AudioFlinger::EffectModule::setVolume(uint32_t *left, uint32_t *right, void AudioFlinger::EffectChain::setVolumeForOutput_l(uint32_t left, uint32_t right) void AudioFlinger::EffectChain::setVolumeForOutput_l(uint32_t left, uint32_t right) { { if (mEffectCallback->isOffloadOrDirect() && !isNonOffloadableEnabled_l()) { // for offload or direct thread, if the effect chain has non-offloadable // effect and any effect module within the chain has volume control, then // volume control is delegated to effect, otherwise, set volume to hal. if (mEffectCallback->isOffloadOrDirect() && !(isNonOffloadableEnabled_l() && hasVolumeControlEnabled_l())) { float vol_l = (float)left / (1 << 24); float vol_l = (float)left / (1 << 24); float vol_r = (float)right / (1 << 24); float vol_r = (float)right / (1 << 24); mEffectCallback->setVolumeForOutput(vol_l, vol_r); mEffectCallback->setVolumeForOutput(vol_l, vol_r); Loading Loading @@ -2296,6 +2300,13 @@ void AudioFlinger::EffectChain::setAudioSource_l(audio_source_t source) } } } } bool AudioFlinger::EffectChain::hasVolumeControlEnabled_l() const { for (const auto &effect : mEffects) { if (effect->isVolumeControlEnabled()) return true; } return false; } // setVolume_l() must be called with ThreadBase::mLock or EffectChain::mLock held // setVolume_l() must be called with ThreadBase::mLock or EffectChain::mLock held bool AudioFlinger::EffectChain::setVolume_l(uint32_t *left, uint32_t *right, bool force) bool AudioFlinger::EffectChain::setVolume_l(uint32_t *left, uint32_t *right, bool force) { { Loading services/audioflinger/Effects.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -596,6 +596,9 @@ private: void setThread(const sp<ThreadBase>& thread); void setThread(const sp<ThreadBase>& thread); // true if any effect module within the chain has volume control bool hasVolumeControlEnabled_l() const; void setVolumeForOutput_l(uint32_t left, uint32_t right); void setVolumeForOutput_l(uint32_t left, uint32_t right); mutable Mutex mLock; // mutex protecting effect list mutable Mutex mLock; // mutex protecting effect list Loading Loading
services/audioflinger/Effects.cpp +12 −1 Original line number Original line Diff line number Diff line Loading @@ -1395,7 +1395,11 @@ status_t AudioFlinger::EffectModule::setVolume(uint32_t *left, uint32_t *right, void AudioFlinger::EffectChain::setVolumeForOutput_l(uint32_t left, uint32_t right) void AudioFlinger::EffectChain::setVolumeForOutput_l(uint32_t left, uint32_t right) { { if (mEffectCallback->isOffloadOrDirect() && !isNonOffloadableEnabled_l()) { // for offload or direct thread, if the effect chain has non-offloadable // effect and any effect module within the chain has volume control, then // volume control is delegated to effect, otherwise, set volume to hal. if (mEffectCallback->isOffloadOrDirect() && !(isNonOffloadableEnabled_l() && hasVolumeControlEnabled_l())) { float vol_l = (float)left / (1 << 24); float vol_l = (float)left / (1 << 24); float vol_r = (float)right / (1 << 24); float vol_r = (float)right / (1 << 24); mEffectCallback->setVolumeForOutput(vol_l, vol_r); mEffectCallback->setVolumeForOutput(vol_l, vol_r); Loading Loading @@ -2296,6 +2300,13 @@ void AudioFlinger::EffectChain::setAudioSource_l(audio_source_t source) } } } } bool AudioFlinger::EffectChain::hasVolumeControlEnabled_l() const { for (const auto &effect : mEffects) { if (effect->isVolumeControlEnabled()) return true; } return false; } // setVolume_l() must be called with ThreadBase::mLock or EffectChain::mLock held // setVolume_l() must be called with ThreadBase::mLock or EffectChain::mLock held bool AudioFlinger::EffectChain::setVolume_l(uint32_t *left, uint32_t *right, bool force) bool AudioFlinger::EffectChain::setVolume_l(uint32_t *left, uint32_t *right, bool force) { { Loading
services/audioflinger/Effects.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -596,6 +596,9 @@ private: void setThread(const sp<ThreadBase>& thread); void setThread(const sp<ThreadBase>& thread); // true if any effect module within the chain has volume control bool hasVolumeControlEnabled_l() const; void setVolumeForOutput_l(uint32_t left, uint32_t right); void setVolumeForOutput_l(uint32_t left, uint32_t right); mutable Mutex mLock; // mutex protecting effect list mutable Mutex mLock; // mutex protecting effect list Loading