GUACAMOLE-172: Ignore insane timestamps when calculating lag.
This commit is contained in:
parent
234f98705e
commit
6131ad0341
@ -95,6 +95,9 @@ int __guac_handle_sync(guac_user* user, int argc, char** argv) {
|
||||
if (timestamp > user->client->last_sent_timestamp)
|
||||
return -1;
|
||||
|
||||
/* Only update lag calculations if timestamp is sane */
|
||||
if (timestamp >= user->last_received_timestamp) {
|
||||
|
||||
/* Update stored timestamp */
|
||||
user->last_received_timestamp = timestamp;
|
||||
|
||||
@ -107,7 +110,8 @@ int __guac_handle_sync(guac_user* user, int argc, char** argv) {
|
||||
/* Calculate lag using the previous frame as a baseline */
|
||||
int processing_lag = frame_duration - user->last_frame_duration;
|
||||
|
||||
/* Adjust back to zero if cumulative error leads to a negative value */
|
||||
/* Adjust back to zero if cumulative error leads to a negative
|
||||
* value */
|
||||
if (processing_lag < 0)
|
||||
processing_lag = 0;
|
||||
|
||||
@ -118,6 +122,8 @@ int __guac_handle_sync(guac_user* user, int argc, char** argv) {
|
||||
/* Record baseline duration of frame by excluding lag */
|
||||
user->last_frame_duration = frame_duration - user->processing_lag;
|
||||
|
||||
}
|
||||
|
||||
if (user->sync_handler)
|
||||
return user->sync_handler(user, timestamp);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user