Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-1760: Add guacd support for setting VNC compression and quality. #503

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/protocols/vnc/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ const char* GUAC_VNC_CLIENT_ARGS[] = {
"wol-wait-time",

"force-lossless",
"compress-level",
"quality-level",
NULL
};

Expand Down Expand Up @@ -389,6 +391,18 @@ enum VNC_ARGS_IDX {
*/
IDX_FORCE_LOSSLESS,

/**
* The level of compression, on a scale of 0 (no compression) to 9 (maximum
* compression), that the connection will be configured for.
*/
IDX_COMPRESS_LEVEL,

/**
* The level of display quality, on a scale of 0 (worst quality) to 9 (best
* quality), that the connection will be configured for.
*/
IDX_QUALITY_LEVEL,

VNC_ARGS_COUNT
};

Expand Down Expand Up @@ -453,6 +467,16 @@ guac_vnc_settings* guac_vnc_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv,
IDX_FORCE_LOSSLESS, false);

/* Compression level */
settings->compress_level =
guac_user_parse_args_int(user, GUAC_VNC_CLIENT_ARGS, argv,
IDX_COMPRESS_LEVEL, -1);

/* Display quality */
settings->quality_level =
guac_user_parse_args_int(user, GUAC_VNC_CLIENT_ARGS, argv,
IDX_QUALITY_LEVEL, -1);

#ifdef ENABLE_VNC_REPEATER
/* Set repeater parameters if specified */
settings->dest_host =
Expand Down
10 changes: 10 additions & 0 deletions src/protocols/vnc/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ typedef struct guac_vnc_settings {
*/
bool lossless;

/**
* The level of compression to ask the VNC client library to perform.
*/
int compress_level;

/**
* The quality level to ask the VNC client library to maintain.
*/
int quality_level;

#ifdef ENABLE_VNC_REPEATER
/**
* The VNC host to connect to, if using a repeater.
Expand Down
7 changes: 7 additions & 0 deletions src/protocols/vnc/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,13 @@ void* guac_vnc_client_thread(void* data) {
* heuristics) */
guac_common_display_set_lossless(vnc_client->display, settings->lossless);

/* If compression and display quality have been configured, set those. */
if (settings->compress_level >= 0 && settings->compress_level <= 9)
rfb_client->appData.compressLevel = settings->compress_level;

if (settings->quality_level >= 0 && settings->quality_level <= 9)
rfb_client->appData.qualityLevel = settings->quality_level;

/* If not read-only, set an appropriate cursor */
if (settings->read_only == 0) {
if (settings->remote_cursor)
Expand Down
Loading