From f9720b9767351d37b5617f96b7302a25dd4aad8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Thu, 11 Mar 2021 16:52:44 +0100 Subject: [PATCH 1/2] clippy fixes --- src/host/alsa/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/host/alsa/mod.rs b/src/host/alsa/mod.rs index d306519..6f19f4a 100644 --- a/src/host/alsa/mod.rs +++ b/src/host/alsa/mod.rs @@ -387,7 +387,7 @@ impl Device { } } - if rates.len() == 0 { + if rates.is_empty() { vec![(min_rate, max_rate)] } else { rates @@ -423,11 +423,11 @@ impl Device { for channels in supported_channels.iter() { for &(min_rate, max_rate) in sample_rates.iter() { output.push(SupportedStreamConfigRange { - channels: channels.clone(), + channels: *channels, min_sample_rate: SampleRate(min_rate as u32), max_sample_rate: SampleRate(max_rate as u32), buffer_size: buffer_size_range.clone(), - sample_format: sample_format, + sample_format, }); } } From a945d83ac73b38b0789c9114dee5aa068f529ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Mon, 22 Mar 2021 11:06:15 +0100 Subject: [PATCH 2/2] give each thread a unique name --- src/host/alsa/mod.rs | 18 ++++++++++++------ src/host/wasapi/stream.rs | 12 ++++++++---- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/host/alsa/mod.rs b/src/host/alsa/mod.rs index 6f19f4a..6857205 100644 --- a/src/host/alsa/mod.rs +++ b/src/host/alsa/mod.rs @@ -912,9 +912,12 @@ impl Stream { let (tx, rx) = trigger(); // Clone the handle for passing into worker thread. let stream = inner.clone(); - let thread = thread::spawn(move || { - input_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback); - }); + let thread = thread::Builder::new() + .name("cpal_alsa_in".to_owned()) + .spawn(move || { + input_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback); + }) + .unwrap(); Stream { thread: Some(thread), inner, @@ -934,9 +937,12 @@ impl Stream { let (tx, rx) = trigger(); // Clone the handle for passing into worker thread. let stream = inner.clone(); - let thread = thread::spawn(move || { - output_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback); - }); + let thread = thread::Builder::new() + .name("cpal_alsa_out".to_owned()) + .spawn(move || { + output_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback); + }) + .unwrap(); Stream { thread: Some(thread), inner, diff --git a/src/host/wasapi/stream.rs b/src/host/wasapi/stream.rs index a72f244..d037fa2 100644 --- a/src/host/wasapi/stream.rs +++ b/src/host/wasapi/stream.rs @@ -100,8 +100,10 @@ impl Stream { commands: rx, }; - let thread = - thread::spawn(move || run_input(run_context, &mut data_callback, &mut error_callback)); + let thread = thread::Builder::new() + .name("cpal_wasapi_in".to_owned()) + .spawn(move || run_input(run_context, &mut data_callback, &mut error_callback)) + .unwrap(); Stream { thread: Some(thread), @@ -129,8 +131,10 @@ impl Stream { commands: rx, }; - let thread = - thread::spawn(move || run_output(run_context, &mut data_callback, &mut error_callback)); + let thread = thread::Builder::new() + .name("cpal_wasapi_out".to_owned()) + .spawn(move || run_output(run_context, &mut data_callback, &mut error_callback)) + .unwrap(); Stream { thread: Some(thread),