Loading media/libaudiofoundation/AudioContainers.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,13 @@ const DeviceTypeSet& getAudioDeviceOutLeAudioBroadcastSet() { return audioDeviceOutLeAudioUnicastSet; } const DeviceTypeSet& getAudioDeviceOutPickForVolumeSet() { static const DeviceTypeSet audioDevicePickForVolumeSet = DeviceTypeSet( std::begin(AUDIO_DEVICE_OUT_PICK_FOR_VOLUME_ARRAY), std::end(AUDIO_DEVICE_OUT_PICK_FOR_VOLUME_ARRAY)); return audioDevicePickForVolumeSet; } std::string deviceTypesToString(const DeviceTypeSet &deviceTypes) { if (deviceTypes.empty()) { return "Empty device types"; Loading media/libaudiofoundation/include/media/AudioContainers.h +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ const DeviceTypeSet& getAudioDeviceInAllUsbSet(); const DeviceTypeSet& getAudioDeviceOutAllBleSet(); const DeviceTypeSet& getAudioDeviceOutLeAudioUnicastSet(); const DeviceTypeSet& getAudioDeviceOutLeAudioBroadcastSet(); const DeviceTypeSet& getAudioDeviceOutPickForVolumeSet(); template<typename T> static std::vector<T> Intersection(const std::set<T>& a, const std::set<T>& b) { Loading services/audiopolicy/common/include/policy.h +6 −6 Original line number Diff line number Diff line Loading @@ -289,8 +289,8 @@ static inline audio_devices_t apm_extract_one_audio_device( // Multiple device selection is either: // - dock + one other device: give priority to dock in this case. // - speaker + one other device: give priority to speaker in this case. // - one A2DP device + another device: happens with duplicated output. In this case // retain the device on the A2DP output as the other must not correspond to an active // - one removable device + another device: happens with duplicated output. In this case // retain the removable device as the other must not correspond to an active // selection if not the speaker. // - HDMI-CEC system audio mode only output: give priority to available item in order. if (deviceTypes.count(AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) != 0) { Loading @@ -308,13 +308,13 @@ static inline audio_devices_t apm_extract_one_audio_device( } else if (deviceTypes.count(AUDIO_DEVICE_OUT_SPDIF) != 0) { return AUDIO_DEVICE_OUT_SPDIF; } else { std::vector<audio_devices_t> a2dpDevices = android::Intersection( deviceTypes, android::getAudioDeviceOutAllA2dpSet()); if (a2dpDevices.empty() || a2dpDevices.size() > 1) { std::vector<audio_devices_t> volumeDevices = android::Intersection( deviceTypes, android::getAudioDeviceOutPickForVolumeSet()); if (volumeDevices.empty() || volumeDevices.size() > 1) { ALOGW("%s invalid device combination: %s", __func__, android::dumpDeviceTypes(deviceTypes).c_str()); } return a2dpDevices.empty() ? AUDIO_DEVICE_NONE : a2dpDevices[0]; return volumeDevices.empty() ? AUDIO_DEVICE_NONE : volumeDevices[0]; } } } Loading Loading
media/libaudiofoundation/AudioContainers.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,13 @@ const DeviceTypeSet& getAudioDeviceOutLeAudioBroadcastSet() { return audioDeviceOutLeAudioUnicastSet; } const DeviceTypeSet& getAudioDeviceOutPickForVolumeSet() { static const DeviceTypeSet audioDevicePickForVolumeSet = DeviceTypeSet( std::begin(AUDIO_DEVICE_OUT_PICK_FOR_VOLUME_ARRAY), std::end(AUDIO_DEVICE_OUT_PICK_FOR_VOLUME_ARRAY)); return audioDevicePickForVolumeSet; } std::string deviceTypesToString(const DeviceTypeSet &deviceTypes) { if (deviceTypes.empty()) { return "Empty device types"; Loading
media/libaudiofoundation/include/media/AudioContainers.h +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ const DeviceTypeSet& getAudioDeviceInAllUsbSet(); const DeviceTypeSet& getAudioDeviceOutAllBleSet(); const DeviceTypeSet& getAudioDeviceOutLeAudioUnicastSet(); const DeviceTypeSet& getAudioDeviceOutLeAudioBroadcastSet(); const DeviceTypeSet& getAudioDeviceOutPickForVolumeSet(); template<typename T> static std::vector<T> Intersection(const std::set<T>& a, const std::set<T>& b) { Loading
services/audiopolicy/common/include/policy.h +6 −6 Original line number Diff line number Diff line Loading @@ -289,8 +289,8 @@ static inline audio_devices_t apm_extract_one_audio_device( // Multiple device selection is either: // - dock + one other device: give priority to dock in this case. // - speaker + one other device: give priority to speaker in this case. // - one A2DP device + another device: happens with duplicated output. In this case // retain the device on the A2DP output as the other must not correspond to an active // - one removable device + another device: happens with duplicated output. In this case // retain the removable device as the other must not correspond to an active // selection if not the speaker. // - HDMI-CEC system audio mode only output: give priority to available item in order. if (deviceTypes.count(AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) != 0) { Loading @@ -308,13 +308,13 @@ static inline audio_devices_t apm_extract_one_audio_device( } else if (deviceTypes.count(AUDIO_DEVICE_OUT_SPDIF) != 0) { return AUDIO_DEVICE_OUT_SPDIF; } else { std::vector<audio_devices_t> a2dpDevices = android::Intersection( deviceTypes, android::getAudioDeviceOutAllA2dpSet()); if (a2dpDevices.empty() || a2dpDevices.size() > 1) { std::vector<audio_devices_t> volumeDevices = android::Intersection( deviceTypes, android::getAudioDeviceOutPickForVolumeSet()); if (volumeDevices.empty() || volumeDevices.size() > 1) { ALOGW("%s invalid device combination: %s", __func__, android::dumpDeviceTypes(deviceTypes).c_str()); } return a2dpDevices.empty() ? AUDIO_DEVICE_NONE : a2dpDevices[0]; return volumeDevices.empty() ? AUDIO_DEVICE_NONE : volumeDevices[0]; } } } Loading