fix(audio): look up the named audio input among input devices only (#16906)

get_audio_input() searched HOST.devices(), which lists input and output
devices together, and took the first device whose name matched. CoreAudio
gives a USB microphone with a headphone jack two devices with the same
name, and the output one can come first. RustDesk then picked the output
device, default_input_config() failed with StreamTypeNotSupported, and the
voice call sent no audio from the macOS side ("Failed to get default input
format" every second).

Search HOST.input_devices() instead, so only devices that support input
can match the configured or default input name.

Signed-off-by: xpehter <32315536+xpehter@users.noreply.github.com>
This commit is contained in:
xpehter authored and GitHub committed 2026-11-07 11:00:14 +08:00
1 parent f4c0b13df7
commit 3513c9751d
1 file changed
+1 -1
+1 -1
View File
@@ -449,7 +449,7 @@ mod cpal_impl {
}
if device.is_none() && !audio_input.is_empty() {
for d in HOST
.devices()
.input_devices()
.with_context(|| "Failed to get audio devices")?
{
if d.name().unwrap_or("".to_owned()) == audio_input {