Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Use is_multiple_of for frame size validation

Richie McIlroy9fe8c3dd7d2c
diff --git a/crates/recording/src/sources/microphone.rs b/crates/recording/src/sources/microphone.rs
index 5ff2aec4f..3bcd84022 100644
--- a/crates/recording/src/sources/microphone.rs
+++ b/crates/recording/src/sources/microphone.rs
@@ -94,7 +94,7 @@ fn downmix_to_mono(data: &[u8], format: SampleFormat, source_channels: usize) ->
let sample_size = sample_format_size(format)?;
let frame_size = sample_size.checked_mul(source_channels)?;
- if frame_size == 0 || data.len() % frame_size != 0 {
+ if frame_size == 0 || !data.len().is_multiple_of(frame_size) {
return None;
}