APM: use the device profile to update dynamic profiles.
In AIDL HAL, getParameters API is no longer supported. The profiles of
dynamic mix port will be determined by the connected device, which can
be known by calling getAudioPort API. In APM, use the device profiles
to update dynamic profiles when calling getParameters fails.
Bug: 277785275
Test: atest audiopolicy_tests
Test: manually with AIDL HAL
Change-Id: I99455c76267368c19b5be8e1667a10de84e3cedd
diff --git a/media/libaudiofoundation/AudioProfile.cpp b/media/libaudiofoundation/AudioProfile.cpp
index 2170cd8..999e263 100644
--- a/media/libaudiofoundation/AudioProfile.cpp
+++ b/media/libaudiofoundation/AudioProfile.cpp
@@ -327,6 +327,24 @@
return false;
}
+const SampleRateSet AudioProfileVector::getSampleRatesFor(audio_format_t format) const {
+ for (const auto& profile : *this) {
+ if (profile->getFormat() == format) {
+ return profile->getSampleRates();
+ }
+ }
+ return {};
+}
+
+const ChannelMaskSet AudioProfileVector::getChannelMasksFor(audio_format_t format) const {
+ for (const auto& profile : *this) {
+ if (profile->getFormat() == format) {
+ return profile->getChannels();
+ }
+ }
+ return {};
+}
+
bool AudioProfileVector::contains(const sp<AudioProfile>& profile, bool ignoreDynamicFlags) const
{
for (const auto& audioProfile : *this) {