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

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

audio policy: fix eligibility condition for spatialization am: d332bc8b am: 7ecec55f

parents 5078c13e 7ecec55f
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -5930,22 +5930,26 @@ bool AudioPolicyManager::canBeSpatializedInt(const audio_attributes_t *attr,
        }
    }

    sp<IOProfile> profile =
            getSpatializerOutputProfile(config, devices);
    if (profile == nullptr) {
        return false;
    }

    // The caller can have the audio config criteria ignored by either passing a null ptr or
    // the AUDIO_CONFIG_INITIALIZER value.
    // If an audio config is specified, current policy is to only allow spatialization for
    // some positional channel masks.
    // some positional channel masks and PCM format

    if (config != nullptr && *config != AUDIO_CONFIG_INITIALIZER) {
        if (!audio_is_channel_mask_spatialized(config->channel_mask)) {
            return false;
        }
        if (!audio_is_linear_pcm(config->format)) {
            return false;
        }
    }

    sp<IOProfile> profile =
            getSpatializerOutputProfile(config, devices);
    if (profile == nullptr) {
        return false;
    }

    return true;
}