Skip to content

Commit ca1466e

Browse files
authored
Merge pull request #50 from pragmatrix/remove-stream-timeouts
Remove Azure Translate stream timeouts
2 parents 5bfb777 + 5eb6f9e commit ca1466e

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "context-switch"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
edition = "2024"
55
rust-version = "1.88"
66

audio-knife/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "audio-knife"
3-
version = "1.4.0"
3+
version = "1.4.1"
44
edition = "2024"
55

66
[profile.dev]

audio-knife/src/app_error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use axum::{
55
response::{IntoResponse, Response},
66
};
77

8+
#[allow(unused)]
89
pub struct AppError(anyhow::Error);
910

1011
// Tell axum how to convert `AppError` into a response.

services/azure/src/translate.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ impl Service for AzureTranslate {
4141
sample_rate: 16000,
4242
};
4343

44-
if let Some(audio_format) = output_modalities.audio {
45-
if audio_format != AUDIO_OUTPUT_FORMAT {
46-
bail!(
47-
"Only {AUDIO_OUTPUT_FORMAT:?} is supported, but output modalities contains {audio_format:?}"
48-
);
49-
}
44+
if let Some(audio_format) = output_modalities.audio
45+
&& audio_format != AUDIO_OUTPUT_FORMAT
46+
{
47+
bail!(
48+
"Only {AUDIO_OUTPUT_FORMAT:?} is supported, but output modalities contains {audio_format:?}"
49+
);
5050
}
5151

5252
// Host / Auth is lightweight, so we can create this every time.

services/playback/src/stream_reader.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,16 @@ impl io::Read for StreamReader {
3131
}
3232

3333
// If we have a current chunk with remaining data, use it
34-
if let Some(ref chunk) = self.current_chunk {
35-
if self.chunk_offset < chunk.len() {
36-
let remaining_in_chunk = chunk.len() - self.chunk_offset;
37-
let to_copy = std::cmp::min(buf.len(), remaining_in_chunk);
34+
if let Some(ref chunk) = self.current_chunk
35+
&& self.chunk_offset < chunk.len()
36+
{
37+
let remaining_in_chunk = chunk.len() - self.chunk_offset;
38+
let to_copy = std::cmp::min(buf.len(), remaining_in_chunk);
3839

39-
buf[..to_copy]
40-
.copy_from_slice(&chunk[self.chunk_offset..self.chunk_offset + to_copy]);
41-
self.chunk_offset += to_copy;
40+
buf[..to_copy].copy_from_slice(&chunk[self.chunk_offset..self.chunk_offset + to_copy]);
41+
self.chunk_offset += to_copy;
4242

43-
return Ok(to_copy);
44-
}
43+
return Ok(to_copy);
4544
}
4645

4746
// Need to get the next chunk from the stream

0 commit comments

Comments
 (0)