-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
SDL 3 Loopwave : Audio no output and code freeze on USB Headphone via PulseAudio driver #8788
Comments
We had some threading issues with pipewire's Jack compatibility layer, and I wonder if we have some with the Pulse compat too. |
Could it be possible to place PipeWire before PulseAudio in the |
Honestly, this isn't a bad idea. I know we talked about this at some point, but if we're just going to end up routing through PIpeWire's compatibility libraries if PipeWire is installed, maybe that should be the default, so if we fallback to PulseAudio, it's really PulseAudio (probably), etc. @flibitijibibo, @slouken: I think y'all were there when we talked about this before. What stops us from just flipping PIpeWire's bootstrap priority, again? EDIT: For SDL3 for sure, but also for SDL2? |
I thought there were issues with pipewire that went away if we used pulseaudio emulation. I don't remember the specifics though. I'll look around and see if I can find the details. Maybe our pipewire implementation just needs some good exercising to flush out the bugs? |
The last TODO is the ability to know from PipeWire that it's being used for audio, which I'm tracking over at #5268. |
Mentioned in 5268:
This was October 2022; did this fizzle? |
Indeed it did - the PipeWire maintainers have an implementation in mind, they just need someone to type it out. |
Have any newer distros not switched to Pipewire for audio mixing yet? Maybe SDL3 could default to Pipewire as long as the underlying version is 1.0 or higher (or it was explicitly requested), as anything running an up-to-date Pipewire version is basically guaranteed to be using it for audio mixing. Even a niche distro like AVLinux that was historically opposed to it has switched over in the newest version. If some distro does insist on shipping Pipewire while using legacy Pulseaudio, they can always patch their shipping version of SDL to restore the higher Pulseaudio priority, and people who intentionally start ripping out the sound system that ships with their distro in favor of some legacy setup (e.g. ALSA+dmix or OSS) already have to set the necessary envvars manually. |
Maybe, but the concern isn't what distros will do with their copy of SDL, it's what Steam's copy of SDL will do on every distro. :) |
I have a tiny patch detecting in the SDL PulseAudio driver whether the PulseAudio server is actually PipeWire. The PulseAudio server name is Would this be acceptable ? |
That seems reasonable to me... not like there's another server out there that would get mixed up in there somehow, and we can always flip it around when it's possible to detect PE the "correct" way. |
The code that does this would need an #ifdef check to make sure that the Pulse driver isn't skipped if SDL wasn't built with the Pipewire driver though. |
Please, why so ? SDL would fallback to ALSA, then, and work. Whereas just exchanging the PipeWire driver and the PulseAudio driver, in the priority order, as I preferred first, would still hang if SDL was not built with the support of PipeWire. And if a fallback driver was lacking, I would still prefer to have SDL report that it could not initialize the audio subsystem than having to open another terminal to kill a hung application - Control-C does not work. |
I have debugged the SDL 3 + PulseAudio driver + PulseAudio daemon provided by PipeWire. The hang in I can avoid the hang with the headphones by increasing the size of the sample buffer, set in Or I can avoid the hang if I remove the As for myself, I have settled on I may add that the PulseAudio daemon provided by Pipewire, when it is set with a «too small» sample buffer, fails to send the required command I think that the issue might be closed. |
I am glad to report that this PR #9473 fixes the hang in Exult choosing PulseAudio over PipeWire : I have removed my Not only that, I also find quite nice the idea of having the PipeWire driver occurring twice in the Audio driver list, with the first occurrence having more stringent but possibly failing tests than the second and original occurrence, thus preserving compatibility. In the name of the Exult team, I am proffering my thanks for this solution. |
Reference in exult/exult#379
Problem description
Test with
loopwave
, Linux Fedora 39, USB Headphones over PipeWire, the SDL default driver is PulseAudio => no audio output, and code freeze :The SDL drivers PipeWire or ALSA work OK :
The SDL driver Jack fails with :
The SDL driver DSP fails with :
The PulseAudio (
pacat -p
) and Pipewire (pw-cat -p
) play command lines work OK.When the audio is routed to the PCIe Audio card to Loudspeakers - by switching off the Headphone -, then
loopwave
with PulseAudio works.With
loopwave
via PulseAudio to the USB Headphone under GDB, at code freeze, break with Ctl-C, the GDB query threads returns :Complement information
PipeWire is installed as
pipewire-(various-)1.0.0-2.fc39
,PipeWire provides a PulseAudio API in installed
pipewire-pulseaudio-1.0.0-2.fc39
,The PulseAudio core
pulseaudio-16.1-5.fc39
is not installed and cannot be installed because the installedpipewire-pulseaudio
is in conflict,The PulseAudio library
pulseaudio-libs-16.1-5.fc39
is installed.SDL 3 is at Git main of 2024-01-06, commit e100992, no mod.
The text was updated successfully, but these errors were encountered: