cpal icon indicating copy to clipboard operation
cpal copied to clipboard

ALSA host blocking forever

Open mbodmer opened this issue 2 years ago • 2 comments

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"     |          
                   +---------------+               

mbodmer avatar Oct 03 '22 09:10 mbodmer

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.

mbodmer avatar Oct 03 '22 09:10 mbodmer

To have a timeout other than blocking would allow for error handling and recovery for the CPAL app.

mbodmer avatar Oct 03 '22 09:10 mbodmer

Closing this issue as it is merged in https://github.com/RustAudio/cpal/pull/696

mbodmer avatar Oct 18 '22 19:10 mbodmer