Guacamole currently relies on approximating a value referred to as "processing lag" within libguac, which represents the amount of additional time a connect used spends handling a frame due to actual processing (image decoding, parsing the protocol, etc.). The idea here is to keep the server and client in sync, while still allowing the server to send updates to the client in an asynchronous manner. The client should stay offset from the server by a constant amount of time which is roughly equal to network lag, and that lag should not continually increase due to the server sending the client more data than it can process.
This calculation works well, except:
- The amount of time spent rendering the frame on the server is erroneously being taken into account, effectively doubling the estimate of lag for non-trivial frames.
- Bad timestamps sent from the client can result in the lag calculation overflowing into negative values, which are ultimately interpreted as an enormous positive amount of lag ("the user is 70 years behind - better wait for them to catch up!").
The calculation should be modified such that server time is excluded, and bad timestamps are not taken into account.