jmuehlner commented on code in PR #363:
URL: https://github.com/apache/guacamole-server/pull/363#discussion_r891653653
##########
src/protocols/rdp/gdi.c:
##########
@@ -371,9 +372,110 @@ BOOL guac_rdp_gdi_set_bounds(rdpContext* context, const
rdpBounds* bounds) {
}
+void guac_rdp_gdi_mark_frame(rdpContext* context, int starting) {
+
+ guac_client* client = ((rdp_freerdp_context*) context)->client;
+ guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
+
+ /* The server supports defining explicit frames */
+ rdp_client->frames_supported = 1;
+
+ /* A new frame is beginning */
+ if (starting) {
+ rdp_client->in_frame = 1;
+ return;
+ }
+
+ /* The current frame has ended */
+ guac_timestamp frame_end = guac_timestamp_current();
+ int time_elapsed = frame_end - client->last_sent_timestamp;
+ rdp_client->in_frame = 0;
+
+ /* A new frame has been received from the RDP server and processed */
+ rdp_client->frames_received++;
+
+ /* Flush a new frame if the client is ready for it */
+ if (time_elapsed >= guac_client_get_processing_lag(client)) {
+ guac_common_display_flush(rdp_client->display);
+ guac_client_end_multiple_frames(client, rdp_client->frames_received);
+ guac_socket_flush(client->socket);
+ rdp_client->frames_received = 0;
+ }
+
+}
+
+BOOL guac_rdp_gdi_frame_marker(rdpContext* context, const FRAME_MARKER_ORDER*
frame_marker) {
+ guac_rdp_gdi_mark_frame(context, frame_marker->action == FRAME_START);
+ return TRUE;
+}
+
+BOOL guac_rdp_gdi_surface_frame_marker(rdpContext* context, const
SURFACE_FRAME_MARKER* surface_frame_marker) {
+
+ guac_rdp_gdi_mark_frame(context, surface_frame_marker->frameAction ==
SURFACECMD_FRAMEACTION_END);
+
+ if (context->settings->FrameAcknowledge > 0)
+ IFCALL(context->update->SurfaceFrameAcknowledge, context,
+ surface_frame_marker->frameId);
+
+ return TRUE;
+
+}
+
+BOOL guac_rdp_gdi_begin_paint(rdpContext* context) {
+
+ guac_client* client = ((rdp_freerdp_context*) context)->client;
+ guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
+
+ /* Leverage BeginPaint handler to detect start of frame for RDPGFX channel
*/
+ if (rdp_client->settings->enable_gfx && rdp_client->frames_supported)
+ guac_rdp_gdi_mark_frame(context, 1);
+
+ return TRUE;
+
+}
+
BOOL guac_rdp_gdi_end_paint(rdpContext* context) {
- /* IGNORE */
+
+ guac_client* client = ((rdp_freerdp_context*) context)->client;
+ guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
+ rdpGdi* gdi = context->gdi;
+
+ /* Ignore EndPaint handler unless needed to detect end of frame for RDPGFX
+ * channel */
+ if (!rdp_client->settings->enable_gfx)
+ return TRUE;
+
+ /* Ignore paint if GDI output is suppressed */
+ if (gdi->suppressOutput)
+ return TRUE;
+
+ /* Ignore paint if nothing has been done (empty rect) */
+ if (gdi->primary->hdc->hwnd->invalid->null)
Review Comment:
`invalid`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]