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

Commit 88e5f815 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "audiopolicy: return appropriate profile from searchCompatibleProfileHwModules" into main

parents 643573f3 11c14835
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -1139,7 +1139,9 @@ sp<IOProfile> AudioPolicyManager::searchCompatibleProfileHwModules (
                                        audio_channel_mask_t channelMask,
                                        audio_output_flags_t flags,
                                        bool directOnly) {
    sp<IOProfile> profile;
    sp<IOProfile> directOnlyProfile = nullptr;
    sp<IOProfile> compressOffloadProfile = nullptr;
    sp<IOProfile> profile = nullptr;
    for (const auto& hwModule : hwModules) {
        for (const auto& curProfile : hwModule->getOutputProfiles()) {
             if (curProfile->getCompatibilityScore(devices,
@@ -1161,19 +1163,21 @@ sp<IOProfile> AudioPolicyManager::searchCompatibleProfileHwModules (
                return curProfile;
             }

             // when searching for direct outputs, if several profiles are compatible, give priority
             // to one with offload capability
             if (profile != 0 &&
                 ((curProfile->getFlags() & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) == 0)) {
                continue;
             }
             profile = curProfile;
             if ((profile->getFlags() & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != 0) {
                 break;
             if ((flags == AUDIO_OUTPUT_FLAG_DIRECT) &&
                 curProfile->getFlags() == AUDIO_OUTPUT_FLAG_DIRECT) {
                 directOnlyProfile = curProfile;
             }

             if ((curProfile->getFlags() & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != 0) {
                 compressOffloadProfile = curProfile;
             }
        }
    return profile;
    }

    return directOnlyProfile ? directOnlyProfile
                            : (compressOffloadProfile ? compressOffloadProfile : profile);

}

sp<IOProfile> AudioPolicyManager::getSpatializerOutputProfile(
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@
                </mixPort>
                <mixPort name="compressed_offload" role="source"
                         flags="AUDIO_OUTPUT_FLAG_DIRECT AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD AUDIO_OUTPUT_FLAG_NON_BLOCKING AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD">
                    <profile name="" format="AUDIO_FORMAT_PCM_FLOAT"
                             samplingRates="48000 96000 384000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                    <profile name="" format="AUDIO_FORMAT_MP3"
                             samplingRates="8000 16000 24000 32000 44100 48000 96000"
                             channelMasks="AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO"/>