diff --git a/libs/scrap/src/common/codec.rs b/libs/scrap/src/common/codec.rs index 5a04cfacc..d2c53c7e9 100644 --- a/libs/scrap/src/common/codec.rs +++ b/libs/scrap/src/common/codec.rs @@ -267,13 +267,21 @@ impl Encoder { .unwrap_or((PreferCodec::Auto.into(), 0)); let preference = most_frequent.enum_value_or(PreferCodec::Auto); - #[allow(unused_mut)] + // auto: h265 > h264 > vp9/vp8 let mut auto_codec = CodecFormat::VP9; - let mut system = System::new(); - system.refresh_memory(); - if vp8_useable && system.total_memory() <= 4 * 1024 * 1024 * 1024 { - // 4 Gb - auto_codec = CodecFormat::VP8 + if h264_useable { + auto_codec = CodecFormat::H264; + } + if h265_useable { + auto_codec = CodecFormat::H265; + } + if auto_codec == CodecFormat::VP9 { + let mut system = System::new(); + system.refresh_memory(); + if vp8_useable && system.total_memory() <= 4 * 1024 * 1024 * 1024 { + // 4 Gb + auto_codec = CodecFormat::VP8 + } } *format = match preference {