mozilla / cubeb

Cross platform audio library
ISC License
434 stars 123 forks source link

Potential lack of sound and hang on stream stop if using non-native sample rate on macOS #771

Closed ghost closed 5 months ago

padenot commented 7 months ago

We've been using a replacement backend in Rust for macOS, but the C++ one should work still. I don't know if Citra has some rust already (in which case it might be an option), but fixing the C++ backend shouldn't be too hard.

I think you should attempt to remove this ALOG line because it's using a system message queue system https://github.com/mozilla/cubeb/blob/ed2efe22cb803f022b5a38fbbc53eec250056874/src/cubeb_audiounit.cpp#L63-L67, and I have no idea if it's OK in this context. Looks like it's probably not OK. Since this C++ backend was abandoned, cubeb has it's own async logging facilities (to be able to log from real-time code), and so this ALOG macro isn't needed, we can replace it with the "new" logging stuff: it's a simple interface: https://github.com/mozilla/cubeb/blob/ed2efe22cb803f022b5a38fbbc53eec250056874/src/cubeb_log.h#L52-L72. The simplest fix would probably be to just remove this logging line though.

Happy to look at a patch if you have one handy, or maybe you can try it out on your side and report back (I don't know what's Citra's policy on patching dependencies is, and this seems intermittent and not easily reproducible). I'm just about to take some time off over Christmas and NYE, but I'll look when I'm back.

padenot commented 7 months ago

Ah yes, I'd believe that, it's not exactly common outside of emulation and that's a pretty weird SR.

We could certainly take this patch. cubeb allow getting the "preferred" sample-rate using the API, and it's common for users to want that (since you can bypass the resampler and get lower latency on some platforms).

padenot commented 5 months ago

Absolutely none, this was swallowed by the end-of-year-vacation vortex that made me forget about various issues.

Thanks for pinging me and sorry for the delay, I'll look at it now.