mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-06-27 13:11:30 +02:00
Merge branch 'feature/KASM-7125-fixing-webp-encoding' into 'master'
Adding ability to override webp benchmark value Closes KASM-7125 See merge request kasm-technologies/internal/KasmVNC!174
This commit is contained in:
commit
8e9edb7d4e
@ -76,6 +76,9 @@ if [ ! -d unix/xserver/include ]; then
|
|||||||
patch -s -p0 < ../CVE-2022-2320-v1.19.patch
|
patch -s -p0 < ../CVE-2022-2320-v1.19.patch
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
else
|
||||||
|
cd unix/xserver
|
||||||
|
fi
|
||||||
|
|
||||||
autoreconf -i
|
autoreconf -i
|
||||||
# Configuring Xorg is long and has many distro-specific paths.
|
# Configuring Xorg is long and has many distro-specific paths.
|
||||||
@ -114,7 +117,7 @@ if [ ! -d unix/xserver/include ]; then
|
|||||||
|
|
||||||
# remove array bounds errors for new versions of GCC
|
# remove array bounds errors for new versions of GCC
|
||||||
find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \;
|
find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \;
|
||||||
fi
|
|
||||||
|
|
||||||
make -j"$(nproc)"
|
make -j"$(nproc)"
|
||||||
|
|
||||||
|
@ -360,7 +360,6 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_,
|
|||||||
int nRects;
|
int nRects;
|
||||||
Region changed, cursorRegion;
|
Region changed, cursorRegion;
|
||||||
struct timeval start;
|
struct timeval start;
|
||||||
unsigned screenArea;
|
|
||||||
|
|
||||||
updates++;
|
updates++;
|
||||||
if (conn->cp.supportsUdp)
|
if (conn->cp.supportsUdp)
|
||||||
@ -390,16 +389,7 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_,
|
|||||||
memset(&webpstats, 0, sizeof(codecstats_t));
|
memset(&webpstats, 0, sizeof(codecstats_t));
|
||||||
|
|
||||||
if (allowLossy && activeEncoders[encoderFullColour] == encoderTightWEBP) {
|
if (allowLossy && activeEncoders[encoderFullColour] == encoderTightWEBP) {
|
||||||
const unsigned rate = 1024 * 1000 / rfb::Server::frameRate;
|
webpFallbackUs = (1000 * 1000 / rfb::Server::frameRate) * (static_cast<double>(Server::webpEncodingTime) / 100.0);
|
||||||
|
|
||||||
screenArea = pb->getRect().width() * pb->getRect().height();
|
|
||||||
screenArea *= 1024;
|
|
||||||
screenArea /= 256 * 256;
|
|
||||||
screenArea *= webpBenchResult;
|
|
||||||
// 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
|
|
||||||
webpFallbackUs = rate * rate / screenArea;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -883,7 +873,7 @@ void EncodeManager::findSolidRect(const Rect& rect, Region *changed,
|
|||||||
void EncodeManager::checkWebpFallback(const timeval *start) {
|
void EncodeManager::checkWebpFallback(const timeval *start) {
|
||||||
// Have we taken too long for the frame? If so, drop from WEBP to JPEG
|
// Have we taken too long for the frame? If so, drop from WEBP to JPEG
|
||||||
if (start && activeEncoders[encoderFullColour] == encoderTightWEBP && !webpTookTooLong.load(std::memory_order_relaxed)) {
|
if (start && activeEncoders[encoderFullColour] == encoderTightWEBP && !webpTookTooLong.load(std::memory_order_relaxed)) {
|
||||||
const auto us = msSince(start) * 1024;
|
const auto us = msSince(start) * 1000;
|
||||||
if (us > webpFallbackUs)
|
if (us > webpFallbackUs)
|
||||||
webpTookTooLong.store(true, std::memory_order_relaxed);
|
webpTookTooLong.store(true, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
@ -287,3 +287,8 @@ rfb::PresetParameter rfb::Server::preferBandwidth
|
|||||||
("PreferBandwidth",
|
("PreferBandwidth",
|
||||||
"Set various options for lower bandwidth use. The default is off, aka to prefer quality.",
|
"Set various options for lower bandwidth use. The default is off, aka to prefer quality.",
|
||||||
false, bandwidthPreset);
|
false, bandwidthPreset);
|
||||||
|
|
||||||
|
rfb::IntParameter rfb::Server::webpEncodingTime
|
||||||
|
("webpEncodingTime",
|
||||||
|
"Percentage of time allotted for encoding a frame, that can be used for encoding rects in webp.",
|
||||||
|
30, 0, 100);
|
||||||
|
@ -91,6 +91,7 @@ namespace rfb {
|
|||||||
static BoolParameter ignoreClientSettingsKasm;
|
static BoolParameter ignoreClientSettingsKasm;
|
||||||
static BoolParameter selfBench;
|
static BoolParameter selfBench;
|
||||||
static PresetParameter preferBandwidth;
|
static PresetParameter preferBandwidth;
|
||||||
|
static IntParameter webpEncodingTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -259,13 +259,14 @@ void TightWEBPEncoder::writeRect(const PixelBuffer* pb, const Palette& palette)
|
|||||||
WebPMemoryWriterClear(&wrt);
|
WebPMemoryWriterClear(&wrt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// How many milliseconds would it take to encode a 256x256 block at quality 8
|
// How many milliseconds would it take to encode a 256x256 block at quality 5
|
||||||
rdr::U32 TightWEBPEncoder::benchmark() const
|
rdr::U32 TightWEBPEncoder::benchmark() const
|
||||||
{
|
{
|
||||||
rdr::U8* buffer;
|
rdr::U8* buffer;
|
||||||
struct timeval start;
|
struct timeval start;
|
||||||
int stride, i;
|
int stride, i;
|
||||||
const uint8_t quality = 8, method = 2;
|
// the minimum WebP quality settings used in KasmVNC
|
||||||
|
const uint8_t quality = 5, method = 0;
|
||||||
WebPConfig cfg;
|
WebPConfig cfg;
|
||||||
WebPPicture pic;
|
WebPPicture pic;
|
||||||
WebPMemoryWriter wrt;
|
WebPMemoryWriter wrt;
|
||||||
|
@ -129,6 +129,7 @@ encoding:
|
|||||||
logging:
|
logging:
|
||||||
level: off
|
level: off
|
||||||
scaling_algorithm: progressive_bilinear
|
scaling_algorithm: progressive_bilinear
|
||||||
|
webp_encoding_time: 30
|
||||||
|
|
||||||
compare_framebuffer: auto
|
compare_framebuffer: auto
|
||||||
zrle_zlib_level: auto
|
zrle_zlib_level: auto
|
||||||
|
@ -2068,6 +2068,15 @@ sub DefineConfigToCLIConversion {
|
|||||||
$value;
|
$value;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
KasmVNC::CliOption->new({
|
||||||
|
name => 'WebpEncodingTime',
|
||||||
|
configKeys => [
|
||||||
|
KasmVNC::ConfigKey->new({
|
||||||
|
name => "encoding.video_encoding_mode.webp_encoding_time",
|
||||||
|
type => KasmVNC::ConfigKey::INT
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}),
|
||||||
KasmVNC::CliOption->new({
|
KasmVNC::CliOption->new({
|
||||||
name => 'CompareFB',
|
name => 'CompareFB',
|
||||||
configKeys => [
|
configKeys => [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user