[gnome-remote-desktop] session-rdp: Add API to encode pending frame for RDP surface
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] session-rdp: Add API to encode pending frame for RDP surface
- Date: Fri, 3 Sep 2021 09:34:42 +0000 (UTC)
commit a52926933cdc015d614aa27617791640eea9b793
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Fri Mar 19 18:06:24 2021 +0100
session-rdp: Add API to encode pending frame for RDP surface
Currently, gnome-remote-desktop encodes all pending frame data upon the
end of the SuppressOutput PDU.
When using the graphics pipeline, gnome-remote-desktop needs to be able
to control the rate of the encodings.
This means: gnome-remote-desktop needs to be able to suspend the
encoding and continue it later.
This is the case, when the client is too slow with the decoding.
In that case, gnome-remote-desktop needs to immediately stop the
encoding to not flood the client with too much new frame content.
When the client acked enough pending frames, continue the encoding
process.
To be able to do that, add an API to encode the pending frame of an RDP
surface.
src/grd-session-rdp.c | 38 +++++++++++++++++++++++---------------
src/grd-session-rdp.h | 3 +++
2 files changed, 26 insertions(+), 15 deletions(-)
---
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index cc0f9f0..d910ff1 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -287,6 +287,28 @@ grd_session_rdp_take_buffer (GrdSessionRdp *session_rdp,
}
}
+void
+grd_session_rdp_maybe_encode_pending_frame (GrdSessionRdp *session_rdp,
+ GrdRdpSurface *rdp_surface)
+{
+ RdpPeerContext *rdp_peer_context;
+
+ g_assert (session_rdp->peer);
+ g_assert (session_rdp->peer->context);
+
+ rdp_peer_context = (RdpPeerContext *) session_rdp->peer->context;
+ if (!is_rdp_peer_flag_set (rdp_peer_context, RDP_PEER_ACTIVATED) ||
+ !is_rdp_peer_flag_set (rdp_peer_context, RDP_PEER_OUTPUT_ENABLED))
+ return;
+
+ if (!rdp_surface->pending_frame)
+ return;
+
+ grd_session_rdp_take_buffer (session_rdp,
+ g_steal_pointer (&rdp_surface->pending_frame),
+ rdp_surface->width, rdp_surface->height);
+}
+
static gboolean
is_mouse_pointer_hidden (uint32_t width,
uint32_t height,
@@ -1950,24 +1972,10 @@ static gboolean
encode_pending_frames (gpointer user_data)
{
GrdSessionRdp *session_rdp = user_data;
- RdpPeerContext *rdp_peer_context;
GrdRdpSurface *rdp_surface;
- g_assert (session_rdp->peer);
- g_assert (session_rdp->peer->context);
-
- rdp_peer_context = (RdpPeerContext *) session_rdp->peer->context;
- if (!is_rdp_peer_flag_set (rdp_peer_context, RDP_PEER_ACTIVATED) ||
- !is_rdp_peer_flag_set (rdp_peer_context, RDP_PEER_OUTPUT_ENABLED))
- return G_SOURCE_CONTINUE;
-
rdp_surface = session_rdp->rdp_surface;
- if (!rdp_surface->pending_frame)
- return G_SOURCE_CONTINUE;
-
- grd_session_rdp_take_buffer (session_rdp,
- g_steal_pointer (&rdp_surface->pending_frame),
- rdp_surface->width, rdp_surface->height);
+ grd_session_rdp_maybe_encode_pending_frame (session_rdp, rdp_surface);
return G_SOURCE_CONTINUE;
}
diff --git a/src/grd-session-rdp.h b/src/grd-session-rdp.h
index 454f883..64c4a5b 100644
--- a/src/grd-session-rdp.h
+++ b/src/grd-session-rdp.h
@@ -47,6 +47,9 @@ void grd_session_rdp_take_buffer (GrdSessionRdp *session_rdp,
uint16_t width,
uint16_t height);
+void grd_session_rdp_maybe_encode_pending_frame (GrdSessionRdp *session_rdp,
+ GrdRdpSurface *rdp_surface);
+
void grd_session_rdp_update_pointer (GrdSessionRdp *session_rdp,
uint16_t hotspot_x,
uint16_t hotspot_y,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]