Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +14 −10 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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( Loading services/audiopolicy/tests/resources/test_phone_apm_configuration.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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"/> Loading Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +14 −10 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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( Loading
services/audiopolicy/tests/resources/test_phone_apm_configuration.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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"/> Loading