mozilla / cubeb-coreaudio-rs

The audio backend of Firefox on Mac OS X.
ISC License
25 stars 10 forks source link

Don't log from other threads than the output thread, in duplex mode #180

Closed padenot closed 2 years ago

padenot commented 2 years ago

This uses an spsc ring buffer to proxy the audio input callback parameters to the output thread, for logging purposes.

Without this, multiple threads can attempt writing in the spsc ring buffer that's used for async logging, which make an assertion blow up.

padenot commented 2 years ago

An MPSC that doesn't allocate is hard to write, and we'd need it in C++ (the gecko one allocates, and we do a number of tricks to make it cheap). When we have more backends in rust, we can reconsider what we do about logging, probably by using a good MPSC crate.