adds docs for BufferSize and fixes buffersize bugs in emscripten and alsa

This commit is contained in:
JoshuaBatty 2020-07-14 13:15:32 +02:00
parent 271cc34f3f
commit 4ce12a69b9
3 changed files with 8 additions and 8 deletions

View file

@ -905,13 +905,6 @@ fn set_hw_params_from_format<'a>(
BufferSize::Default => (),
}
// If this isn't set manually a overlarge buffer may be used causing audio delay
let mut hw_params_copy = hw_params.clone();
if let Err(_) = hw_params.set_buffer_time_near(100_000, alsa::ValueOr::Nearest) {
// Swap out the params with errors for a snapshot taken before the error was introduced.
mem::swap(&mut hw_params_copy, &mut hw_params);
}
pcm_handle.hw_params(&hw_params)?;
Ok(hw_params)

View file

@ -334,7 +334,7 @@ fn audio_callback_fn<D, E>(
// and there may be underflows
set_timeout(
|| audio_callback_fn::<D, E>(user_data_ptr, config, sample_format, buffer_size_frames),
330,
buffer_size_frames * 1000 / sample_rate,
);
}
}