From 02852185a86475737bb047a3abbd099a9274af08 Mon Sep 17 00:00:00 2001 From: "Rodwin.Spruel" Date: Thu, 24 Apr 2025 05:57:25 -0400 Subject: [PATCH] Fixing webp usage calculation and updating default value --- common/rfb/EncodeManager.cxx | 4 ++-- unix/kasmvnc_defaults.yaml | 24 ++++++++++++------------ unix/vncserver | 18 +++++++++++++++--- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 69142c0..cd855e9 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -395,8 +395,8 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, screenArea = pb->getRect().width() * pb->getRect().height(); screenArea *= 1024; screenArea /= 256 * 256; - screenArea *= screenArea; - screenArea /= Server::webpEncodingTime > 1 ? Server::webpEncodingTime : 1; + screenArea *= webpBenchResult; + screenArea /= Server::webpEncodingTime; // Encoding the entire screen would take this many 1024*msecs, worst case // Calculate how many us we can send webp for, before switching to jpeg diff --git a/unix/kasmvnc_defaults.yaml b/unix/kasmvnc_defaults.yaml index c4e2a03..1f042ee 100644 --- a/unix/kasmvnc_defaults.yaml +++ b/unix/kasmvnc_defaults.yaml @@ -37,7 +37,7 @@ user_session: keyboard: remap_keys: - # - 0x22->0x40 + # - 0x22->0x40 ignore_numlock: false raw_keyboard: false @@ -92,16 +92,16 @@ data_loss_prevention: enabled: true rate_limit: unlimited watermark: - # image: /etc/kasmvnc/picture.png - # location: 10,10 - # tint: 255,20,20,128 - # repeat_spacing: 10 - #text: - # template: "${USER} %H:%M" - # font: auto - # font_size: 48 - # timezone_name: Australia/Adelaide - # angle: 0 + # image: /etc/kasmvnc/picture.png + # location: 10,10 + # tint: 255,20,20,128 + # repeat_spacing: 10 + #text: + # template: "${USER} %H:%M" + # font: auto + # font_size: 48 + # timezone_name: Australia/Adelaide + # angle: 0 logging: # "verbose" SETTING LOGS YOUR PRIVATE INFORMATION. Keypresses and clipboard content level: off @@ -129,7 +129,7 @@ encoding: logging: level: off scaling_algorithm: progressive_bilinear - webp_encoding_time: 1 + webp_encoding_time: auto compare_framebuffer: auto zrle_zlib_level: auto diff --git a/unix/vncserver b/unix/vncserver index eb2695f..975d4a9 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -2069,13 +2069,25 @@ sub DefineConfigToCLIConversion { } }), KasmVNC::CliOption->new({ - name => 'webpEncodingTime', + name => 'WebpEncodingTime', configKeys => [ KasmVNC::ConfigKey->new({ name => "encoding.video_encoding_mode.webp_encoding_time", - type => KasmVNC::ConfigKey::INT + validator => KasmVNC::PatternValidator->new({ + pattern => qr/^(auto|[1-9][0-9]{0,2}|1000)$/, + errorMessage => "must be 'auto' or a number in 1..1000" + }), }) - ] + ], + deriveValueSub => sub { + my $self = shift; + my $value = $self->configValue(); + + if ($value eq "auto") { + $value = 1; + } + $value; + } }), KasmVNC::CliOption->new({ name => 'CompareFB',