From b7d230150c81a4cc67e85065fef9b8101ce9819f Mon Sep 17 00:00:00 2001 From: Richard Dodd Date: Wed, 24 Jul 2019 20:43:20 +0100 Subject: [PATCH 1/2] Remove the (arbitary) restriction on buffer size --- src/host/alsa/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/host/alsa/mod.rs b/src/host/alsa/mod.rs index ac68914..b7b7f3d 100644 --- a/src/host/alsa/mod.rs +++ b/src/host/alsa/mod.rs @@ -1118,6 +1118,7 @@ unsafe fn set_hw_params_from_format( } // TODO: Review this. 200ms seems arbitrary... + /* let mut max_buffer_size = format.sample_rate.0 as alsa::snd_pcm_uframes_t / format.channels as alsa::snd_pcm_uframes_t / 5; // 200ms of buffer @@ -1127,6 +1128,7 @@ unsafe fn set_hw_params_from_format( { return Err(format!("max buffer size could not be set: {}", e)); } + */ if let Err(e) = check_errors(alsa::snd_pcm_hw_params(pcm_handle, hw_params.0)) { return Err(format!("hardware params could not be set: {}", e)); From 1c34dd682ed00ebb3d5135c77a6dccb5b325c67d Mon Sep 17 00:00:00 2001 From: Richard Dodd Date: Sat, 27 Jul 2019 16:41:19 +0100 Subject: [PATCH 2/2] Remove code rather than comment out --- src/host/alsa/mod.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/host/alsa/mod.rs b/src/host/alsa/mod.rs index b7b7f3d..bed6051 100644 --- a/src/host/alsa/mod.rs +++ b/src/host/alsa/mod.rs @@ -1117,19 +1117,6 @@ unsafe fn set_hw_params_from_format( return Err(format!("channel count could not be set: {}", e)); } - // TODO: Review this. 200ms seems arbitrary... - /* - let mut max_buffer_size = format.sample_rate.0 as alsa::snd_pcm_uframes_t / - format.channels as alsa::snd_pcm_uframes_t / - 5; // 200ms of buffer - if let Err(e) = check_errors(alsa::snd_pcm_hw_params_set_buffer_size_max(pcm_handle, - hw_params.0, - &mut max_buffer_size)) - { - return Err(format!("max buffer size could not be set: {}", e)); - } - */ - if let Err(e) = check_errors(alsa::snd_pcm_hw_params(pcm_handle, hw_params.0)) { return Err(format!("hardware params could not be set: {}", e)); }