diff options
author | Peter Åstrand (astrand) <astrand@cendio.se> | 2018-09-19 12:45:17 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2018-09-20 12:08:41 +0200 |
commit | 7a368c9e20afd681242068cccf8cbf64f40e231f (patch) | |
tree | c5cbc4ede62aee33ab5c4eb6c931dd047e9459f8 /common/rfb/EncodeManager.h | |
parent | c3dcff09369086b862870953f3f3ce5b5b10403f (diff) | |
download | tigervnc-7a368c9e20afd681242068cccf8cbf64f40e231f.tar.gz tigervnc-7a368c9e20afd681242068cccf8cbf64f40e231f.zip |
Avoid refresh of recently changed areas
If an area recently changed then we can guess that it will most likely
change again very soon. In such a case it is meaningless to send a
lossless refresh as it will directly be overwritten. Keep track of
such areas and avoid refreshing them until we no longer see any
changes to them.
Diffstat (limited to 'common/rfb/EncodeManager.h')
-rw-r--r-- | common/rfb/EncodeManager.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/common/rfb/EncodeManager.h b/common/rfb/EncodeManager.h index a91c544e..bdae9063 100644 --- a/common/rfb/EncodeManager.h +++ b/common/rfb/EncodeManager.h @@ -25,6 +25,7 @@ #include <rdr/types.h> #include <rfb/PixelBuffer.h> #include <rfb/Region.h> +#include <rfb/Timer.h> namespace rfb { class SConnection; @@ -36,7 +37,7 @@ namespace rfb { struct RectInfo; - class EncodeManager { + class EncodeManager : public Timer::Callback { public: EncodeManager(SConnection* conn); ~EncodeManager(); @@ -47,6 +48,8 @@ namespace rfb { static bool supported(int encoding); bool needsLosslessRefresh(const Region& req); + int getNextLosslessRefresh(const Region& req); + void pruneLosslessRefresh(const Region& limits); void writeUpdate(const UpdateInfo& ui, const PixelBuffer* pb, @@ -57,6 +60,8 @@ namespace rfb { size_t maxUpdateSize); protected: + virtual bool handleTimeout(Timer* t); + void doUpdate(bool allowLossy, const Region& changed, const Region& copied, const Point& copy_delta, const PixelBuffer* pb, @@ -117,6 +122,10 @@ namespace rfb { std::vector<int> activeEncoders; Region lossyRegion; + Region recentlyChangedRegion; + Region pendingRefreshRegion; + + Timer recentChangeTimer; struct EncoderStats { unsigned rects; |