fix: add init timeouts for PipeWire and PulseAudio#1194
Conversation
There was a problem hiding this comment.
Pull request overview
Adds initialization timeouts to the Linux audio backends to avoid cpal::default_host() hanging indefinitely (per #1192), allowing host selection to fall back when PipeWire/PulseAudio initialization stalls.
Changes:
- PulseAudio: wrap
pulseaudio::Client::from_envin a helper thread and fail host init after a fixed timeout. - PipeWire: introduce a fixed init timeout constant and add a watchdog to stop the PipeWire mainloop if
doneevents never arrive; also reuse the constant for stream init waits.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/host/pulseaudio/mod.rs |
Adds a bounded wait around Client::from_env to prevent indefinite blocking during PulseAudio host initialization. |
src/host/pipewire/device.rs |
Adds a PipeWire init watchdog (and shared init timeout constant) to avoid hangs during device discovery and stream initialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c94a90b to
f5532e5
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
works on my setup |
Just to be sure: was your setup hanging before too and is it now fixed? |
|
no issue on my setup but you requested me to test on the other ticket |
|
Yes would be great to hear from your users that suffered from it! |
|
My users are reporting that switching the default backend to ALSA in Flathub builds fixed the issue for them so I guess that the hanging point is likely to be here (if you want them to try with the non-Flathub builds feel free to ask them on the original tickets). FYI the next release of SongRec should try both ALSA and PipeWire as a default backend, falling back to the next one when anything fails even in the late device acquisition process, and the first backend to be tried will heuristically depend on the distribution channel + a CLI flag (see marin-m/SongRec#306) |
|
Sounds good. I'll get this merged soon and hopefully it will aid marin-m/SongRec#306 or - best case - make it superfluous. Feel free to open a new issue if things pop up again. |
|
Noted, pushed your fix in rel 0.7.2 in the meantime |
(Hopefully) fixes #1192