Open kinetiknz opened 2 years ago
I noticed that the state changed callback and device changed callback can be called from threads other than the audio I/O thread.
E.g. with the macOS CoreAudio backend:
This makes me think that maybe the other callbacks need to be kept as Sync
?
A cubeb backend may run user callbacks on any thread it chooses to, but must never run the same user callback on multiple threads concurrently.
This seems true for data callback, but I guess cubeb can fire two different state callbacks at a time on the Mac platform. Suppose we unplug the device after the stream start in the following procedure:
We should probably fix this on the cubeb-coreaudio and check it we have similar problems on other backends.
We could remove Sync
for data callback for now and others later, what do you think?
A cubeb backend may run user callbacks on any thread it chooses to, but must never run the same user callback on multiple threads concurrently. If I understand correctly, the
Send
constraint is sufficient to represent the appropriate constraint for this, makingSync
unnecessary.Fixes https://github.com/mozilla/cubeb-rs/issues/68