diff options
author | Pierre Ossman <ossman@cendio.se> | 2017-11-06 13:16:35 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-11-06 13:20:08 +0100 |
commit | 7be73d7385421685cf6db71f6401551d583da325 (patch) | |
tree | 75183a459c6325f1fb73b7de0eda26cbd32656d3 /common/rfb/VNCServerST.cxx | |
parent | 330ca42ef70c38f21ed7b385ae92988f8bbfc5ea (diff) | |
download | tigervnc-7be73d7385421685cf6db71f6401551d583da325.tar.gz tigervnc-7be73d7385421685cf6db71f6401551d583da325.zip |
Avoid corner case of applications rendering at frame rate
There is a problematic corner case where an application is updating
at exactly the same rate that we're sending update. In that case we
may miss updates regularly, getting a very uneven final frame rate.
Avoid this by introducing a slight offset when we start updating.
Diffstat (limited to 'common/rfb/VNCServerST.cxx')
-rw-r--r-- | common/rfb/VNCServerST.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index 46c4be9b..f27099f0 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -529,6 +529,13 @@ bool VNCServerST::handleTimeout(Timer* t) return false; writeUpdate(); + + // If this is the first iteration then we need to adjust the timeout + if (frameTimer.getTimeoutMs() != 1000/rfb::Server::frameRate) { + frameTimer.start(1000/rfb::Server::frameRate); + return false; + } + return true; } @@ -573,7 +580,10 @@ void VNCServerST::startFrameClock() if (blockCounter > 0) return; - frameTimer.start(1000/rfb::Server::frameRate); + // The first iteration will be just half a frame as we get a very + // unstable update rate if we happen to be perfectly in sync with + // the application's update rate + frameTimer.start(1000/rfb::Server::frameRate/2); } void VNCServerST::stopFrameClock() |