nannou-org / nannou

A Creative Coding Framework for Rust.
https://nannou.cc/
5.96k stars 302 forks source link

Audio crashing on linux #329

Open freesig opened 5 years ago

freesig commented 5 years ago

I'm getting double free or corruption (!prev) segfault after adding audio to a nannou project. It doesn't happen on simple_audio. This is on Ubuntu and I'm wondering if it's due to a second window. I'll continue investigating.

freesig commented 5 years ago

Ok it seems to be happening when there is an input and output stream

mitchmindtree commented 5 years ago

I'm about 99.9"% sure this will be a CPAL ALSA backend issue, but it's worth keeping one open here too in case other users bump into this.

In my experience devving musemsvictoria/spatial_audio_server the problem seemed to be related to ALSA's requirement of exclusive access to the device - e.g. problems start occurring when some random pulseaudio stream is accessing the same device in the background. This is basically why solutions like pulseaudio and jack exist - to work around ALSA's requirement for exclusive-access and handle stream mixing for you and the desktop environment. I think this is good motivation for adding a pulseaudio host in CPAL too, though we should also investigate to see if we can induce better error messages (rather than segfaults) in ALSA. This is all assuming the bug you're seeing is actually exclusive-access related! I found it very difficult to make the error happen reliably at all, though at the time I was more focused on getting things running smoothly on macos as that's what the installation required.