From f9d9e8c88b08a8ba2d879e1736a28f937bd42ecb Mon Sep 17 00:00:00 2001 From: Armin Sander Date: Wed, 20 Aug 2025 12:26:19 +0200 Subject: [PATCH 1/3] Remove Azure Translate stream timeouts --- external/azure-speech-sdk-rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/azure-speech-sdk-rs b/external/azure-speech-sdk-rs index d22b0fa..62bd6b1 160000 --- a/external/azure-speech-sdk-rs +++ b/external/azure-speech-sdk-rs @@ -1 +1 @@ -Subproject commit d22b0fac8e4db0b4586d5ec0e2d465005fed4dd9 +Subproject commit 62bd6b118db397f165dc96997867ac9b475d42c5 From b45c61626348ea4195102d464f7cd271d671dc15 Mon Sep 17 00:00:00 2001 From: Armin Sander Date: Wed, 20 Aug 2025 12:29:10 +0200 Subject: [PATCH 2/3] Bump versions --- Cargo.toml | 2 +- audio-knife/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index eee3d0a..4dd9fb8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "context-switch" -version = "1.1.0" +version = "1.1.1" edition = "2024" rust-version = "1.88" diff --git a/audio-knife/Cargo.toml b/audio-knife/Cargo.toml index 88f729c..01784d7 100644 --- a/audio-knife/Cargo.toml +++ b/audio-knife/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "audio-knife" -version = "1.4.0" +version = "1.4.1" edition = "2024" [profile.dev] From 5eb6f9e7d5c50a2014c7cb6bd15f1dd9c3b18b4e Mon Sep 17 00:00:00 2001 From: Armin Sander Date: Wed, 20 Aug 2025 12:35:11 +0200 Subject: [PATCH 3/3] Clippy drive-by fixes --- audio-knife/src/app_error.rs | 1 + services/azure/src/translate.rs | 12 ++++++------ services/playback/src/stream_reader.rs | 17 ++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/audio-knife/src/app_error.rs b/audio-knife/src/app_error.rs index d60bebb..6814243 100644 --- a/audio-knife/src/app_error.rs +++ b/audio-knife/src/app_error.rs @@ -5,6 +5,7 @@ use axum::{ response::{IntoResponse, Response}, }; +#[allow(unused)] pub struct AppError(anyhow::Error); // Tell axum how to convert `AppError` into a response. diff --git a/services/azure/src/translate.rs b/services/azure/src/translate.rs index dc238e0..80a098e 100644 --- a/services/azure/src/translate.rs +++ b/services/azure/src/translate.rs @@ -41,12 +41,12 @@ impl Service for AzureTranslate { sample_rate: 16000, }; - if let Some(audio_format) = output_modalities.audio { - if audio_format != AUDIO_OUTPUT_FORMAT { - bail!( - "Only {AUDIO_OUTPUT_FORMAT:?} is supported, but output modalities contains {audio_format:?}" - ); - } + if let Some(audio_format) = output_modalities.audio + && audio_format != AUDIO_OUTPUT_FORMAT + { + bail!( + "Only {AUDIO_OUTPUT_FORMAT:?} is supported, but output modalities contains {audio_format:?}" + ); } // Host / Auth is lightweight, so we can create this every time. diff --git a/services/playback/src/stream_reader.rs b/services/playback/src/stream_reader.rs index b5db64a..3d885c8 100644 --- a/services/playback/src/stream_reader.rs +++ b/services/playback/src/stream_reader.rs @@ -31,17 +31,16 @@ impl io::Read for StreamReader { } // If we have a current chunk with remaining data, use it - if let Some(ref chunk) = self.current_chunk { - if self.chunk_offset < chunk.len() { - let remaining_in_chunk = chunk.len() - self.chunk_offset; - let to_copy = std::cmp::min(buf.len(), remaining_in_chunk); + if let Some(ref chunk) = self.current_chunk + && self.chunk_offset < chunk.len() + { + let remaining_in_chunk = chunk.len() - self.chunk_offset; + let to_copy = std::cmp::min(buf.len(), remaining_in_chunk); - buf[..to_copy] - .copy_from_slice(&chunk[self.chunk_offset..self.chunk_offset + to_copy]); - self.chunk_offset += to_copy; + buf[..to_copy].copy_from_slice(&chunk[self.chunk_offset..self.chunk_offset + to_copy]); + self.chunk_offset += to_copy; - return Ok(to_copy); - } + return Ok(to_copy); } // Need to get the next chunk from the stream