Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

auto codec, h265 > h264 > vp9/vp8 (#8032)

21pages7e09809ad80a
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 {