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

Commit 8fcfdc0d authored by David Li's avatar David Li Committed by Automerger Merge Worker
Browse files

Merge "AudioFlinger: avoid doing balance before downmixing" into tm-d1-dev am:...

Merge "AudioFlinger: avoid doing balance before downmixing" into tm-d1-dev am: 8edaa192 am: 079a0796 am: 965e9181

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



Change-Id: I13e62984fe48bed6a5c0f12af6131d671bf826b1
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b7000217 965e9181
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -3967,20 +3967,25 @@ bool AudioFlinger::PlaybackThread::threadLoop()
                void *buffer = mEffectBufferValid ? mEffectBuffer : mSinkBuffer;
                audio_format_t format = mEffectBufferValid ? mEffectBufferFormat : mFormat;

                // Apply mono blending and balancing if the effect buffer is not valid. Otherwise,
                // do these processes after effects are applied.
                if (!mEffectBufferValid) {
                    // mono blend occurs for mixer threads only (not direct or offloaded)
                    // and is handled here if we're going directly to the sink.
                if (requireMonoBlend() && !mEffectBufferValid) {
                    mono_blend(mMixerBuffer, mMixerBufferFormat, mChannelCount, mNormalFrameCount,
                               true /*limit*/);
                    if (requireMonoBlend()) {
                        mono_blend(mMixerBuffer, mMixerBufferFormat, mChannelCount,
                                mNormalFrameCount, true /*limit*/);
                    }

                    if (!hasFastMixer()) {
                        // Balance must take effect after mono conversion.
                        // We do it here if there is no FastMixer.
                    // mBalance detects zero balance within the class for speed (not needed here).
                        // mBalance detects zero balance within the class for speed
                        // (not needed here).
                        mBalance.setBalance(mMasterBalance.load());
                        mBalance.process((float *)mMixerBuffer, mNormalFrameCount);
                    }
                }

                memcpy_by_audio_format(buffer, format, mMixerBuffer, mMixerBufferFormat,
                        mNormalFrameCount * (mixerChannelCount + mHapticChannelCount));