Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b023299e authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6274646 from 40598a66 to rvc-release

Change-Id: I4b7c672bdbdb924f3fdeacba176cf3c9e2ea73c4
parents 6b09c110 40598a66
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -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);
@@ -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)
{
+3 −0
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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
+4 −4
Original line number Diff line number Diff line
@@ -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;
@@ -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)) {
@@ -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) {
@@ -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;