Loading services/audioflinger/Effects.cpp +12 −1 Original line number 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) { 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_r = (float)right / (1 << 24); 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 bool AudioFlinger::EffectChain::setVolume_l(uint32_t *left, uint32_t *right, bool force) { Loading services/audioflinger/Effects.h +3 −0 Original line number Diff line number Diff line Loading @@ -596,6 +596,9 @@ private: 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); mutable Mutex mLock; // mutex protecting effect list Loading services/mediametrics/MediaMetricsService.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -386,7 +386,7 @@ bool MediaMetricsService::expirations_l(const std::shared_ptr<const mediametrics break; } if (now > when && (now - when) <= mMaxRecordAgeNs) { break; // TODO: if we use BOOTTIME, should be monotonic. break; // Note SYSTEM_TIME_REALTIME may not be monotonic. } if (i >= mMaxRecordsExpiredAtOnce) { // this represents "one too many"; tell caller there are Loading services/mediametrics/TimeMachine.h +4 −4 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ private: template <typename T> status_t getValue(const std::string &property, T* value, int64_t time = 0) const { if (time == 0) time = systemTime(SYSTEM_TIME_BOOTTIME); if (time == 0) time = systemTime(SYSTEM_TIME_REALTIME); const auto tsptr = mPropertyMap.find(property); if (tsptr == mPropertyMap.end()) return BAD_VALUE; const auto& timeSequence = tsptr->second; Loading Loading @@ -122,7 +122,7 @@ private: template <typename T> void putValue(const std::string &property, T&& e, int64_t time = 0) { if (time == 0) time = systemTime(SYSTEM_TIME_BOOTTIME); if (time == 0) time = systemTime(SYSTEM_TIME_REALTIME); mLastModificationTime = time; if (mPropertyMap.size() >= kKeyMaxProperties && !mPropertyMap.count(property)) { Loading Loading @@ -340,7 +340,7 @@ public: /** * Individual property put. * * Put takes in a time (if none is provided then BOOTTIME is used). * Put takes in a time (if none is provided then SYSTEM_TIME_REALTIME is used). */ template <typename T> status_t put(const std::string &url, T &&e, int64_t time = 0) { Loading @@ -349,7 +349,7 @@ public: std::shared_ptr<KeyHistory> keyHistory = getKeyHistoryFromUrl(url, &key, &prop); if (keyHistory == nullptr) return BAD_VALUE; if (time == 0) time = systemTime(SYSTEM_TIME_BOOTTIME); if (time == 0) time = systemTime(SYSTEM_TIME_REALTIME); std::lock_guard lock(getLockForKey(key)); keyHistory->putValue(prop, std::forward<T>(e), time); return NO_ERROR; Loading Loading
services/audioflinger/Effects.cpp +12 −1 Original line number 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) { 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_r = (float)right / (1 << 24); 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 bool AudioFlinger::EffectChain::setVolume_l(uint32_t *left, uint32_t *right, bool force) { Loading
services/audioflinger/Effects.h +3 −0 Original line number Diff line number Diff line Loading @@ -596,6 +596,9 @@ private: 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); mutable Mutex mLock; // mutex protecting effect list Loading
services/mediametrics/MediaMetricsService.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -386,7 +386,7 @@ bool MediaMetricsService::expirations_l(const std::shared_ptr<const mediametrics break; } if (now > when && (now - when) <= mMaxRecordAgeNs) { break; // TODO: if we use BOOTTIME, should be monotonic. break; // Note SYSTEM_TIME_REALTIME may not be monotonic. } if (i >= mMaxRecordsExpiredAtOnce) { // this represents "one too many"; tell caller there are Loading
services/mediametrics/TimeMachine.h +4 −4 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ private: template <typename T> status_t getValue(const std::string &property, T* value, int64_t time = 0) const { if (time == 0) time = systemTime(SYSTEM_TIME_BOOTTIME); if (time == 0) time = systemTime(SYSTEM_TIME_REALTIME); const auto tsptr = mPropertyMap.find(property); if (tsptr == mPropertyMap.end()) return BAD_VALUE; const auto& timeSequence = tsptr->second; Loading Loading @@ -122,7 +122,7 @@ private: template <typename T> void putValue(const std::string &property, T&& e, int64_t time = 0) { if (time == 0) time = systemTime(SYSTEM_TIME_BOOTTIME); if (time == 0) time = systemTime(SYSTEM_TIME_REALTIME); mLastModificationTime = time; if (mPropertyMap.size() >= kKeyMaxProperties && !mPropertyMap.count(property)) { Loading Loading @@ -340,7 +340,7 @@ public: /** * Individual property put. * * Put takes in a time (if none is provided then BOOTTIME is used). * Put takes in a time (if none is provided then SYSTEM_TIME_REALTIME is used). */ template <typename T> status_t put(const std::string &url, T &&e, int64_t time = 0) { Loading @@ -349,7 +349,7 @@ public: std::shared_ptr<KeyHistory> keyHistory = getKeyHistoryFromUrl(url, &key, &prop); if (keyHistory == nullptr) return BAD_VALUE; if (time == 0) time = systemTime(SYSTEM_TIME_BOOTTIME); if (time == 0) time = systemTime(SYSTEM_TIME_REALTIME); std::lock_guard lock(getLockForKey(key)); keyHistory->putValue(prop, std::forward<T>(e), time); return NO_ERROR; Loading