Hello,
Disclaimer: I'm reporting this bug on behalf of someone else, but I hope I've collected enough information to make a good description - and I am able to arrange to run more tests if needed.
Issue
The latest Signal on Windows does not respect the default communication device, and seems to always use the first available one.
Setup
It's a Windows laptop, with a TV plugged in with a cable. In Sound settings, there are two output devices:
- TV, called in logs '1 - SAMSUNG (AMD High Definition Audio Device)'
- Internal speaker, called in logs 'Громкоговоритель и наушники (Realtek High Definition Audio)'
In the sound settings, it is possible to set either of these outputs as default media device and default communication device.
When internal speakers are set to be default everything, all applications respect this setting, and the sound is coming out of the speakers - all except Signal, who is always playing the sound out of the TV.
Restarting Signal doesn't help.
Repro steps
Here is a log performing the following test scenario:
https://debuglogs.org/4148a6154e8a945b562f0aa225ec8eb9a59c5c49b4aa00b00329b7854e877983
- Close Signal.
- Set Internal speakers to be the "default everything" device.
- Launch Signal and start an audio call.
- Audio is coming out of the TV ===> not the internal speakers.
- In the call settings, look at the currently used output device ===> Signal uses "Default".
- In the call settings, change the output device to TV ===> sound is still going out of TV (correct).
- In the call settings, change the output device to internal speaker ===> sound is now going out of the internal speaker (correct).
- In the call settings, change the output device back to "Default" ===> sound is going out of TV again (not internal speakers).
A subset of the logs of the final step:
MediaDevice: setPreferredSpeaker {"name":"Default","uniqueId":"Default","index":0,"i18nKey":"default_communication_device"}
"selectedSpeaker":{"name":"Default","uniqueId":"Default","index":0,"i18nKey":"default_communication_device"}
MediaDevice: selecting speaker {"name":"Default","uniqueId":"Default","index":0,"i18nKey":"default_communication_device"}
src\webrtc\peer_connection_factory.rs:379 PeerConnectionFactory::set_audio_playout_device(0)
src\webrtc\peer_connection_factory.rs:386 Picking default communication device (index 0)
Led me to 364fbfc, which I'm trying to analyze next.
In order for this block to print "index 0":
|
if let Ok(default_device) = self.get_default_playout_device_index() { |
|
info!( |
|
"Picking default communication device (index {})", |
|
default_device |
|
); |
This block must have index
equal to 1
:
|
let default_device = self.get_audio_playout_device(DEFAULT_COMMUNICATION_DEVICE_INDEX)?; |
|
let all_devices = self.get_audio_playout_devices()?; |
|
if let Some(index) = all_devices.iter().position(|d| d == &default_device) { |
|
Ok((index - 1) as u16) |
And since all_devices
contains a synthetic device in index 0, default_device
must be a reference to TV, since this is where the sound is coming from, right?
That means when passed DEFAULT_COMMUNICATION_DEVICE_INDEX = 0xFFFF
here:
|
let rc = pcf::Rust_getAudioPlayoutDeviceName(self.rffi, index, name, unique_id); |
Returns incorrectly TV as the default device, and not the internal speaker.
If I understand this correctly, eventually the code goes here:
|
return audio_device_module_->PlayoutDeviceName(index, out_name, out_uuid); |
And then here:
https://chromium.googlesource.com/external/webrtc/+/refs/heads/master/modules/audio_device/win/audio_device_core_win.cc#1500
Meaning that this might be a bug in WebRTC itself, and it e.g. just picks the first available output device, not the one marked as default?
What do you think, does the above tracing look correct?
I'm reasonably sure there is no mistake in configuring default device in Windows, I personally checked several places and everywhere internal speaker is set as default device (in Windows 10 settings, in tray > Sound internal speaker has green "default" icon next to it, no icon in front of TV), and all other apps (including call apps like Wire and Viber) do correctly use the internal speaker when it's set as default device, only Signal has this issue. (But I would be happy if you know a setting in Windows which I just need to adjust to fix this issue 😄 )
Especially since this is not my computer, I'm not sure what would be the best steps to move forward.
What would you suggest, would you be able to take this over, would you like me to gather some additional data / run more tests?
Thanks!