You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering whether it's possible to relax the constraints of the data callback closure of Stream to not be Sync.
What I'm trying to do at the moment is to prepare audio processors on the main thread before the audio stream starts, then move them into the audio stream's data callback so that they can be used to process audio input/output. With the data callback closure constrained to Sync, I was only able to use structures that are Sync themselves in the audio processors. (For example, it won't work for the resamplers from https://github.com/HEnquist/rubato).
I took a bit closer look into the mechanism of the audio stream, and I think it might be ok to relax the constraint to only require Send for the data callback - at least for the limited use cases I can think of, though I might be missing something.
Keen to hear your thoughts. Cheers.
The text was updated successfully, but these errors were encountered:
kinetiknz
added a commit
to kinetiknz/cubeb-rs
that referenced
this issue
Apr 27, 2022
…ent.
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, making `Sync`
unnecessary.
Fixesmozilla#68
Thanks for filing the issue and apologies for the delay in responding. As far as I understand, it appears the Sync constraint is overly restrictive and unnecessary given the existing restrictions in cubeb regarding when/where callbacks may be run. I've pushed a PR to drop Sync from the stream's user callbacks.
Hi there,
I was wondering whether it's possible to relax the constraints of the data callback closure of Stream to not be
Sync
.What I'm trying to do at the moment is to prepare audio processors on the main thread before the audio stream starts, then move them into the audio stream's data callback so that they can be used to process audio input/output. With the data callback closure constrained to
Sync
, I was only able to use structures that areSync
themselves in the audio processors. (For example, it won't work for the resamplers from https://github.com/HEnquist/rubato).I took a bit closer look into the mechanism of the audio stream, and I think it might be ok to relax the constraint to only require
Send
for the data callback - at least for the limited use cases I can think of, though I might be missing something.Keen to hear your thoughts. Cheers.
The text was updated successfully, but these errors were encountered: