Loading services/audiopolicy/common/managerdefinitions/include/AudioPort.h +1 −6 Original line number Diff line number Diff line Loading @@ -84,12 +84,7 @@ public: bool hasDynamicAudioProfile() const { return mProfiles.hasDynamicProfile(); } // searches for an exact match status_t checkExactAudioProfile(uint32_t samplingRate, audio_channel_mask_t channelMask, audio_format_t format) const { return mProfiles.checkExactProfile(samplingRate, channelMask, format); } virtual status_t checkExactAudioProfile(const struct audio_port_config *config) const; // searches for a compatible match, currently implemented for input // parameters are input|output, returned value is the best match. Loading services/audiopolicy/common/managerdefinitions/src/AudioPort.cpp +21 −7 Original line number Diff line number Diff line Loading @@ -137,6 +137,26 @@ void AudioPort::importAudioPort(const sp<AudioPort>& port, bool force __unused) } } status_t AudioPort::checkExactAudioProfile(const struct audio_port_config *config) const { status_t status = NO_ERROR; auto config_mask = config->config_mask; if (config_mask & AUDIO_PORT_CONFIG_GAIN) { config_mask &= ~AUDIO_PORT_CONFIG_GAIN; status = checkGain(&config->gain, config->gain.index); if (status != NO_ERROR) { return status; } } if (config_mask != 0) { // TODO should we check sample_rate / channel_mask / format separately? status = mProfiles.checkExactProfile(config->sample_rate, config->channel_mask, config->format); } return status; } void AudioPort::pickSamplingRate(uint32_t &pickedRate,const SampleRateVector &samplingRates) const { pickedRate = 0; Loading Loading @@ -388,9 +408,7 @@ status_t AudioPortConfig::applyAudioPortConfig(const struct audio_port_config *c status = NO_INIT; goto exit; } status = audioport->checkExactAudioProfile(config->sample_rate, config->channel_mask, config->format); status = audioport->checkExactAudioProfile(config); if (status != NO_ERROR) { goto exit; } Loading @@ -404,10 +422,6 @@ status_t AudioPortConfig::applyAudioPortConfig(const struct audio_port_config *c mFormat = config->format; } if (config->config_mask & AUDIO_PORT_CONFIG_GAIN) { status = audioport->checkGain(&config->gain, config->gain.index); if (status != NO_ERROR) { goto exit; } mGain = config->gain; } Loading services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,13 @@ bool IOProfile::isCompatibleProfile(audio_devices_t device, return false; } } else { if (checkExactAudioProfile(samplingRate, channelMask, format) != NO_ERROR) { const struct audio_port_config config = { .config_mask = AUDIO_PORT_CONFIG_ALL & ~AUDIO_PORT_CONFIG_GAIN, .sample_rate = samplingRate, .channel_mask = channelMask, .format = format, }; if (checkExactAudioProfile(&config) != NO_ERROR) { return false; } } Loading Loading
services/audiopolicy/common/managerdefinitions/include/AudioPort.h +1 −6 Original line number Diff line number Diff line Loading @@ -84,12 +84,7 @@ public: bool hasDynamicAudioProfile() const { return mProfiles.hasDynamicProfile(); } // searches for an exact match status_t checkExactAudioProfile(uint32_t samplingRate, audio_channel_mask_t channelMask, audio_format_t format) const { return mProfiles.checkExactProfile(samplingRate, channelMask, format); } virtual status_t checkExactAudioProfile(const struct audio_port_config *config) const; // searches for a compatible match, currently implemented for input // parameters are input|output, returned value is the best match. Loading
services/audiopolicy/common/managerdefinitions/src/AudioPort.cpp +21 −7 Original line number Diff line number Diff line Loading @@ -137,6 +137,26 @@ void AudioPort::importAudioPort(const sp<AudioPort>& port, bool force __unused) } } status_t AudioPort::checkExactAudioProfile(const struct audio_port_config *config) const { status_t status = NO_ERROR; auto config_mask = config->config_mask; if (config_mask & AUDIO_PORT_CONFIG_GAIN) { config_mask &= ~AUDIO_PORT_CONFIG_GAIN; status = checkGain(&config->gain, config->gain.index); if (status != NO_ERROR) { return status; } } if (config_mask != 0) { // TODO should we check sample_rate / channel_mask / format separately? status = mProfiles.checkExactProfile(config->sample_rate, config->channel_mask, config->format); } return status; } void AudioPort::pickSamplingRate(uint32_t &pickedRate,const SampleRateVector &samplingRates) const { pickedRate = 0; Loading Loading @@ -388,9 +408,7 @@ status_t AudioPortConfig::applyAudioPortConfig(const struct audio_port_config *c status = NO_INIT; goto exit; } status = audioport->checkExactAudioProfile(config->sample_rate, config->channel_mask, config->format); status = audioport->checkExactAudioProfile(config); if (status != NO_ERROR) { goto exit; } Loading @@ -404,10 +422,6 @@ status_t AudioPortConfig::applyAudioPortConfig(const struct audio_port_config *c mFormat = config->format; } if (config->config_mask & AUDIO_PORT_CONFIG_GAIN) { status = audioport->checkGain(&config->gain, config->gain.index); if (status != NO_ERROR) { goto exit; } mGain = config->gain; } Loading
services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,13 @@ bool IOProfile::isCompatibleProfile(audio_devices_t device, return false; } } else { if (checkExactAudioProfile(samplingRate, channelMask, format) != NO_ERROR) { const struct audio_port_config config = { .config_mask = AUDIO_PORT_CONFIG_ALL & ~AUDIO_PORT_CONFIG_GAIN, .sample_rate = samplingRate, .channel_mask = channelMask, .format = format, }; if (checkExactAudioProfile(&config) != NO_ERROR) { return false; } } Loading