We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a6e10d commit 76b18c5Copy full SHA for 76b18c5
src/host/alsa/mod.rs
@@ -1193,9 +1193,10 @@ impl StreamTrait for Stream {
1193
}
1194
1195
1196
-// Overly safe clamp because alsa Frames are i64 (64-bit) or i32 (32-bit)
+// Convert ALSA frames to FrameCount, clamping to valid range.
1197
+// ALSA Frames are i64 (64-bit) or i32 (32-bit).
1198
fn clamp_frame_count(buffer_size: alsa::pcm::Frames) -> FrameCount {
- buffer_size.clamp(1, FrameCount::MAX as alsa::pcm::Frames) as FrameCount
1199
+ buffer_size.max(1).try_into().unwrap_or(FrameCount::MAX)
1200
1201
1202
fn hw_params_buffer_size_min_max(hw_params: &alsa::pcm::HwParams) -> (FrameCount, FrameCount) {
0 commit comments