Fixing webp usage calculation and updating default value

This commit is contained in:
Rodwin.Spruel 2025-04-24 05:57:25 -04:00
parent f674e2c58d
commit 02852185a8
No known key found for this signature in database
GPG Key ID: 732BE68DCA2B69CA
3 changed files with 29 additions and 17 deletions

View File

@ -395,8 +395,8 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_,
screenArea = pb->getRect().width() * pb->getRect().height(); screenArea = pb->getRect().width() * pb->getRect().height();
screenArea *= 1024; screenArea *= 1024;
screenArea /= 256 * 256; screenArea /= 256 * 256;
screenArea *= screenArea; screenArea *= webpBenchResult;
screenArea /= Server::webpEncodingTime > 1 ? Server::webpEncodingTime : 1; screenArea /= Server::webpEncodingTime;
// Encoding the entire screen would take this many 1024*msecs, worst case // 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 // Calculate how many us we can send webp for, before switching to jpeg

View File

@ -129,7 +129,7 @@ encoding:
logging: logging:
level: off level: off
scaling_algorithm: progressive_bilinear scaling_algorithm: progressive_bilinear
webp_encoding_time: 1 webp_encoding_time: auto
compare_framebuffer: auto compare_framebuffer: auto
zrle_zlib_level: auto zrle_zlib_level: auto

View File

@ -2069,13 +2069,25 @@ sub DefineConfigToCLIConversion {
} }
}), }),
KasmVNC::CliOption->new({ KasmVNC::CliOption->new({
name => 'webpEncodingTime', name => 'WebpEncodingTime',
configKeys => [ configKeys => [
KasmVNC::ConfigKey->new({ KasmVNC::ConfigKey->new({
name => "encoding.video_encoding_mode.webp_encoding_time", 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({ KasmVNC::CliOption->new({
name => 'CompareFB', name => 'CompareFB',