Loading media/libaudioclient/AidlConversion.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -1504,6 +1504,8 @@ ConversionResult<audio_output_flags_t> aidl2legacy_AudioOutputFlags_audio_output return AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD; case AudioOutputFlags::ULTRASOUND: return AUDIO_OUTPUT_FLAG_ULTRASOUND; case AudioOutputFlags::SPATIALIZER: return AUDIO_OUTPUT_FLAG_SPATIALIZER; } return unexpected(BAD_VALUE); } Loading Loading @@ -1547,6 +1549,8 @@ ConversionResult<AudioOutputFlags> legacy2aidl_audio_output_flags_t_AudioOutputF return AudioOutputFlags::GAPLESS_OFFLOAD; case AUDIO_OUTPUT_FLAG_ULTRASOUND: return AudioOutputFlags::ULTRASOUND; case AUDIO_OUTPUT_FLAG_SPATIALIZER: return AudioOutputFlags::SPATIALIZER; } return unexpected(BAD_VALUE); } Loading media/libaudiohal/impl/DeviceHalHidl.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -205,6 +205,16 @@ status_t DeviceHalHidl::openOutputStream( status != OK) { return status; } #if !(MAJOR_VERSION == 7 && MINOR_VERSION == 1) //TODO: b/193496180 use spatializer flag at audio HAL when available if ((flags & AUDIO_OUTPUT_FLAG_SPATIALIZER) != 0) { flags = (audio_output_flags_t)(flags & ~AUDIO_OUTPUT_FLAG_SPATIALIZER); flags = (audio_output_flags_t) (flags | AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_DEEP_BUFFER); } #endif CoreUtils::AudioOutputFlags hidlFlags; if (status_t status = CoreUtils::audioOutputFlagsFromHal(flags, &hidlFlags); status != OK) { return status; Loading services/audioflinger/AudioFlinger.cpp +13 −12 Original line number Diff line number Diff line Loading @@ -2590,7 +2590,7 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openOutput_l(audio_module_handle_t mo { AudioHwDevice *outHwDev = findSuitableHwDev_l(module, deviceType); if (outHwDev == NULL) { return 0; return nullptr; } if (*output == AUDIO_IO_HANDLE_NONE) { Loading @@ -2599,8 +2599,16 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openOutput_l(audio_module_handle_t mo // Audio Policy does not currently request a specific output handle. // If this is ever needed, see openInput_l() for example code. ALOGE("openOutput_l requested output handle %d is not AUDIO_IO_HANDLE_NONE", *output); return 0; return nullptr; } #ifndef MULTICHANNEL_EFFECT_CHAIN if (flags & AUDIO_OUTPUT_FLAG_SPATIALIZER) { ALOGE("openOutput_l() cannot create spatializer thread " "without #define MULTICHANNEL_EFFECT_CHAIN"); return nullptr; } #endif mHardwareStatus = AUDIO_HW_OUTPUT_OPEN; Loading Loading @@ -2646,18 +2654,11 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openOutput_l(audio_module_handle_t mo return thread; } else { sp<PlaybackThread> thread; //TODO: b/193496180 use spatializer flag at audio HAL when available if (flags == (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_DEEP_BUFFER)) { #ifdef MULTICHANNEL_EFFECT_CHAIN if (flags & AUDIO_OUTPUT_FLAG_SPATIALIZER) { thread = new SpatializerThread(this, outputStream, *output, mSystemReady, mixerConfig); ALOGD("openOutput_l() created spatializer output: ID %d thread %p", ALOGV("openOutput_l() created spatializer output: ID %d thread %p", *output, thread.get()); #else ALOGE("openOutput_l() cannot create spatializer thread " "without #define MULTICHANNEL_EFFECT_CHAIN"); #endif } else if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { thread = new OffloadThread(this, outputStream, *output, mSystemReady); ALOGV("openOutput_l() created offload output: ID %d thread %p", Loading @@ -2683,7 +2684,7 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openOutput_l(audio_module_handle_t mo } } return 0; return nullptr; } status_t AudioFlinger::openOutput(const media::OpenOutputRequest& request, Loading services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h +0 −14 Original line number Diff line number Diff line Loading @@ -202,20 +202,6 @@ public: {AUDIO_FORMAT_AC4, {}}}; } //TODO: b/193496180 use spatializer flag at audio HAL when available // until then, use DEEP_BUFFER+FAST flag combo to indicate the spatializer output profile void convertSpatializerFlag() { for (const auto& hwModule : mHwModules) { for (const auto& curProfile : hwModule->getOutputProfiles()) { if (curProfile->getFlags() == (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_DEEP_BUFFER)) { curProfile->setFlags(AUDIO_OUTPUT_FLAG_SPATIALIZER); } } } } private: static const constexpr char* const kDefaultEngineLibraryNameSuffix = "default"; Loading services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp +6 −10 Original line number Diff line number Diff line Loading @@ -565,16 +565,12 @@ status_t SwAudioOutputDescriptor::open(const audio_config_t *halConfig, mFlags = (audio_output_flags_t)(mFlags | flags); //TODO: b/193496180 use spatializer flag at audio HAL when available audio_output_flags_t halFlags = mFlags; if ((mFlags & AUDIO_OUTPUT_FLAG_SPATIALIZER) != 0) { halFlags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_DEEP_BUFFER); // If no mixer config is specified for a spatializer output, default to 5.1 for proper // configuration of the final downmixer or spatializer if (mixerConfig == nullptr) { if ((mFlags & AUDIO_OUTPUT_FLAG_SPATIALIZER) != 0 && mixerConfig == nullptr) { lMixerConfig.channel_mask = AUDIO_CHANNEL_OUT_5POINT1; } } ALOGV("opening output for device %s profile %p name %s", mDevices.toString().c_str(), mProfile.get(), mProfile->getName().c_str()); Loading @@ -585,7 +581,7 @@ status_t SwAudioOutputDescriptor::open(const audio_config_t *halConfig, &lMixerConfig, device, &mLatency, halFlags); mFlags); if (status == NO_ERROR) { LOG_ALWAYS_FATAL_IF(*output == AUDIO_IO_HANDLE_NONE, Loading Loading
media/libaudioclient/AidlConversion.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -1504,6 +1504,8 @@ ConversionResult<audio_output_flags_t> aidl2legacy_AudioOutputFlags_audio_output return AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD; case AudioOutputFlags::ULTRASOUND: return AUDIO_OUTPUT_FLAG_ULTRASOUND; case AudioOutputFlags::SPATIALIZER: return AUDIO_OUTPUT_FLAG_SPATIALIZER; } return unexpected(BAD_VALUE); } Loading Loading @@ -1547,6 +1549,8 @@ ConversionResult<AudioOutputFlags> legacy2aidl_audio_output_flags_t_AudioOutputF return AudioOutputFlags::GAPLESS_OFFLOAD; case AUDIO_OUTPUT_FLAG_ULTRASOUND: return AudioOutputFlags::ULTRASOUND; case AUDIO_OUTPUT_FLAG_SPATIALIZER: return AudioOutputFlags::SPATIALIZER; } return unexpected(BAD_VALUE); } Loading
media/libaudiohal/impl/DeviceHalHidl.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -205,6 +205,16 @@ status_t DeviceHalHidl::openOutputStream( status != OK) { return status; } #if !(MAJOR_VERSION == 7 && MINOR_VERSION == 1) //TODO: b/193496180 use spatializer flag at audio HAL when available if ((flags & AUDIO_OUTPUT_FLAG_SPATIALIZER) != 0) { flags = (audio_output_flags_t)(flags & ~AUDIO_OUTPUT_FLAG_SPATIALIZER); flags = (audio_output_flags_t) (flags | AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_DEEP_BUFFER); } #endif CoreUtils::AudioOutputFlags hidlFlags; if (status_t status = CoreUtils::audioOutputFlagsFromHal(flags, &hidlFlags); status != OK) { return status; Loading
services/audioflinger/AudioFlinger.cpp +13 −12 Original line number Diff line number Diff line Loading @@ -2590,7 +2590,7 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openOutput_l(audio_module_handle_t mo { AudioHwDevice *outHwDev = findSuitableHwDev_l(module, deviceType); if (outHwDev == NULL) { return 0; return nullptr; } if (*output == AUDIO_IO_HANDLE_NONE) { Loading @@ -2599,8 +2599,16 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openOutput_l(audio_module_handle_t mo // Audio Policy does not currently request a specific output handle. // If this is ever needed, see openInput_l() for example code. ALOGE("openOutput_l requested output handle %d is not AUDIO_IO_HANDLE_NONE", *output); return 0; return nullptr; } #ifndef MULTICHANNEL_EFFECT_CHAIN if (flags & AUDIO_OUTPUT_FLAG_SPATIALIZER) { ALOGE("openOutput_l() cannot create spatializer thread " "without #define MULTICHANNEL_EFFECT_CHAIN"); return nullptr; } #endif mHardwareStatus = AUDIO_HW_OUTPUT_OPEN; Loading Loading @@ -2646,18 +2654,11 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openOutput_l(audio_module_handle_t mo return thread; } else { sp<PlaybackThread> thread; //TODO: b/193496180 use spatializer flag at audio HAL when available if (flags == (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_DEEP_BUFFER)) { #ifdef MULTICHANNEL_EFFECT_CHAIN if (flags & AUDIO_OUTPUT_FLAG_SPATIALIZER) { thread = new SpatializerThread(this, outputStream, *output, mSystemReady, mixerConfig); ALOGD("openOutput_l() created spatializer output: ID %d thread %p", ALOGV("openOutput_l() created spatializer output: ID %d thread %p", *output, thread.get()); #else ALOGE("openOutput_l() cannot create spatializer thread " "without #define MULTICHANNEL_EFFECT_CHAIN"); #endif } else if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { thread = new OffloadThread(this, outputStream, *output, mSystemReady); ALOGV("openOutput_l() created offload output: ID %d thread %p", Loading @@ -2683,7 +2684,7 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openOutput_l(audio_module_handle_t mo } } return 0; return nullptr; } status_t AudioFlinger::openOutput(const media::OpenOutputRequest& request, Loading
services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h +0 −14 Original line number Diff line number Diff line Loading @@ -202,20 +202,6 @@ public: {AUDIO_FORMAT_AC4, {}}}; } //TODO: b/193496180 use spatializer flag at audio HAL when available // until then, use DEEP_BUFFER+FAST flag combo to indicate the spatializer output profile void convertSpatializerFlag() { for (const auto& hwModule : mHwModules) { for (const auto& curProfile : hwModule->getOutputProfiles()) { if (curProfile->getFlags() == (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_DEEP_BUFFER)) { curProfile->setFlags(AUDIO_OUTPUT_FLAG_SPATIALIZER); } } } } private: static const constexpr char* const kDefaultEngineLibraryNameSuffix = "default"; Loading
services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp +6 −10 Original line number Diff line number Diff line Loading @@ -565,16 +565,12 @@ status_t SwAudioOutputDescriptor::open(const audio_config_t *halConfig, mFlags = (audio_output_flags_t)(mFlags | flags); //TODO: b/193496180 use spatializer flag at audio HAL when available audio_output_flags_t halFlags = mFlags; if ((mFlags & AUDIO_OUTPUT_FLAG_SPATIALIZER) != 0) { halFlags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_DEEP_BUFFER); // If no mixer config is specified for a spatializer output, default to 5.1 for proper // configuration of the final downmixer or spatializer if (mixerConfig == nullptr) { if ((mFlags & AUDIO_OUTPUT_FLAG_SPATIALIZER) != 0 && mixerConfig == nullptr) { lMixerConfig.channel_mask = AUDIO_CHANNEL_OUT_5POINT1; } } ALOGV("opening output for device %s profile %p name %s", mDevices.toString().c_str(), mProfile.get(), mProfile->getName().c_str()); Loading @@ -585,7 +581,7 @@ status_t SwAudioOutputDescriptor::open(const audio_config_t *halConfig, &lMixerConfig, device, &mLatency, halFlags); mFlags); if (status == NO_ERROR) { LOG_ALWAYS_FATAL_IF(*output == AUDIO_IO_HANDLE_NONE, Loading