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

Commit bdb6d044 authored by Andy Hung's avatar Andy Hung Committed by Automerger Merge Worker
Browse files

Merge "Spatializer: Respect FCC_LIMIT for input masks" into tm-qpr-dev am:...

Merge "Spatializer: Respect FCC_LIMIT for input masks" into tm-qpr-dev am: 821a8176 am: 956d5c80

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



Change-Id: I29cfa0531a36a2bfe83897eb408133e523b1bd66
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents cfab1efa 956d5c80
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -59,11 +59,13 @@ using namespace std::chrono_literals;
       if (!_tmp.ok()) return aidl_utils::binderStatusFromStatusT(_tmp.error()); \
       std::move(_tmp.value()); })

audio_channel_mask_t getMaxChannelMask(std::vector<audio_channel_mask_t> masks) {
static audio_channel_mask_t getMaxChannelMask(
        const std::vector<audio_channel_mask_t>& masks, size_t channelLimit = SIZE_MAX) {
    uint32_t maxCount = 0;
    audio_channel_mask_t maxMask = AUDIO_CHANNEL_NONE;
    for (auto mask : masks) {
        const size_t count = audio_channel_count_from_out_mask(mask);
        if (count > channelLimit) continue;  // ignore masks greater than channelLimit
        if (count > maxCount) {
            maxMask = mask;
            maxCount = count;
@@ -238,10 +240,13 @@ sp<Spatializer> Spatializer::create(SpatializerPolicyCallback *callback) {
        spatializer = new Spatializer(descriptors[0], callback);
        if (spatializer->loadEngineConfiguration(effect) != NO_ERROR) {
            spatializer.clear();
        }
            ALOGW("%s loadEngine error: %d  effect Id %" PRId64,
                    __func__, status, effect ? effect->effectId() : 0);
        } else {
            spatializer->mLocalLog.log("%s with effect Id %" PRId64, __func__,
                                       effect ? effect->effectId() : 0);
        }
    }

    return spatializer;
}
@@ -387,7 +392,7 @@ audio_config_base_t Spatializer::getAudioInConfig() const {
    std::lock_guard lock(mLock);
    audio_config_base_t config = AUDIO_CONFIG_BASE_INITIALIZER;
    // For now use highest supported channel count
    config.channel_mask = getMaxChannelMask(mChannelMasks);
    config.channel_mask = getMaxChannelMask(mChannelMasks, FCC_LIMIT);
    return config;
}