Skip to content

Commit 8ef3ebd

Browse files
committed
fix(enc-avfoundation): use clamp instead of max/min for ultra bitrate
Made-with: Cursor
1 parent 8fb4065 commit 8ef3ebd

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

  • crates/enc-avfoundation/src

crates/enc-avfoundation/src/mp4.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,9 +982,7 @@ fn get_average_bitrate(width: f32, height: f32, fps: f32) -> f32 {
982982
fn get_ultra_bitrate(width: f32, height: f32, fps: f32) -> f32 {
983983
let pixels = width * height;
984984
let fps_factor = fps.min(60.0) / 30.0;
985-
(pixels * fps_factor * 10.0)
986-
.max(MIN_STUDIO_BITRATE)
987-
.min(MAX_ULTRA_BITRATE)
985+
(pixels * fps_factor * 10.0).clamp(MIN_STUDIO_BITRATE, MAX_ULTRA_BITRATE)
988986
}
989987

990988
fn get_instant_mode_bitrate(width: f32, height: f32, fps: f32) -> f32 {

0 commit comments

Comments
 (0)