diff --git a/crates/audio/src/audio.rs b/crates/audio/src/audio.rs index 0a6b497c654679673b024b8eca6d0ae9613c1b8e..f90a1ac95373c6f98bbf37c9e5b97721d04dbca1 100644 --- a/crates/audio/src/audio.rs +++ b/crates/audio/src/audio.rs @@ -168,7 +168,8 @@ impl Audio { SAMPLE_RATE.saturating_mul(nz!(3)), SAMPLE_RATE.saturating_mul(nz!(4)), ]) - .prefer_channel_counts([CHANNEL_COUNT, CHANNEL_COUNT.saturating_mul(nz!(2))]) + .prefer_channel_counts([nz!(2)]) + // .prefer_channel_counts([CHANNEL_COUNT, CHANNEL_COUNT.saturating_mul(nz!(2))]) .prefer_buffer_sizes(512..) .open_stream()?; info!("Opened microphone: {:?}", stream.config()); diff --git a/crates/audio/src/rodio_ext.rs b/crates/audio/src/rodio_ext.rs index 3e266b8fd93f28a593bc97940ee0c773065c4806..eff9aec92d72e0b3cf835e18de3790a63f6bd3ea 100644 --- a/crates/audio/src/rodio_ext.rs +++ b/crates/audio/src/rodio_ext.rs @@ -112,7 +112,6 @@ impl RodioExt for S { } fn denoise(self) -> Result, DenoiserError> { let res = Denoiser::try_new(self); - log::info!("result of new: {res:?}"); res } fn constant_params( @@ -176,8 +175,8 @@ impl Iterator for ToMono { match self.input_channel_count.get() { 1 => self.next(), 2 => { - let first_channel = self.next()?; - let second_channel = self.next()?; + let first_channel = self.inner.next().unwrap(); + let second_channel = self.inner.next()?; self.update_mean(second_channel); if self.real_stereo() { diff --git a/crates/denoise/src/lib.rs b/crates/denoise/src/lib.rs index 1422c81a4b915d571d35585447165c04d3695b73..755f2a197be9cc9120eb39ffe0ecd5a68a24ba08 100644 --- a/crates/denoise/src/lib.rs +++ b/crates/denoise/src/lib.rs @@ -84,7 +84,7 @@ impl Denoiser { .spawn(move || { run_neural_denoiser(denoised_tx, input_rx); }) - .unwrap(); + .expect("Should be a able to spawn threads"); Ok(Self { inner: source, diff --git a/crates/livekit_client/src/livekit_client/playback.rs b/crates/livekit_client/src/livekit_client/playback.rs index 3a21c8ea530b1083609cd277705cdf01695b9291..b4cd68e08e4a88f9cb248e3b7ac64fbfca4c39de 100644 --- a/crates/livekit_client/src/livekit_client/playback.rs +++ b/crates/livekit_client/src/livekit_client/playback.rs @@ -204,17 +204,20 @@ impl AudioStack { let voip_parts = audio::VoipParts::new(cx)?; // Audio needs to run real-time and should never be paused. That is // why we are using a normal std::thread and not a background task - thread::spawn(move || { - // microphone is non send on mac - let microphone = match audio::Audio::open_microphone(voip_parts) { - Ok(m) => m, - Err(e) => { - log::error!("Could not open microphone: {e}"); - return; - } - }; - send_to_livekit(frame_tx, microphone); - }); + thread::Builder::new() + .name("MicrophoneToLivekit".to_string()) + .spawn(move || { + // microphone is non send on mac + let microphone = match audio::Audio::open_microphone(voip_parts) { + Ok(m) => m, + Err(e) => { + log::error!("Could not open microphone: {e}"); + return; + } + }; + send_to_livekit(frame_tx, microphone); + }) + .expect("should be able to spawn threads"); Task::ready(Ok(())) } else { self.executor.spawn(async move {