rubato
rubato copied to clipboard
asynchronous sampler crashes with access violation in fn interp_lin<T> when using chunksize of 1
i got a access violation exception calling resampler.process_into_buffer(&self.resampler_input, &mut self.resampler_output, Some(&self.channel_mask)) ;
using rubato = "0.14.1"
using FastFixedOut
after testing this exception only occurs with a chunk_size of 1. if this isn't intended, here is a test to reproduce this error:
#[test]
fn test_rubato() {
// new resampler
let parameters = SincInterpolationParameters {
sinc_len: 32, f_cutoff: 0.95, oversampling_factor: 32, interpolation: rubato::SincInterpolationType::Nearest, window: rubato::WindowFunction::Blackman
};
const CHUNK_SIZE:usize = 4;
let resamplerx: SincFixedOut = rubato::SincFixedOut::new(44100.0/44100.0, 10.0, parameters,
CHUNK_SIZE, 2).ok().unwrap();
let mut resampler_input: Vec>= Resampler::input_buffer_allocate(&resamplerx, true);
let mut resampler_output: Vec>= Resampler::output_buffer_allocate( &resamplerx, true);
let mut resampler: SincFixedOut = resamplerx;
let delay = Duration::from_micros(3);
for _ in 0..4000 {
sleep(delay);
Resampler::process_into_buffer(&mut resampler, &resampler_input, &mut resampler_output, None).unwrap();
}
}
if this is intended then id be happy if an assertion or note in the docs is added. thank you
Thanks for the report! Running with a chunksize of 1 will be extremely inefficient, so it's not something to recommend ever doing. But it should still work. I'll fix it in the next release. Try to use a chunksize of at least 100 (ideally a bit larger, like 1000) if you want good performance.
my goal was sample accurate resampling related to resample ratio. but you're right thats probably overkill. nonetheless in my case chunksize has to be small in order to get low latency.
thank you for your work and quick response! :)
A fix is included in https://github.com/HEnquist/rubato/pull/78