Repository: incubator-guacamole-server Updated Branches: refs/heads/master 070d46b09 -> 5d5fbb4d4
GUACAMOLE-172: Clarify processing lag calculations. Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/9e6e4e52 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/9e6e4e52 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/9e6e4e52 Branch: refs/heads/master Commit: 9e6e4e520c2f37ff71ce0045372b359e62f1067d Parents: 0ef87c4 Author: Michael Jumper <[email protected]> Authored: Tue Oct 4 13:26:32 2016 -0700 Committer: Michael Jumper <[email protected]> Committed: Tue Jan 24 00:18:00 2017 -0800 ---------------------------------------------------------------------- src/libguac/user-handlers.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/9e6e4e52/src/libguac/user-handlers.c ---------------------------------------------------------------------- diff --git a/src/libguac/user-handlers.c b/src/libguac/user-handlers.c index 9cd558c..40ccb89 100644 --- a/src/libguac/user-handlers.c +++ b/src/libguac/user-handlers.c @@ -104,9 +104,8 @@ int __guac_handle_sync(guac_user* user, int argc, char** argv) { /* Update lag statistics if at least one frame has been rendered */ if (user->last_frame_duration != 0) { - /* Approximate processing lag by summing the frame duration deltas */ - int processing_lag = user->processing_lag + frame_duration - - user->last_frame_duration; + /* 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 */ if (processing_lag < 0) @@ -116,8 +115,8 @@ int __guac_handle_sync(guac_user* user, int argc, char** argv) { } - /* Record duration of frame */ - user->last_frame_duration = frame_duration; + /* 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);
