Loading services/audiopolicy/service/Spatializer.cpp +9 −4 Original line number Diff line number Diff line Loading @@ -59,11 +59,13 @@ using namespace std::chrono_literals; if (!_tmp.ok()) return aidl_utils::binderStatusFromStatusT(_tmp.error()); \ std::move(_tmp.value()); }) audio_channel_mask_t getMaxChannelMask(std::vector<audio_channel_mask_t> masks) { static audio_channel_mask_t getMaxChannelMask( const std::vector<audio_channel_mask_t>& masks, size_t channelLimit = SIZE_MAX) { uint32_t maxCount = 0; audio_channel_mask_t maxMask = AUDIO_CHANNEL_NONE; for (auto mask : masks) { const size_t count = audio_channel_count_from_out_mask(mask); if (count > channelLimit) continue; // ignore masks greater than channelLimit if (count > maxCount) { maxMask = mask; maxCount = count; Loading Loading @@ -238,10 +240,13 @@ sp<Spatializer> Spatializer::create(SpatializerPolicyCallback *callback) { spatializer = new Spatializer(descriptors[0], callback); if (spatializer->loadEngineConfiguration(effect) != NO_ERROR) { spatializer.clear(); } ALOGW("%s loadEngine error: %d effect Id %" PRId64, __func__, status, effect ? effect->effectId() : 0); } else { spatializer->mLocalLog.log("%s with effect Id %" PRId64, __func__, effect ? effect->effectId() : 0); } } return spatializer; } Loading Loading @@ -387,7 +392,7 @@ audio_config_base_t Spatializer::getAudioInConfig() const { std::lock_guard lock(mLock); audio_config_base_t config = AUDIO_CONFIG_BASE_INITIALIZER; // For now use highest supported channel count config.channel_mask = getMaxChannelMask(mChannelMasks); config.channel_mask = getMaxChannelMask(mChannelMasks, FCC_LIMIT); return config; } Loading Loading
services/audiopolicy/service/Spatializer.cpp +9 −4 Original line number Diff line number Diff line Loading @@ -59,11 +59,13 @@ using namespace std::chrono_literals; if (!_tmp.ok()) return aidl_utils::binderStatusFromStatusT(_tmp.error()); \ std::move(_tmp.value()); }) audio_channel_mask_t getMaxChannelMask(std::vector<audio_channel_mask_t> masks) { static audio_channel_mask_t getMaxChannelMask( const std::vector<audio_channel_mask_t>& masks, size_t channelLimit = SIZE_MAX) { uint32_t maxCount = 0; audio_channel_mask_t maxMask = AUDIO_CHANNEL_NONE; for (auto mask : masks) { const size_t count = audio_channel_count_from_out_mask(mask); if (count > channelLimit) continue; // ignore masks greater than channelLimit if (count > maxCount) { maxMask = mask; maxCount = count; Loading Loading @@ -238,10 +240,13 @@ sp<Spatializer> Spatializer::create(SpatializerPolicyCallback *callback) { spatializer = new Spatializer(descriptors[0], callback); if (spatializer->loadEngineConfiguration(effect) != NO_ERROR) { spatializer.clear(); } ALOGW("%s loadEngine error: %d effect Id %" PRId64, __func__, status, effect ? effect->effectId() : 0); } else { spatializer->mLocalLog.log("%s with effect Id %" PRId64, __func__, effect ? effect->effectId() : 0); } } return spatializer; } Loading Loading @@ -387,7 +392,7 @@ audio_config_base_t Spatializer::getAudioInConfig() const { std::lock_guard lock(mLock); audio_config_base_t config = AUDIO_CONFIG_BASE_INITIALIZER; // For now use highest supported channel count config.channel_mask = getMaxChannelMask(mChannelMasks); config.channel_mask = getMaxChannelMask(mChannelMasks, FCC_LIMIT); return config; } Loading