Loading services/audiopolicy/engineconfigurable/src/Engine.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ #include <AudioIODescriptorInterface.h> #include <ParameterManagerWrapper.h> #include <media/TypeConverter.h> using std::string; using std::map; Loading Loading @@ -244,9 +246,9 @@ DeviceVector Engine::getDevicesForProductStrategy(product_strategy_t ps) const } if (devices == AUDIO_DEVICE_NONE || (devices & availableOutputDevicesType) == AUDIO_DEVICE_NONE) { devices = getApmObserver()->getDefaultOutputDevice()->type(); ALOGE_IF(devices == AUDIO_DEVICE_NONE, "%s: no valid default device defined", __FUNCTION__); return DeviceVector(getApmObserver()->getDefaultOutputDevice()); auto defaultDevice = getApmObserver()->getDefaultOutputDevice(); ALOG_ASSERT(defaultDevice != nullptr, "no valid default device defined"); return DeviceVector(defaultDevice); } if (/*device_distinguishes_on_address(devices)*/ devices == AUDIO_DEVICE_OUT_BUS) { // We do expect only one device for these types of devices Loading @@ -254,6 +256,14 @@ DeviceVector Engine::getDevicesForProductStrategy(product_strategy_t ps) const // If this criterion is not wished, need to ensure this device is available const String8 address(productStrategies.getDeviceAddressForProductStrategy(ps).c_str()); ALOGV("%s:device 0x%x %s %d", __FUNCTION__, devices, address.c_str(), ps); auto busDevice = availableOutputDevices.getDevice(devices, address, AUDIO_FORMAT_DEFAULT); if (busDevice == nullptr) { ALOGE("%s:unavailable device 0x%x %s, fallback on default", __func__, devices, address.c_str()); auto defaultDevice = getApmObserver()->getDefaultOutputDevice(); ALOG_ASSERT(defaultDevice != nullptr, "Default Output Device NOT available"); return DeviceVector(defaultDevice); } return DeviceVector(availableOutputDevices.getDevice(devices, address, AUDIO_FORMAT_DEFAULT)); Loading Loading
services/audiopolicy/engineconfigurable/src/Engine.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ #include <AudioIODescriptorInterface.h> #include <ParameterManagerWrapper.h> #include <media/TypeConverter.h> using std::string; using std::map; Loading Loading @@ -244,9 +246,9 @@ DeviceVector Engine::getDevicesForProductStrategy(product_strategy_t ps) const } if (devices == AUDIO_DEVICE_NONE || (devices & availableOutputDevicesType) == AUDIO_DEVICE_NONE) { devices = getApmObserver()->getDefaultOutputDevice()->type(); ALOGE_IF(devices == AUDIO_DEVICE_NONE, "%s: no valid default device defined", __FUNCTION__); return DeviceVector(getApmObserver()->getDefaultOutputDevice()); auto defaultDevice = getApmObserver()->getDefaultOutputDevice(); ALOG_ASSERT(defaultDevice != nullptr, "no valid default device defined"); return DeviceVector(defaultDevice); } if (/*device_distinguishes_on_address(devices)*/ devices == AUDIO_DEVICE_OUT_BUS) { // We do expect only one device for these types of devices Loading @@ -254,6 +256,14 @@ DeviceVector Engine::getDevicesForProductStrategy(product_strategy_t ps) const // If this criterion is not wished, need to ensure this device is available const String8 address(productStrategies.getDeviceAddressForProductStrategy(ps).c_str()); ALOGV("%s:device 0x%x %s %d", __FUNCTION__, devices, address.c_str(), ps); auto busDevice = availableOutputDevices.getDevice(devices, address, AUDIO_FORMAT_DEFAULT); if (busDevice == nullptr) { ALOGE("%s:unavailable device 0x%x %s, fallback on default", __func__, devices, address.c_str()); auto defaultDevice = getApmObserver()->getDefaultOutputDevice(); ALOG_ASSERT(defaultDevice != nullptr, "Default Output Device NOT available"); return DeviceVector(defaultDevice); } return DeviceVector(availableOutputDevices.getDevice(devices, address, AUDIO_FORMAT_DEFAULT)); Loading