GUACAMOLE-377: Leverage client timestamp tracking for RDP frame duration.

This commit is contained in:
Michael Jumper 2021-09-02 20:53:52 -07:00
parent bde8cdee46
commit a0e9f6ed9b
3 changed files with 2 additions and 23 deletions

View File

@ -388,7 +388,7 @@ void guac_rdp_gdi_mark_frame(rdpContext* context, int starting) {
/* The current frame has ended */ /* The current frame has ended */
guac_timestamp frame_end = guac_timestamp_current(); guac_timestamp frame_end = guac_timestamp_current();
int time_elapsed = frame_end - rdp_client->frame_start; int time_elapsed = frame_end - client->last_sent_timestamp;
rdp_client->in_frame = 0; rdp_client->in_frame = 0;
/* A new frame has been received from the RDP server and processed */ /* A new frame has been received from the RDP server and processed */
@ -396,14 +396,10 @@ void guac_rdp_gdi_mark_frame(rdpContext* context, int starting) {
/* Flush a new frame if the client is ready for it */ /* Flush a new frame if the client is ready for it */
if (time_elapsed >= guac_client_get_processing_lag(client)) { if (time_elapsed >= guac_client_get_processing_lag(client)) {
guac_common_display_flush(rdp_client->display); guac_common_display_flush(rdp_client->display);
guac_client_end_multiple_frames(client, rdp_client->frames_received); guac_client_end_multiple_frames(client, rdp_client->frames_received);
guac_socket_flush(client->socket); guac_socket_flush(client->socket);
rdp_client->frame_start = frame_end;
rdp_client->frames_received = 0; rdp_client->frames_received = 0;
} }
} }

View File

@ -534,7 +534,6 @@ static int guac_rdp_handle_connection(guac_client* client) {
rdp_client->rdp_inst = rdp_inst; rdp_client->rdp_inst = rdp_inst;
guac_timestamp last_frame_end = guac_timestamp_current(); guac_timestamp last_frame_end = guac_timestamp_current();
rdp_client->frame_start = guac_timestamp_current();
/* Signal that reconnect has been completed */ /* Signal that reconnect has been completed */
guac_rdp_disp_reconnect_complete(rdp_client->disp); guac_rdp_disp_reconnect_complete(rdp_client->disp);
@ -554,7 +553,6 @@ static int guac_rdp_handle_connection(guac_client* client) {
if (wait_result > 0) { if (wait_result > 0) {
int processing_lag = guac_client_get_processing_lag(client); int processing_lag = guac_client_get_processing_lag(client);
guac_timestamp frame_start = guac_timestamp_current();
/* Read server messages until frame is built */ /* Read server messages until frame is built */
do { do {
@ -582,6 +580,7 @@ static int guac_rdp_handle_connection(guac_client* client) {
} }
/* Calculate time remaining in frame */ /* Calculate time remaining in frame */
guac_timestamp frame_start = client->last_sent_timestamp;
frame_end = guac_timestamp_current(); frame_end = guac_timestamp_current();
frame_remaining = frame_start + GUAC_RDP_FRAME_DURATION frame_remaining = frame_start + GUAC_RDP_FRAME_DURATION
- frame_end; - frame_end;
@ -604,12 +603,6 @@ static int guac_rdp_handle_connection(guac_client* client) {
} while (wait_result > 0); } while (wait_result > 0);
/* Record end of frame, excluding server-side rendering time (we
* assume server-side rendering time will be consistent between any
* two subsequent frames, and that this time should thus be
* excluded from the required wait period of the next frame). */
last_frame_end = frame_start;
} }
/* Test whether the RDP server is closing the connection */ /* Test whether the RDP server is closing the connection */
@ -630,8 +623,6 @@ static int guac_rdp_handle_connection(guac_client* client) {
guac_common_display_flush(rdp_client->display); guac_common_display_flush(rdp_client->display);
guac_client_end_multiple_frames(client, rdp_client->frames_received); guac_client_end_multiple_frames(client, rdp_client->frames_received);
guac_socket_flush(client->socket); guac_socket_flush(client->socket);
rdp_client->frame_start = guac_timestamp_current();
rdp_client->frames_received = 0; rdp_client->frames_received = 0;
} }

View File

@ -109,14 +109,6 @@ typedef struct guac_rdp_client {
*/ */
int frames_received; int frames_received;
/**
* The server timestamp of the end of the last frame received from the RDP
* server, as returned by guac_timestamp_current(), if the RDP server
* supports reporting frame boundaries. If the RDP server does not support
* tracking frames, this will be zero.
*/
guac_timestamp frame_start;
/** /**
* The current state of the keyboard with respect to the RDP session. * The current state of the keyboard with respect to the RDP session.
*/ */