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

Commit 3c8ef273 authored by Shunkai Yao's avatar Shunkai Yao
Browse files

Remove loudness enhancer stereo channel abort

Flag: EXEMPT bugfix
Bug: 383905737
Bug: 390015312
Test: Enable loudness enhancer effect with different channels
Test: atest android.media.audio.cts.LoudnessEnhancerTest
Test: atest VtsHalLoudnessEnhancerTargetTest
Change-Id: Iac8b2623a8eb1525768a207c79dbec934b2a561f
Merged-In: Iac8b2623a8eb1525768a207c79dbec934b2a561f
parent a660a45f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#include "EffectLoudnessEnhancer.h"

using aidl::android::hardware::audio::common::getChannelCount;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidLoudnessEnhancer;
using aidl::android::hardware::audio::effect::getEffectTypeUuidLoudnessEnhancer;
@@ -138,6 +139,11 @@ std::shared_ptr<EffectContext> LoudnessEnhancerImpl::createContext(
        LOG(DEBUG) << __func__ << " context already exist";
        return mContext;
    }
    if (2 < getChannelCount(common.input.base.channelMask)) {
        LOG(ERROR) << __func__
                   << " channelCount not supported: " << common.input.base.channelMask.toString();
        return nullptr;
    }

    mContext = std::make_shared<LoudnessEnhancerContext>(1 /* statusFmqDepth */, common);
    return mContext;
+0 −4
Original line number Diff line number Diff line
@@ -102,10 +102,6 @@ IEffect::Status LoudnessEnhancerContext::process(float* in, float* out, int samp
}

void LoudnessEnhancerContext::init_params() {
    int channelCount = ::aidl::android::hardware::audio::common::getChannelCount(
            mCommon.input.base.channelMask);
    LOG_ALWAYS_FATAL_IF(channelCount != 2, "channel count %d not supported", channelCount);

    mGain = LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB;
    float targetAmp = pow(10, mGain / 2000.0f);  // mB to linear amplification
    LOG(VERBOSE) << __func__ << "Target gain = " << mGain << "mB <=> factor = " << targetAmp;