Improve performance of blocking

This commit is contained in:
Jan-Henrik 2024-03-19 22:11:06 +01:00
parent 54c987e784
commit 1d4c93b4da

View file

@ -41,6 +41,7 @@ impl StreamerBackend {
.map(move |_| {
let mut buffer = [0_i16; BUFFER_SIZE];
renderer.on_start_of_batch();
tokio::task::block_in_place(|| {
buffer.fill_with(|| {
let sample = renderer
.next_sample()
@ -55,6 +56,7 @@ impl StreamerBackend {
};
sample
});
});
Box::new(buffer)
});