cpal
cpal copied to clipboard
ALSA host blocking forever
I am using Pipewire as the sound daemon, the setting looks like this:
+------------+
| My App |
+------------+
| Rodio |
+------------+
| CPAL |
+-----+------+
|
|
v
+-------------+ +---------------+------------+
| Pipewire |<---+ Alsa Device | Alsa Alias |
| Daemon | | "pipewire" | "default" |
| | | | |
+----------+--+ +---------------+------------+
\
-- +---------------+
\ | Alsa Device |
--->| "hw:0" |
+---------------+
Sorry, I've accidentially sent the issue while still editing. Hers my point.
As you can see above CPAL is using the ALSA host, which unfortunately does not respond (probably a bug in pipewire). This however makes CPAL hang, as it blocks forever here in alsa::poll :
https://github.com/RustAudio/cpal/blob/f19ceeb8e0e9a9aeb99b714524176b4ed90ff86f/src/host/alsa/mod.rs#L697
It would be nice if the timeout could be chosen by the developer and maybe we have "-1" aka "blocking" as default.
To have a timeout other than blocking would allow for error handling and recovery for the CPAL app.
Closing this issue as it is merged in https://github.com/RustAudio/cpal/pull/696