Loading media/libaudiofoundation/AudioProfile.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -327,6 +327,24 @@ bool AudioProfileVector::hasDynamicRateFor(audio_format_t format) const 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) { Loading media/libaudiofoundation/include/media/AudioProfile.h +3 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,9 @@ public: bool hasDynamicProfile() const; bool hasDynamicRateFor(audio_format_t format) const; const SampleRateSet getSampleRatesFor(audio_format_t format) const; const ChannelMaskSet getChannelMasksFor(audio_format_t format) const; bool contains(const sp<AudioProfile>& profile, bool ignoreDynamicFlags = false) const; virtual void dump(std::string *dst, int spaces) const; Loading media/libaudiohal/impl/StreamHalAidl.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -167,9 +167,8 @@ status_t StreamHalAidl::getParameters(const String8& keys __unused, String8 *val ALOGD("%p %s::%s", this, getClassName().c_str(), __func__); TIME_CHECK(); values->clear(); if (!mStream) return NO_INIT; ALOGE("%s not implemented yet", __func__); return OK; // AIDL HAL doesn't support getParameters API. return INVALID_OPERATION; } status_t StreamHalAidl::getFrameSize(size_t *size) { Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +19 −9 Original line number Diff line number Diff line Loading @@ -7712,12 +7712,17 @@ void AudioPolicyManager::updateAudioProfiles(const sp<DeviceDescriptor>& devDesc ioHandle, String8(AudioParameter::keyStreamSupportedFormats)); ALOGV("%s: supported formats %d, %s", __FUNCTION__, ioHandle, reply.string()); AudioParameter repliedParameters(reply); FormatVector formats; if (repliedParameters.get( String8(AudioParameter::keyStreamSupportedFormats), reply) != NO_ERROR) { ALOGE("%s: failed to retrieve format, bailing out", __FUNCTION__); String8(AudioParameter::keyStreamSupportedFormats), reply) == NO_ERROR) { formats = formatsFromString(reply.string()); } else if (devDesc->hasValidAudioProfile()) { ALOGD("%s: using the device profiles", __func__); formats = devDesc->getAudioProfiles().getSupportedFormats(); } else { ALOGE("%s: failed to retrieve format, bailing out", __func__); return; } FormatVector formats = formatsFromString(reply.string()); mReportedFormatsMap[devDesc] = formats; if (device == AUDIO_DEVICE_OUT_HDMI || isDeviceOfModule(devDesc, AUDIO_HARDWARE_MODULE_ID_MSD)) { Loading @@ -7727,7 +7732,7 @@ void AudioPolicyManager::updateAudioProfiles(const sp<DeviceDescriptor>& devDesc } for (audio_format_t format : profiles.getSupportedFormats()) { ChannelMaskSet channelMasks; std::optional<ChannelMaskSet> channelMasks; SampleRateSet samplingRates; AudioParameter requestedParameters; requestedParameters.addInt(String8(AudioParameter::keyFormat), format); Loading @@ -7742,6 +7747,8 @@ void AudioPolicyManager::updateAudioProfiles(const sp<DeviceDescriptor>& devDesc if (repliedParameters.get( String8(AudioParameter::keyStreamSupportedSamplingRates), reply) == NO_ERROR) { samplingRates = samplingRatesFromString(reply.string()); } else { samplingRates = devDesc->getAudioProfiles().getSampleRatesFor(format); } } if (profiles.hasDynamicChannelsFor(format)) { Loading @@ -7753,14 +7760,17 @@ void AudioPolicyManager::updateAudioProfiles(const sp<DeviceDescriptor>& devDesc if (repliedParameters.get( String8(AudioParameter::keyStreamSupportedChannels), reply) == NO_ERROR) { channelMasks = channelMasksFromString(reply.string()); if (device == AUDIO_DEVICE_OUT_HDMI || isDeviceOfModule(devDesc, AUDIO_HARDWARE_MODULE_ID_MSD)) { modifySurroundChannelMasks(&channelMasks); } else { channelMasks = devDesc->getAudioProfiles().getChannelMasksFor(format); } if (channelMasks.has_value() && (device == AUDIO_DEVICE_OUT_HDMI || isDeviceOfModule(devDesc, AUDIO_HARDWARE_MODULE_ID_MSD))) { modifySurroundChannelMasks(&channelMasks.value()); } } addDynamicAudioProfileAndSort( profiles, new AudioProfile(format, channelMasks, samplingRates)); profiles, new AudioProfile( format, channelMasks.value_or(ChannelMaskSet()), samplingRates)); } } Loading Loading
media/libaudiofoundation/AudioProfile.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -327,6 +327,24 @@ bool AudioProfileVector::hasDynamicRateFor(audio_format_t format) const 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) { Loading
media/libaudiofoundation/include/media/AudioProfile.h +3 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,9 @@ public: bool hasDynamicProfile() const; bool hasDynamicRateFor(audio_format_t format) const; const SampleRateSet getSampleRatesFor(audio_format_t format) const; const ChannelMaskSet getChannelMasksFor(audio_format_t format) const; bool contains(const sp<AudioProfile>& profile, bool ignoreDynamicFlags = false) const; virtual void dump(std::string *dst, int spaces) const; Loading
media/libaudiohal/impl/StreamHalAidl.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -167,9 +167,8 @@ status_t StreamHalAidl::getParameters(const String8& keys __unused, String8 *val ALOGD("%p %s::%s", this, getClassName().c_str(), __func__); TIME_CHECK(); values->clear(); if (!mStream) return NO_INIT; ALOGE("%s not implemented yet", __func__); return OK; // AIDL HAL doesn't support getParameters API. return INVALID_OPERATION; } status_t StreamHalAidl::getFrameSize(size_t *size) { Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +19 −9 Original line number Diff line number Diff line Loading @@ -7712,12 +7712,17 @@ void AudioPolicyManager::updateAudioProfiles(const sp<DeviceDescriptor>& devDesc ioHandle, String8(AudioParameter::keyStreamSupportedFormats)); ALOGV("%s: supported formats %d, %s", __FUNCTION__, ioHandle, reply.string()); AudioParameter repliedParameters(reply); FormatVector formats; if (repliedParameters.get( String8(AudioParameter::keyStreamSupportedFormats), reply) != NO_ERROR) { ALOGE("%s: failed to retrieve format, bailing out", __FUNCTION__); String8(AudioParameter::keyStreamSupportedFormats), reply) == NO_ERROR) { formats = formatsFromString(reply.string()); } else if (devDesc->hasValidAudioProfile()) { ALOGD("%s: using the device profiles", __func__); formats = devDesc->getAudioProfiles().getSupportedFormats(); } else { ALOGE("%s: failed to retrieve format, bailing out", __func__); return; } FormatVector formats = formatsFromString(reply.string()); mReportedFormatsMap[devDesc] = formats; if (device == AUDIO_DEVICE_OUT_HDMI || isDeviceOfModule(devDesc, AUDIO_HARDWARE_MODULE_ID_MSD)) { Loading @@ -7727,7 +7732,7 @@ void AudioPolicyManager::updateAudioProfiles(const sp<DeviceDescriptor>& devDesc } for (audio_format_t format : profiles.getSupportedFormats()) { ChannelMaskSet channelMasks; std::optional<ChannelMaskSet> channelMasks; SampleRateSet samplingRates; AudioParameter requestedParameters; requestedParameters.addInt(String8(AudioParameter::keyFormat), format); Loading @@ -7742,6 +7747,8 @@ void AudioPolicyManager::updateAudioProfiles(const sp<DeviceDescriptor>& devDesc if (repliedParameters.get( String8(AudioParameter::keyStreamSupportedSamplingRates), reply) == NO_ERROR) { samplingRates = samplingRatesFromString(reply.string()); } else { samplingRates = devDesc->getAudioProfiles().getSampleRatesFor(format); } } if (profiles.hasDynamicChannelsFor(format)) { Loading @@ -7753,14 +7760,17 @@ void AudioPolicyManager::updateAudioProfiles(const sp<DeviceDescriptor>& devDesc if (repliedParameters.get( String8(AudioParameter::keyStreamSupportedChannels), reply) == NO_ERROR) { channelMasks = channelMasksFromString(reply.string()); if (device == AUDIO_DEVICE_OUT_HDMI || isDeviceOfModule(devDesc, AUDIO_HARDWARE_MODULE_ID_MSD)) { modifySurroundChannelMasks(&channelMasks); } else { channelMasks = devDesc->getAudioProfiles().getChannelMasksFor(format); } if (channelMasks.has_value() && (device == AUDIO_DEVICE_OUT_HDMI || isDeviceOfModule(devDesc, AUDIO_HARDWARE_MODULE_ID_MSD))) { modifySurroundChannelMasks(&channelMasks.value()); } } addDynamicAudioProfileAndSort( profiles, new AudioProfile(format, channelMasks, samplingRates)); profiles, new AudioProfile( format, channelMasks.value_or(ChannelMaskSet()), samplingRates)); } } Loading