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

Commit ee8631cb authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "AudioPolicy: Add stereo spatialization support" into main

parents 9df7cb34 481bfe3a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ cc_library_shared {
    export_include_dirs: ["."],

    shared_libs: [
        "com.android.media.audio-aconfig-cc",
        "libaudiofoundation",
        "libaudiopolicycomponents",
        "libcutils",
+6 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@

#include <Serializer.h>
#include <android/media/audio/common/AudioPort.h>
#include <com_android_media_audio.h>
#include <cutils/bitops.h>
#include <cutils/properties.h>
#include <media/AudioParameter.h>
@@ -5970,7 +5971,11 @@ bool AudioPolicyManager::canBeSpatializedInt(const audio_attributes_t *attr,
    // some positional channel masks and PCM format

    if (config != nullptr && *config != AUDIO_CONFIG_INITIALIZER) {
        if (!audio_is_channel_mask_spatialized(config->channel_mask)) {
        const bool channel_mask_spatialized =
                com_android_media_audio_stereo_spatialization()
                ? audio_channel_mask_contains_stereo(config->channel_mask)
                : audio_is_channel_mask_spatialized(config->channel_mask);
        if (!channel_mask_spatialized) {
            return false;
        }
        if (!audio_is_linear_pcm(config->format)) {
+9 −1
Original line number Diff line number Diff line
@@ -394,7 +394,11 @@ status_t Spatializer::loadEngineConfiguration(sp<EffectHalInterface> effect) {
        return status;
    }
    for (const auto channelMask : channelMasks) {
        if (!audio_is_channel_mask_spatialized(channelMask)) {
        const bool channel_mask_spatialized =
                com_android_media_audio_stereo_spatialization()
                ? audio_channel_mask_contains_stereo(channelMask)
                : audio_is_channel_mask_spatialized(channelMask);
        if (!channel_mask_spatialized) {
            ALOGW("%s: ignoring channelMask:%#x", __func__, channelMask);
            continue;
        }
@@ -1239,6 +1243,10 @@ std::string Spatializer::toString(unsigned level) const {
    base::StringAppendF(&ss, "%sDisplayOrientation: %f\n", prefixSpace.c_str(),
                        mDisplayOrientation);

    // 4. Show flag or property state.
    base::StringAppendF(&ss, "%sStereo Spatialization: %s\n", prefixSpace.c_str(),
            com_android_media_audio_stereo_spatialization() ? "true" : "false");

    ss.append(prefixSpace + "CommandLog:\n");
    ss += mLocalLog.dumpToString((prefixSpace + " ").c_str(), mMaxLocalLogLine);