diff options
author | Antenore Gatta <antenore@simbiosi.org> | 2021-06-02 18:01:43 +0300 |
---|---|---|
committer | Antenore Gatta <antenore@simbiosi.org> | 2021-06-02 18:01:43 +0300 |
commit | 6c4806c46500f6b1727f2d470f2eb4b143712e82 (patch) | |
tree | 884726b44015bdd5a8d5a8540031a418af993d39 /plugins/rdp | |
parent | 0e042e582ff99c01c0e056e0bb133752ae5006f5 (diff) |
Explicitely set user resolution to a multiple of 4
Because of RDP and codecs speicifications, in most cases the window resolution
must be set as a multiple of 4, more over because of a not yet well identified
isse, width values of less then 642 causes issues, so we force the minimum resolution
to 644 when AVC:444 is in use.
Should fix #2507
Signed-off-by: Antenore Gatta <antenore@simbiosi.org>
Diffstat (limited to 'plugins/rdp')
-rw-r--r-- | plugins/rdp/rdp_plugin.c | 37 | ||||
-rw-r--r-- | plugins/rdp/rdp_plugin.h | 9 |
2 files changed, 31 insertions, 15 deletions
diff --git a/plugins/rdp/rdp_plugin.c b/plugins/rdp/rdp_plugin.c index 6b4b4409b..55f3ef67d 100644 --- a/plugins/rdp/rdp_plugin.c +++ b/plugins/rdp/rdp_plugin.c @@ -1353,22 +1353,29 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget *gp) rfi->bpp = 32; } - freerdp_settings_set_uint32(rfi->settings, FreeRDP_DesktopWidth, remmina_plugin_service->get_profile_remote_width(gp)); - freerdp_settings_set_uint32(rfi->settings, FreeRDP_DesktopHeight, remmina_plugin_service->get_profile_remote_height(gp)); + gint w = remmina_plugin_service->get_profile_remote_width(gp); + gint h = remmina_plugin_service->get_profile_remote_height(gp); + /* multiple of 4 */ + w = (w + 3) & ~0x3; + h = (h + 3) & ~0x3; + freerdp_settings_set_uint32(rfi->settings, FreeRDP_DesktopWidth, w); + freerdp_settings_set_uint32(rfi->settings, FreeRDP_DesktopHeight, h); + REMMINA_PLUGIN_DEBUG ("Resolution set by the user: %dx%d", w, h); /* Workaround for FreeRDP issue #5417: in GFX AVC modes we can't go under * AVC_MIN_DESKTOP_WIDTH x AVC_MIN_DESKTOP_HEIGHT */ - if (freerdp_settings_get_bool(rfi->settings, FreeRDP_SupportGraphicsPipeline) && freerdp_settings_get_bool(rfi->settings, FreeRDP_GfxH264)) { - if (freerdp_settings_get_uint32(rfi->settings, FreeRDP_DesktopWidth) < - AVC_MIN_DESKTOP_WIDTH) - freerdp_settings_set_uint32(rfi->settings, FreeRDP_DesktopWidth, - AVC_MIN_DESKTOP_WIDTH); - if (freerdp_settings_get_uint32(rfi->settings, - FreeRDP_DesktopHeight) < - AVC_MIN_DESKTOP_HEIGHT) - freerdp_settings_set_uint32(rfi->settings, FreeRDP_DesktopHeight, - AVC_MIN_DESKTOP_HEIGHT); - } + if (freerdp_settings_get_bool(rfi->settings, FreeRDP_SupportGraphicsPipeline) && + freerdp_settings_get_bool(rfi->settings, FreeRDP_GfxH264)) { + if (freerdp_settings_get_uint32(rfi->settings, FreeRDP_DesktopWidth) < + AVC_MIN_DESKTOP_WIDTH) + freerdp_settings_set_uint32(rfi->settings, FreeRDP_DesktopWidth, + AVC_MIN_DESKTOP_WIDTH); + if (freerdp_settings_get_uint32(rfi->settings, + FreeRDP_DesktopHeight) < + AVC_MIN_DESKTOP_HEIGHT) + freerdp_settings_set_uint32(rfi->settings, FreeRDP_DesktopHeight, + AVC_MIN_DESKTOP_HEIGHT); + } /* Workaround for FreeRDP issue #5119. This will make our horizontal resolution * an even value, but it will add a vertical black 1 pixel line on the @@ -1381,6 +1388,10 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget *gp) remmina_plugin_service->protocol_plugin_set_width(gp, freerdp_settings_get_uint32(rfi->settings, FreeRDP_DesktopWidth)); remmina_plugin_service->protocol_plugin_set_height(gp, freerdp_settings_get_uint32(rfi->settings, FreeRDP_DesktopHeight)); + w = freerdp_settings_get_uint32(rfi->settings, FreeRDP_DesktopWidth); + h = freerdp_settings_get_uint32(rfi->settings, FreeRDP_DesktopHeight); + REMMINA_PLUGIN_DEBUG ("Resolution set after workarounds: %dx%d", w, h); + if (remmina_plugin_service->file_get_string(remminafile, "username")) freerdp_settings_set_string(rfi->settings, FreeRDP_Username, remmina_plugin_service->file_get_string(remminafile, "username")); diff --git a/plugins/rdp/rdp_plugin.h b/plugins/rdp/rdp_plugin.h index 7e918e446..8cbf5d332 100644 --- a/plugins/rdp/rdp_plugin.h +++ b/plugins/rdp/rdp_plugin.h @@ -69,8 +69,13 @@ (FREERDP_VERSION_MAJOR == (major) && FREERDP_VERSION_MINOR == (minor) && \ FREERDP_VERSION_REVISION >= (revision))) -/* Constants to workaround FreeRDP issue #5417 (min resolution in AVC mode) */ -#define AVC_MIN_DESKTOP_WIDTH 642 +/** + * Constants to workaround FreeRDP issue #5417 (min resolution in AVC mode) + * Must be 4 aligned (multiple of 4). + * We should instead check destRect and be sure the condition is met + * See https://gitlab.com/Remmina/Remmina/-/issues/2507 for a deep discussion + */ +#define AVC_MIN_DESKTOP_WIDTH 644 #define AVC_MIN_DESKTOP_HEIGHT 480 typedef struct rf_context rfContext; |