Skip to content

Commit

Permalink
Fix corruption at low latency.
Browse files Browse the repository at this point in the history
This fix was introduced to prevent an infinite timeout/loop problem that
resulted from certain edge cases in the dynamic resolution state
machine. However, further improvements have rendered this unnecessary.

An unintended side effect of this was disabling high-quality timing of
the shared memory, resulting in corruption issues.

Stress tested the resizing feature again without this, and it works
fine.
  • Loading branch information
Nexarian committed Jun 12, 2023
1 parent 72143c3 commit 2fac543
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions module/rdpClientCon.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,8 @@ rdpClientConProcessMsgClientInput(rdpPtr dev, rdpClientCon *clientCon)
cx = (param2 >> 16) & 0xffff;
cy = param2 & 0xffff;
clientCon->rect_id = 0;
clientCon->rect_id_ack = INT_MAX;
//clientCon->rect_id_ack = INT_MAX;
clientCon->rect_id_ack = 0;
LLOGLN(0, ("rdpClientConProcessMsgClientInput: invalidate x %d y %d "
"cx %d cy %d", x, y, cx, cy));
clientCon->shmemstatus = convertSharedMemoryStatusToActive(clientCon->shmemstatus);
Expand Down Expand Up @@ -2896,7 +2897,7 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg)
#define MIN_MS_BETWEEN_FRAMES 40
#define MS_TO_WAIT_FOR_RETRY_UPDATE 4
#define MIN_MS_TO_WAIT_FOR_MORE_UPDATES 1
#define UPDATE_RETRY_TIMEOUT 200 // After this number of retries, give up and perform the capture anyway. This prevents an infinite loop.
//#define UPDATE_RETRY_TIMEOUT 200 // After this number of retries, give up and perform the capture anyway. This prevents an infinite loop.

static void
rdpScheduleDeferredUpdate(rdpClientCon *clientCon, Bool can_call_now)
Expand All @@ -2905,12 +2906,12 @@ rdpScheduleDeferredUpdate(rdpClientCon *clientCon, Bool can_call_now)
uint32_t msToWait;
uint32_t minNextUpdateTime;

if (clientCon->updateRetries > UPDATE_RETRY_TIMEOUT) {
LLOGLN(10, ("rdpScheduleDeferredUpdate: clientCon->updateRetries is %d"
" and has exceeded the timeout of %d retries."
" Overriding rect_id_ack to INT_MAX.", clientCon->updateRetries, UPDATE_RETRY_TIMEOUT));
clientCon->rect_id_ack = INT_MAX;
}
// if (clientCon->updateRetries > UPDATE_RETRY_TIMEOUT) {
// LLOGLN(10, ("rdpScheduleDeferredUpdate: clientCon->updateRetries is %d"
// " and has exceeded the timeout of %d retries."
// " Overriding rect_id_ack to INT_MAX.", clientCon->updateRetries, UPDATE_RETRY_TIMEOUT));
// clientCon->rect_id_ack = INT_MAX;
// }

curTime = (uint32_t) GetTimeInMillis();
/* use two separate delays in order to limit the update rate and wait a bit
Expand Down

0 comments on commit 2fac543

Please sign in to comment.