Bug 7450 - Default audio devices not respected on macOS
Summary: Default audio devices not respected on macOS
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Sound (show other bugs)
Version: trunk
Hardware: Mac macOS
: P2 Normal
Target Milestone: 4.12.1
Assignee: Pierre Ossman
Keywords: nikle_tester, relnotes
Depends on:
Blocks: 7615
  Show dependency treegraph
Reported: 2019-12-04 16:46 CET by Samuel Mannehed
Modified: 2021-01-21 12:45 CET (History)
1 user (show)

See Also:
Acceptance Criteria:

patch to sync default devices (4.67 KB, patch)
2020-11-17 14:55 CET, Pierre Ossman

Description Samuel Mannehed cendio 2019-12-04 16:46:34 CET
On macOS 10.15 when you have two microphones plugged in, i.e. one regular mic and one USB mic. the regular mic will always be used by the ThinLinc client. It doesn't matter if the USB mic is set as default.

Other applications on macOS such as QuickTime Player respects the settings w.r.t. default mic.

If only the USB mic is plugged in, it works fine.
Comment 1 Samuel Mannehed cendio 2019-12-04 16:48:10 CET
Note that this bug is quite similar to bug 7442. But the changes made to bug 7442 does not have an effect on macOS. Verified that the behaviour is identical with tl-4.10.1 (before bug 7442 fix was implemented).
Comment 2 Pierre Ossman cendio 2020-03-27 13:49:54 CET
This is a general issue. The same thing happens for playback. Observed when plugging in a USB sound card that is sorted before the speakers.

This also has subsequent problems in the form of poor handling of a removed sound card. If I yank the USB sound card then the client doesn't jump over to a different device. Instead I get no audio until I reconnect.

We are probably isolated from this issue on Windows and Linux as we let the system handle all of this. It should theoretically happen on Linux when using ALSA though.
Comment 4 Pierre Ossman cendio 2020-11-17 13:39:40 CET
I've dug around a bit and the issue seems to be that we are operating at a too low level. "Normal" applications should use an abstraction called "Audio Units". These are mainly for filters and such, but there is a special unit called "DefaultOutput" that makes sure you get the user selected default device. However PulseAudio currently directly accesses the underlying "Audio Devices" where no such abstraction of a default device exists.

To fix this we either have to write a new module that works with Audio Units instead, or make sure we manually track the default settings and switch things as needed.
Comment 5 Pierre Ossman cendio 2020-11-17 14:55:46 CET
Created attachment 969 [details]
patch to sync default devices

This patch makes the coreaudio-detect module sync any changes to the macOS default device settings with PulseAudio's view of the default sink/source.

This partially works in that the default settings will be respected on connect. However it doesn't move any streams over on changes, so the user cannot change the settings once connected. This functionality seems to require an upgrade of PulseAudio.
Comment 6 Pierre Ossman cendio 2020-12-23 10:05:23 CET
We want to keep the changes small here, so moving the parts that require a PulseAudio upgrade to bug 7615.
Comment 8 Pierre Ossman cendio 2020-12-23 10:39:49 CET
Fixed now and works well. Tested with multiple input and output devices.

Note that this fix has not been pushed upstream as we are too far behind.
Comment 9 Niko Lehto cendio 2021-01-04 14:08:53 CET
Could reproduce this issue with a build before the fix and the nightly build (6707) fixes this issue. Tested that our client respects the user chosen sound device.

Release notes looks good too.

Note You need to log in before you can comment on or make changes to this bug.