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

Commit dcb3383f authored by Eric Laurent's avatar Eric Laurent Committed by Automerger Merge Worker
Browse files

Merge "Use floating point volume in mixer for mute checking" into udc-dev am:...

Merge "Use floating point volume in mixer for mute checking" into udc-dev am: 20d86c24 am: 224c3be2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/23639388



Change-Id: Iec69f9581d2180f7b01b314777e531763092c09c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 6a5ba0b1 224c3be2
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -471,9 +471,9 @@ void AudioMixerBase::setParameter(int name, int target, int param, void *value)
                        &track->mVolume[param - VOLUME0],
                        &track->mPrevVolume[param - VOLUME0],
                        &track->mVolumeInc[param - VOLUME0])) {
                    ALOGV("setParameter(%s, VOLUME%d: %04x)",
                    ALOGV("setParameter(%s, VOLUME%d: %f)",
                          target == VOLUME ? "VOLUME" : "RAMP_VOLUME", param - VOLUME0,
                                    track->volume[param - VOLUME0]);
                          track->mVolume[param - VOLUME0]);
                    invalidate();
                }
            } else {
@@ -648,7 +648,7 @@ void AudioMixerBase::process__validate()

        if (t->volumeInc[0]|t->volumeInc[1]) {
            volumeRamp = true;
        } else if (!t->doesResample() && t->volumeRL == 0) {
        } else if (!t->doesResample() && t->isVolumeMuted()) {
            n |= NEEDS_MUTE;
        }
        t->needs = n;
@@ -748,7 +748,7 @@ void AudioMixerBase::process__validate()

        for (const int name : mEnabled) {
            const std::shared_ptr<TrackBase> &t = mTracks[name];
            if (!t->doesResample() && t->volumeRL == 0) {
            if (!t->doesResample() && t->isVolumeMuted()) {
                t->needs |= NEEDS_MUTE;
                t->hook = &TrackBase::track__nop;
            } else {
+10 −0
Original line number Diff line number Diff line
@@ -299,6 +299,16 @@ public:

        uint32_t       mInputFrameSize; // The track input frame size, used for tee buffer

        // consider volume muted only if all channel volume (floating point) is 0.f
        inline bool isVolumeMuted() const {
            for (const auto volume : mVolume) {
                if (volume != 0) {
                    return false;
                }
            }
            return true;
        }

      protected:

        // hooks