View | Details | Raw Unified | Return to bug 2928
Collapse All | Expand All

(-)a/common/rfb/EncodeManager.cxx (-3 / +16 lines)
Lines 1-6 Link Here
1
/* Copyright (C) 2000-2003 Constantin Kaplinsky.  All Rights Reserved.
1
/* Copyright (C) 2000-2003 Constantin Kaplinsky.  All Rights Reserved.
2
 * Copyright (C) 2011 D. R. Commander.  All Rights Reserved.
2
 * Copyright (C) 2011 D. R. Commander.  All Rights Reserved.
3
 * Copyright 2014-2018 Pierre Ossman for Cendio AB
3
 * Copyright 2014-2018 Pierre Ossman for Cendio AB
4
 * Copyright 2018 Peter Astrand for Cendio AB
4
 * 
5
 * 
5
 * This is free software; you can redistribute it and/or modify
6
 * This is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * it under the terms of the GNU General Public License as published by
Lines 248-261 bool EncodeManager::supported(int encoding) Link Here
248
  }
249
  }
249
}
250
}
250
251
252
void EncodeManager::updateLosslessRefresh()
253
{
254
  delayedLossyRegion = lossyRegion;
255
  delayedLossyRegion.assign_subtract(recentRegion);
256
  recentRegion.clear();
257
}
258
251
bool EncodeManager::needsLosslessRefresh(const Region& req)
259
bool EncodeManager::needsLosslessRefresh(const Region& req)
252
{
260
{
253
  return !lossyRegion.intersect(req).is_empty();
261
  return !delayedLossyRegion.intersect(req).is_empty();
254
}
262
}
255
263
256
void EncodeManager::pruneLosslessRefresh(const Region& limits)
264
void EncodeManager::pruneLosslessRefresh(const Region& limits)
257
{
265
{
258
  lossyRegion.assign_intersect(limits);
266
  lossyRegion.assign_intersect(limits);
267
  delayedLossyRegion.assign_intersect(limits);
259
}
268
}
260
269
261
void EncodeManager::writeUpdate(const UpdateInfo& ui, const PixelBuffer* pb,
270
void EncodeManager::writeUpdate(const UpdateInfo& ui, const PixelBuffer* pb,
Lines 438-444 Region EncodeManager::getLosslessRefresh(const Region& req, Link Here
438
  maxUpdateSize *= 2;
447
  maxUpdateSize *= 2;
439
448
440
  area = 0;
449
  area = 0;
441
  lossyRegion.intersect(req).get_rects(&rects);
450
  delayedLossyRegion.intersect(req).get_rects(&rects);
442
  while (!rects.empty()) {
451
  while (!rects.empty()) {
443
    size_t idx;
452
    size_t idx;
444
    Rect rect;
453
    Rect rect;
Lines 527-534 Encoder *EncodeManager::startRect(const Rect& rect, int type) Link Here
527
536
528
  if (encoder->flags & EncoderLossy)
537
  if (encoder->flags & EncoderLossy)
529
    lossyRegion.assign_union(Region(rect));
538
    lossyRegion.assign_union(Region(rect));
530
  else
539
  else {
531
    lossyRegion.assign_subtract(Region(rect));
540
    lossyRegion.assign_subtract(Region(rect));
541
    delayedLossyRegion.assign_subtract(Region(rect));
542
  }
543
  recentRegion.assign_union(Region(rect));
532
544
533
  return encoder;
545
  return encoder;
534
}
546
}
Lines 574-579 void EncodeManager::writeCopyRects(const Region& copied, const Point& delta) Link Here
574
  lossyCopy.translate(delta);
586
  lossyCopy.translate(delta);
575
  lossyCopy.assign_intersect(copied);
587
  lossyCopy.assign_intersect(copied);
576
  lossyRegion.assign_union(lossyCopy);
588
  lossyRegion.assign_union(lossyCopy);
589
  recentRegion.assign_union(lossyCopy);
577
}
590
}
578
591
579
void EncodeManager::writeSolidRects(Region *changed, const PixelBuffer* pb)
592
void EncodeManager::writeSolidRects(Region *changed, const PixelBuffer* pb)
(-)a/common/rfb/EncodeManager.h (+3 lines)
Lines 46-51 namespace rfb { Link Here
46
    // Hack to let ConnParams calculate the client's preferred encoding
46
    // Hack to let ConnParams calculate the client's preferred encoding
47
    static bool supported(int encoding);
47
    static bool supported(int encoding);
48
48
49
    void updateLosslessRefresh();
49
    bool needsLosslessRefresh(const Region& req);
50
    bool needsLosslessRefresh(const Region& req);
50
    void pruneLosslessRefresh(const Region& limits);
51
    void pruneLosslessRefresh(const Region& limits);
51
52
Lines 117-122 namespace rfb { Link Here
117
    std::vector<int> activeEncoders;
118
    std::vector<int> activeEncoders;
118
119
119
    Region lossyRegion;
120
    Region lossyRegion;
121
    Region recentRegion;
122
    Region delayedLossyRegion;
120
123
121
    struct EncoderStats {
124
    struct EncoderStats {
122
      unsigned rects;
125
      unsigned rects;
(-)a/common/rfb/VNCSConnectionST.cxx (-1 / +13 lines)
Lines 1-5 Link Here
1
/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
1
/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
2
 * Copyright 2009-2018 Pierre Ossman for Cendio AB
2
 * Copyright 2009-2018 Pierre Ossman for Cendio AB
3
 * Copyright 2018 Peter Astrand for Cendio AB
3
 * 
4
 * 
4
 * This is free software; you can redistribute it and/or modify
5
 * This is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * it under the terms of the GNU General Public License as published by
Lines 36-41 Link Here
36
#define XK_XKB_KEYS
37
#define XK_XKB_KEYS
37
#include <rfb/keysymdef.h>
38
#include <rfb/keysymdef.h>
38
39
40
#define ALR_TIMEOUT 59 // Slightly longer than 20 fps
41
39
using namespace rfb;
42
using namespace rfb;
40
43
41
static LogWriter vlog("VNCSConnST");
44
static LogWriter vlog("VNCSConnST");
Lines 47-53 VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s, Link Here
47
  : sock(s), reverseConnection(reverse),
50
  : sock(s), reverseConnection(reverse),
48
    inProcessMessages(false),
51
    inProcessMessages(false),
49
    pendingSyncFence(false), syncFence(false), fenceFlags(0),
52
    pendingSyncFence(false), syncFence(false), fenceFlags(0),
50
    fenceDataLen(0), fenceData(NULL), congestionTimer(this),
53
    fenceDataLen(0), fenceData(NULL), congestionTimer(this), alrTimer(this),
51
    server(server_), updates(false),
54
    server(server_), updates(false),
52
    updateRenderedCursor(false), removeRenderedCursor(false),
55
    updateRenderedCursor(false), removeRenderedCursor(false),
53
    continuousUpdates(false), encodeManager(this), pointerEventTime(0),
56
    continuousUpdates(false), encodeManager(this), pointerEventTime(0),
Lines 58-63 VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s, Link Here
58
  peerEndpoint.buf = sock->getPeerEndpoint();
61
  peerEndpoint.buf = sock->getPeerEndpoint();
59
  VNCServerST::connectionsLog.write(1,"accepted: %s", peerEndpoint.buf);
62
  VNCServerST::connectionsLog.write(1,"accepted: %s", peerEndpoint.buf);
60
63
64
  alrTimer.start(ALR_TIMEOUT);
65
61
  // Configure the socket
66
  // Configure the socket
62
  setSocketTimeouts();
67
  setSocketTimeouts();
63
  lastEventTime = time(0);
68
  lastEventTime = time(0);
Lines 841-846 bool VNCSConnectionST::handleTimeout(Timer* t) Link Here
841
  try {
846
  try {
842
    if (t == &congestionTimer)
847
    if (t == &congestionTimer)
843
      writeFramebufferUpdate();
848
      writeFramebufferUpdate();
849
850
    if (t == &alrTimer) {
851
      alrTimer.start(ALR_TIMEOUT);
852
      encodeManager.updateLosslessRefresh();
853
      writeFramebufferUpdate();
854
    }
855
844
  } catch (rdr::Exception& e) {
856
  } catch (rdr::Exception& e) {
845
    close(e.str());
857
    close(e.str());
846
  }
858
  }
(-)a/common/rfb/VNCSConnectionST.h (+1 lines)
Lines 191-196 namespace rfb { Link Here
191
191
192
    Congestion congestion;
192
    Congestion congestion;
193
    Timer congestionTimer;
193
    Timer congestionTimer;
194
    Timer alrTimer;
194
195
195
    VNCServerST* server;
196
    VNCServerST* server;
196
    SimpleUpdateTracker updates;
197
    SimpleUpdateTracker updates;

Return to bug 2928