diff options
author | Gyuhwan Park★ <unstabler@unstabler.pl> | 2023-02-10 07:08:51 +0300 |
---|---|---|
committer | Gyuhwan Park★ <unstabler@unstabler.pl> | 2023-02-10 07:08:51 +0300 |
commit | 21daea93650ccc215d1ebd3d1cb65449bd12fd9a (patch) | |
tree | 402c39a0cd2a18b6f6140ae28aa9d26bb158f9be | |
parent | 3fedb88332c1e68cf9565807744e1dc4b0e3c760 (diff) |
fix: preserve dirty rects when frame has skipped
-rw-r--r-- | XrdpUlalacaPrivate.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/XrdpUlalacaPrivate.cpp b/XrdpUlalacaPrivate.cpp index 215f92c..3b0c26c 100644 --- a/XrdpUlalacaPrivate.cpp +++ b/XrdpUlalacaPrivate.cpp @@ -214,6 +214,8 @@ void XrdpUlalacaPrivate::ipcDisconnected() { } void XrdpUlalacaPrivate::updateThreadLoop() { + std::vector<ULIPCRect> skippedRects; + while (_isUpdateThreadRunning) { while (_updateQueue.empty()) { using namespace std::chrono_literals; @@ -233,17 +235,20 @@ void XrdpUlalacaPrivate::updateThreadLoop() { auto now = std::chrono::steady_clock::now(); auto tdelta = std::chrono::duration<double>(now.time_since_epoch()).count() - update.timestamp; - if (tdelta > 1.0 / 15.0 || _updateQueue.size() > 4) { - LOG(LOG_LEVEL_INFO, "skipping frame (tdelta = %.4f)", tdelta); - continue; - } - - auto width = update.width; auto height = update.height; auto dirtyRects = update.dirtyRects; auto image = update.image; + if (tdelta > 1.0 / 30.0 || _updateQueue.size() > 2 || std::abs(_frameId - _ackFrameId) > 1) { + LOG(LOG_LEVEL_INFO, "skipping frame (tdelta = %.4f)", tdelta); + skippedRects.insert(skippedRects.end(), dirtyRects->begin(), dirtyRects->end()); + continue; + } else { + dirtyRects->insert(dirtyRects->end(), skippedRects.begin(), skippedRects.end()); + skippedRects.clear(); + } + // LOG(LOG_LEVEL_TRACE, "updating screen: [%.4f] %d, %d", update.timestamp, update.width, update.height); if (_sessionSize.width != update.width || _sessionSize.height != update.height) { |