[AudioEngine] Make a smarter choice between PulseAudio and PipeWire #25043
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Some distributions, e.g. Ubuntu 22.04, use PipeWire for video/WebRTC, but still use PulseAudio for audio. Previously, Kodi would blindly use any available PipeWire socket, even if it wasn't used for audio (see for example #25002).
This PR changes the order in which the different sound systems are probed. Instead of trying PipeWire first, PulseAudio is started first. Our PulseAudio implementation then checks whether the PulseAudio server is provided by PulseAudio or PipeWire. If it is PipeWire, and Kodi was built with PipeWire support, then our PulseAudio implementation bails and PipeWire is tried next.
The user can still force the use of the PulseAudio compatibility layer by using the
--audio-backend=pulseaudio
parameter.The implementation feels a little bit hacked together, I'm open to different approaches.
Motivation and context
Using PipeWire when it's not in charge of audio isn't a good idea, see #25002.
How has this been tested?
On Arch with a full PipeWire setup PipeWire is used by default. By passing
--audio-backend=pulseaudio
PulseAudio is used instead. I didn't test a setup like Ubuntu 22.04!What is the effect on users?
Better default choice of the used audio API.
Types of change
Checklist: