Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +5 −33 Original line number Diff line number Diff line Loading @@ -1504,8 +1504,7 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevices( *isSpatialized = false; if (mSpatializerOutput != nullptr && canBeSpatializedInt(attr, config, devices.toTypeAddrVector(), false /* allowCurrentOutputReconfig */)) { && canBeSpatializedInt(attr, config, devices.toTypeAddrVector())) { *isSpatialized = true; return mSpatializerOutput->mIoHandle; } Loading Loading @@ -5337,25 +5336,9 @@ sp<SourceClientDescriptor> AudioPolicyManager::getSourceForAttributesOnOutput( return source; } /* static */ bool AudioPolicyManager::isChannelMaskSpatialized(audio_channel_mask_t channels) { switch (channels) { case AUDIO_CHANNEL_OUT_5POINT1: case AUDIO_CHANNEL_OUT_5POINT1POINT2: case AUDIO_CHANNEL_OUT_5POINT1POINT4: case AUDIO_CHANNEL_OUT_7POINT1: case AUDIO_CHANNEL_OUT_7POINT1POINT2: case AUDIO_CHANNEL_OUT_7POINT1POINT4: return true; default: return false; } } bool AudioPolicyManager::canBeSpatializedInt(const audio_attributes_t *attr, const audio_config_t *config, const AudioDeviceTypeAddrVector &devices, bool allowCurrentOutputReconfig) const const AudioDeviceTypeAddrVector &devices) const { // The caller can have the audio attributes criteria ignored by either passing a null ptr or // the AUDIO_ATTRIBUTES_INITIALIZER value. Loading Loading @@ -5384,20 +5367,11 @@ bool AudioPolicyManager::canBeSpatializedInt(const audio_attributes_t *attr, // the AUDIO_CONFIG_INITIALIZER value. // If an audio config is specified, current policy is to only allow spatialization for // some positional channel masks. // If the spatializer output is already opened, only channel masks included in the // spatializer output mixer channel mask are allowed. if (config != nullptr && *config != AUDIO_CONFIG_INITIALIZER) { if (!isChannelMaskSpatialized(config->channel_mask)) { if (!audio_is_channel_mask_spatialized(config->channel_mask)) { return false; } if (!allowCurrentOutputReconfig && mSpatializerOutput != nullptr && mSpatializerOutput->mProfile == profile) { if ((config->channel_mask & mSpatializerOutput->mMixerChannelMask) != config->channel_mask) { return false; } } } return true; } Loading @@ -5413,8 +5387,7 @@ void AudioPolicyManager::checkVirtualizerClientRoutes() { audio_config_base_t clientConfig = client->config(); audio_config_t config = audio_config_initializer(&clientConfig); if (desc != mSpatializerOutput && canBeSpatializedInt(&attr, &config, devicesTypeAddress, false /* allowCurrentOutputReconfig */)) { && canBeSpatializedInt(&attr, &config, devicesTypeAddress)) { streamsToInvalidate.insert(client->stream()); } } Loading Loading @@ -5461,8 +5434,7 @@ status_t AudioPolicyManager::getSpatializerOutput(const audio_config_base_t *mix config = audio_config_initializer(mixerConfig); configPtr = &config; } if (!canBeSpatializedInt( attr, configPtr, devicesTypeAddress)) { if (!canBeSpatializedInt(attr, configPtr, devicesTypeAddress)) { ALOGV("%s provided attributes or mixer config cannot be spatialized", __func__); return BAD_VALUE; } Loading services/audiopolicy/managerdefault/AudioPolicyManager.h +1 −8 Original line number Diff line number Diff line Loading @@ -1093,22 +1093,15 @@ private: * @param attr audio attributes describing the playback use case * @param config audio configuration describing the audio format, channels, sample rate... * @param devices the sink audio device selected for playback * @param allowCurrentOutputReconfig if true, the result will be considering it is possible * to close and reopen an existing spatializer output stream to match the requested * criteria. If false, the criteria must be compatible with the opened sptializer * output. * @return true if spatialization is possible for this context, false otherwise. */ virtual bool canBeSpatializedInt(const audio_attributes_t *attr, const audio_config_t *config, const AudioDeviceTypeAddrVector &devices, bool allowCurrentOutputReconfig = true) const; const AudioDeviceTypeAddrVector &devices) const; sp<IOProfile> getSpatializerOutputProfile(const audio_config_t *config, const AudioDeviceTypeAddrVector &devices) const; static bool isChannelMaskSpatialized(audio_channel_mask_t channels); void checkVirtualizerClientRoutes(); /** Loading Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +5 −33 Original line number Diff line number Diff line Loading @@ -1504,8 +1504,7 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevices( *isSpatialized = false; if (mSpatializerOutput != nullptr && canBeSpatializedInt(attr, config, devices.toTypeAddrVector(), false /* allowCurrentOutputReconfig */)) { && canBeSpatializedInt(attr, config, devices.toTypeAddrVector())) { *isSpatialized = true; return mSpatializerOutput->mIoHandle; } Loading Loading @@ -5337,25 +5336,9 @@ sp<SourceClientDescriptor> AudioPolicyManager::getSourceForAttributesOnOutput( return source; } /* static */ bool AudioPolicyManager::isChannelMaskSpatialized(audio_channel_mask_t channels) { switch (channels) { case AUDIO_CHANNEL_OUT_5POINT1: case AUDIO_CHANNEL_OUT_5POINT1POINT2: case AUDIO_CHANNEL_OUT_5POINT1POINT4: case AUDIO_CHANNEL_OUT_7POINT1: case AUDIO_CHANNEL_OUT_7POINT1POINT2: case AUDIO_CHANNEL_OUT_7POINT1POINT4: return true; default: return false; } } bool AudioPolicyManager::canBeSpatializedInt(const audio_attributes_t *attr, const audio_config_t *config, const AudioDeviceTypeAddrVector &devices, bool allowCurrentOutputReconfig) const const AudioDeviceTypeAddrVector &devices) const { // The caller can have the audio attributes criteria ignored by either passing a null ptr or // the AUDIO_ATTRIBUTES_INITIALIZER value. Loading Loading @@ -5384,20 +5367,11 @@ bool AudioPolicyManager::canBeSpatializedInt(const audio_attributes_t *attr, // the AUDIO_CONFIG_INITIALIZER value. // If an audio config is specified, current policy is to only allow spatialization for // some positional channel masks. // If the spatializer output is already opened, only channel masks included in the // spatializer output mixer channel mask are allowed. if (config != nullptr && *config != AUDIO_CONFIG_INITIALIZER) { if (!isChannelMaskSpatialized(config->channel_mask)) { if (!audio_is_channel_mask_spatialized(config->channel_mask)) { return false; } if (!allowCurrentOutputReconfig && mSpatializerOutput != nullptr && mSpatializerOutput->mProfile == profile) { if ((config->channel_mask & mSpatializerOutput->mMixerChannelMask) != config->channel_mask) { return false; } } } return true; } Loading @@ -5413,8 +5387,7 @@ void AudioPolicyManager::checkVirtualizerClientRoutes() { audio_config_base_t clientConfig = client->config(); audio_config_t config = audio_config_initializer(&clientConfig); if (desc != mSpatializerOutput && canBeSpatializedInt(&attr, &config, devicesTypeAddress, false /* allowCurrentOutputReconfig */)) { && canBeSpatializedInt(&attr, &config, devicesTypeAddress)) { streamsToInvalidate.insert(client->stream()); } } Loading Loading @@ -5461,8 +5434,7 @@ status_t AudioPolicyManager::getSpatializerOutput(const audio_config_base_t *mix config = audio_config_initializer(mixerConfig); configPtr = &config; } if (!canBeSpatializedInt( attr, configPtr, devicesTypeAddress)) { if (!canBeSpatializedInt(attr, configPtr, devicesTypeAddress)) { ALOGV("%s provided attributes or mixer config cannot be spatialized", __func__); return BAD_VALUE; } Loading
services/audiopolicy/managerdefault/AudioPolicyManager.h +1 −8 Original line number Diff line number Diff line Loading @@ -1093,22 +1093,15 @@ private: * @param attr audio attributes describing the playback use case * @param config audio configuration describing the audio format, channels, sample rate... * @param devices the sink audio device selected for playback * @param allowCurrentOutputReconfig if true, the result will be considering it is possible * to close and reopen an existing spatializer output stream to match the requested * criteria. If false, the criteria must be compatible with the opened sptializer * output. * @return true if spatialization is possible for this context, false otherwise. */ virtual bool canBeSpatializedInt(const audio_attributes_t *attr, const audio_config_t *config, const AudioDeviceTypeAddrVector &devices, bool allowCurrentOutputReconfig = true) const; const AudioDeviceTypeAddrVector &devices) const; sp<IOProfile> getSpatializerOutputProfile(const audio_config_t *config, const AudioDeviceTypeAddrVector &devices) const; static bool isChannelMaskSpatialized(audio_channel_mask_t channels); void checkVirtualizerClientRoutes(); /** Loading