Skip to content

Commit 9fe8c3d

Browse files
committed
Use is_multiple_of for frame size validation
1 parent 4d6a3c8 commit 9fe8c3d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/recording/src/sources/microphone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn downmix_to_mono(data: &[u8], format: SampleFormat, source_channels: usize) ->
9494
let sample_size = sample_format_size(format)?;
9595

9696
let frame_size = sample_size.checked_mul(source_channels)?;
97-
if frame_size == 0 || data.len() % frame_size != 0 {
97+
if frame_size == 0 || !data.len().is_multiple_of(frame_size) {
9898
return None;
9999
}
100100

0 commit comments

Comments
 (0)