From f7e89d75a4a182c25b9f3b5898f3cf84d4fe813e Mon Sep 17 00:00:00 2001 From: Nicholas Tinsley Date: Tue, 19 Sep 2023 12:25:42 -0400 Subject: [PATCH] Deduplicate audio devices by name. --- .../securesms/components/webrtc/WebRtcAudioPicker31.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcAudioPicker31.kt b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcAudioPicker31.kt index 9fe5e15e68..b679ad0db8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcAudioPicker31.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcAudioPicker31.kt @@ -30,7 +30,7 @@ class WebRtcAudioPicker31(private val audioOutputChangedListener: OnAudioOutputC return null } - val devices: List = am.availableCommunicationDevices.map { AudioOutputOption(it.toFriendlyName(fragmentActivity).toString(), AudioDeviceMapping.fromPlatformType(it.type), it.id) }.distinct().filterNot { it.deviceType == SignalAudioManager.AudioDevice.NONE } + val devices: List = am.availableCommunicationDevices.map { AudioOutputOption(it.toFriendlyName(fragmentActivity).toString(), AudioDeviceMapping.fromPlatformType(it.type), it.id) }.distinctBy { it.deviceType.name }.filterNot { it.deviceType == SignalAudioManager.AudioDevice.NONE } val currentDeviceId = am.communicationDevice?.id ?: -1 if (devices.size < threshold) { Log.d(TAG, "Only found $devices devices,\nnot showing picker.")