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

Commit 9aee54d4 authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Add limiter for mono blend"

parents 19bd5498 03c48d5a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -416,7 +416,7 @@ void FastMixer::onWork()
        }

        if (mMasterMono.load()) {  // memory_order_seq_cst
            mono_blend(mMixerBuffer, mMixerBufferFormat, Format_channelCount(mFormat), frameCount);
            mono_blend(mMixerBuffer, mMixerBufferFormat, Format_channelCount(mFormat), frameCount, true /*limit*/);
        }
        // prepare the buffer used to write to sink
        void *buffer = mSinkBuffer != NULL ? mSinkBuffer : mMixerBuffer;
+4 −3
Original line number Diff line number Diff line
@@ -2917,8 +2917,8 @@ bool AudioFlinger::PlaybackThread::threadLoop()
                // 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);
                    mono_blend(mMixerBuffer, mMixerBufferFormat, mChannelCount, mNormalFrameCount,
                               true /*limit*/);
                }

                memcpy_by_audio_format(buffer, format, mMixerBuffer, mMixerBufferFormat,
@@ -2958,7 +2958,8 @@ bool AudioFlinger::PlaybackThread::threadLoop()
            //ALOGV("writing effect buffer to sink buffer format %#x", mFormat);

            if (requireMonoBlend()) {
                mono_blend(mEffectBuffer, mEffectBufferFormat, mChannelCount, mNormalFrameCount);
                mono_blend(mEffectBuffer, mEffectBufferFormat, mChannelCount, mNormalFrameCount,
                           true /*limit*/);
            }

            memcpy_by_audio_format(mSinkBuffer, mFormat, mEffectBuffer, mEffectBufferFormat,
+2 −0
Original line number Diff line number Diff line
@@ -927,6 +927,8 @@ protected:
                               }
                           }
                // the FastMixer performs mono blend if it exists.
                // Blending with limiter is not idempotent,
                // and blending without limiter is idempotent but inefficient to do twice.
    virtual     bool       requireMonoBlend() { return mMasterMono.load() && !hasFastMixer(); }
};