Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AudioEngine] Make a smarter choice between PulseAudio and PipeWire #25043

Merged
merged 3 commits into from Apr 26, 2024

Conversation

neo1973
Copy link
Member

@neo1973 neo1973 commented Apr 22, 2024

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

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • Student submission (PR was done for educational purposes and will be treated as such)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@neo1973 neo1973 added Type: Improvement non-breaking change which improves existing functionality Platform: Linux Component: Audio v22 "P" labels Apr 22, 2024
@neo1973 neo1973 added this to the "P" 22.0 Alpha 1 milestone Apr 22, 2024
@neo1973 neo1973 requested a review from lrusak as a code owner April 22, 2024 00:41
@Martii Martii mentioned this pull request Apr 22, 2024
7 tasks
@Martii
Copy link

Martii commented Apr 24, 2024

The user can still force the use of the PulseAudio compatibility layer by using the --audio-backend=pulseaudio parameter.

This seems to be very important. I have been playing around with the 24.04 beta in a VM and PipeWire sound server is currently quite audio choppy for all media including PVR (it is a beta of course). When forced to PulseAudio everything sounds fine... and technically it's still running through PipeWire via pipewire-pulse from what I gather. :\

... so more people can give their opinion.

Is there a chance for a pre-release flatpak to test it out on 22.04 and 24.04 (whether beta or full release of K/Ubuntu which should be due soon I think)? I don't think I'll have enough time to build a development area for Kodi just yet... but would like to eventually. A lot on my plate.

@neo1973
Copy link
Member Author

neo1973 commented Apr 24, 2024

This seems to be very important. I have been playing around with the 24.04 beta in a VM and PipeWire sound server is currently quite audio choppy for all media including PVR (it is a beta of course). When forced to PulseAudio everything sounds fine... and technically it's still running through PipeWire via pipewire-pulse from what I gather. :\

Some PipeWire related issues are already being investigated, but I think it would be good to have information from more setups. So if you could open a ticket describing the issues with 24.04 and include a debug log, it would help us to flesh out the remaining issues 🙂

Is there a chance for a pre-release flatpak to test it out on 22.04 and 24.04 (whether beta or full release of K/Ubuntu which should be due soon I think)? I don't think I'll have enough time to build a development area for Kodi just yet... but would like to eventually. A lot on my plate.

I can look into it, but so far we don't have a process for creating Flatpak test builds. (We are working on it in #24920)

@Martii Martii mentioned this pull request Apr 24, 2024
7 tasks
@neo1973 neo1973 merged commit 85519a6 into xbmc:master Apr 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Audio Platform: Linux Type: Improvement non-breaking change which improves existing functionality v22 "P"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants