-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(de-)allocation in render thread #359
Comments
Hey, Following the discusion here: #353 (comment) , I had a look on how we could reuse the garbage collector thread to drop
What do you think? Should I try to proceed this way and replace the (aside, maybe we could even use raw |
Thanks for sharing your thoughts. The reason we are using We could try to expose a method in the And maybe the enum Garbage {
Message(Box<dyn Any>),
AudioBuffer(AudioBuffer),
// etc
} |
Ok, I see, probably it's best if I let you define the general architecture then |
I have an idea about deallocation which I have the impression could solve several problems with rather low overhead. If we take for example the pub fn set_buffer(&mut self, audio_buffer: AudioBuffer) {
if self.buffer.is_some() {
panic!("InvalidStateError - cannot assign buffer twice");
}
let audio_buffer = Arc::new(audio_buffer);
self.buffer = Some(audio_buffer);
// send a clone to the garbage collector and another one to audio thread
self.registration.garbage_collector.send(Arc::clone(&audio_buffer));
self.registration.post_message(Arc::clone(&audio_buffer));
} Then in the garbage collector we would just maintain a list of That would mostly imply to modify quite a bit how the garbage collector is created, i.e. in main thread rather than in audio thread. But then I have the impression it could be quite straightforward and could allow to handle several of our issues in a unified way. What do you think? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Thanks for the new suggestion. I had not considered such a thing (similar to the java GC). Could be interesting! A few things to note though:
Mostly due to item 1 I'm not directly convinced this will make our life easier, but feel free to experiment! In the meantime I will try to put a bit more effort in #368 |
Follow up on #353, plus few ideas:
Drop
to dropAudioBuffer
andVec
cleanly in renderers (cf. Otto's comment)AudioBufferSourceRenderer::buffer
ConvolverRenderer::buffer
WaveshaperRenderer::curve
BiquadFilter::{x1, x2, y1, y2}
-> consider usingArrayVec
instead?DelayRenderer::ring_buffer
DynamicsCompressorRenderer::ring_buffer
IirFilterRenderer::{norm_coefs, states}
-> consider usingArrayVec
instead, we can probably clamp eveything usingMAX_CHANNELS
and the max number of coefs (i.e.20
) ?ArrayVec
instead ofVec
inAudioParam
(this is already a dependency so that's cool, and except forresize
this is mostly a drop in) Perf - useArrayVec
instead ofVec
for internalAudioParam
buffer #363The text was updated successfully, but these errors were encountered: