[gnome-remote-desktop] rdp: Add initial support for autodetecting network characteristics
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] rdp: Add initial support for autodetecting network characteristics
- Date: Fri, 3 Sep 2021 09:34:43 +0000 (UTC)
commit 1224260d0ed559da53cab076f1ab40d022b57772
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Mon May 31 15:46:31 2021 +0200
rdp: Add initial support for autodetecting network characteristics
Add support for autodetecting network characteristics using the
previously implemented class.
When the graphics pipeline is being used, add the graphics pipeline as
RTT consumer to ensure a smooth experience even on high latencies.
When the SuppressOutput PDU is received, there won't be any reason to
emit RTTRequests, as no frame updates will happen.
In that case, remove the graphics pipeline as RTT consumer, until the
SuppressOutput PDU allows gnome-remote-desktop to send frame updates
again.
src/grd-session-rdp.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
---
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index f4c68ec..3ee9313 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -33,6 +33,7 @@
#include "grd-damage-utils.h"
#include "grd-rdp-event-queue.h"
#include "grd-rdp-graphics-pipeline.h"
+#include "grd-rdp-network-autodetection.h"
#include "grd-rdp-pipewire-stream.h"
#include "grd-rdp-private.h"
#include "grd-rdp-sam.h"
@@ -1500,12 +1501,30 @@ rdp_suppress_output (rdpContext *rdp_context,
{
RdpPeerContext *rdp_peer_context = (RdpPeerContext *) rdp_context;
GrdSessionRdp *session_rdp = rdp_peer_context->session_rdp;
+ rdpSettings *rdp_settings = session_rdp->peer->settings;
if (allow)
set_rdp_peer_flag (session_rdp, RDP_PEER_OUTPUT_ENABLED);
else
unset_rdp_peer_flag (session_rdp, RDP_PEER_OUTPUT_ENABLED);
+ if (rdp_settings->SupportGraphicsPipeline &&
+ rdp_peer_context->network_autodetection)
+ {
+ if (allow)
+ {
+ grd_rdp_network_autodetection_ensure_rtt_consumer (
+ rdp_peer_context->network_autodetection,
+ GRD_RDP_NW_AUTODETECT_RTT_CONSUMER_RDPGFX);
+ }
+ else
+ {
+ grd_rdp_network_autodetection_remove_rtt_consumer (
+ rdp_peer_context->network_autodetection,
+ GRD_RDP_NW_AUTODETECT_RTT_CONSUMER_RDPGFX);
+ }
+ }
+
if (allow)
g_source_set_ready_time (session_rdp->pending_encode_source, 0);
@@ -1582,6 +1601,20 @@ rdp_peer_post_connect (freerdp_peer *peer)
session_rdp->rdp_surface = g_malloc0 (sizeof (GrdRdpSurface));
session_rdp->rdp_surface->refresh_rate = 30;
+ if (rdp_settings->SupportGraphicsPipeline &&
+ !rdp_settings->NetworkAutoDetect)
+ {
+ g_warning ("Client does not support autodetecting network characteristics "
+ "(RTT detection, Bandwidth measurement). "
+ "High latency connections will suffer!");
+ }
+
+ if (rdp_settings->NetworkAutoDetect)
+ {
+ rdp_peer_context->network_autodetection =
+ grd_rdp_network_autodetection_new (peer->context);
+ }
+
if (rdp_settings->SupportGraphicsPipeline)
{
set_rdp_peer_flag (session_rdp, RDP_PEER_PENDING_GFX_INIT);
@@ -1600,6 +1633,14 @@ rdp_peer_post_connect (freerdp_peer *peer)
sam_file = g_steal_pointer (&session_rdp->sam_file);
grd_rdp_sam_maybe_close_and_free_sam_file (sam_file);
+ if (rdp_settings->SupportGraphicsPipeline &&
+ rdp_peer_context->network_autodetection)
+ {
+ grd_rdp_network_autodetection_ensure_rtt_consumer (
+ rdp_peer_context->network_autodetection,
+ GRD_RDP_NW_AUTODETECT_RTT_CONSUMER_RDPGFX);
+ }
+
set_rdp_peer_flag (session_rdp, RDP_PEER_OUTPUT_ENABLED);
set_rdp_peer_flag (session_rdp, RDP_PEER_ACTIVATED);
@@ -1623,6 +1664,14 @@ rdp_peer_activate (freerdp_peer *peer)
"Closing connection");
return FALSE;
}
+ if (rdp_peer_context->network_autodetection &&
+ !rdp_settings->NetworkAutoDetect)
+ {
+ g_warning ("Client disabled support for network autodetection during the "
+ "Deactivation-Reactivation sequence. This is not supported. "
+ "Closing connection");
+ return FALSE;
+ }
set_rdp_peer_flag (session_rdp, RDP_PEER_ALL_SURFACES_INVALID);
@@ -1722,6 +1771,7 @@ init_rdp_session (GrdSessionRdp *session_rdp,
rdp_settings->GfxThinClient = FALSE;
rdp_settings->HasExtendedMouseEvent = TRUE;
rdp_settings->HasHorizontalWheel = TRUE;
+ rdp_settings->NetworkAutoDetect = TRUE;
rdp_settings->RefreshRect = TRUE;
rdp_settings->RemoteFxCodec = TRUE;
rdp_settings->SupportGraphicsPipeline = TRUE;
@@ -1934,6 +1984,12 @@ grd_session_rdp_stop (GrdSession *session)
freerdp_set_error_info (peer->context->rdp, session_rdp->rdp_error_info);
}
+ if (rdp_peer_context->network_autodetection)
+ {
+ grd_rdp_network_autodetection_invoke_shutdown (
+ rdp_peer_context->network_autodetection);
+ }
+
g_clear_object (&session_rdp->pipewire_stream);
g_clear_object (&rdp_peer_context->clipboard_rdp);
@@ -1947,6 +2003,8 @@ grd_session_rdp_stop (GrdSession *session)
if (session_rdp->sam_file)
grd_rdp_sam_maybe_close_and_free_sam_file (session_rdp->sam_file);
+ g_clear_object (&rdp_peer_context->network_autodetection);
+
if (session_rdp->thread_pool)
g_thread_pool_free (session_rdp->thread_pool, FALSE, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]