Browse Source

Heavily reduce window for bandwidth estimate

It took way too long to converge on a sane value, so reduce the window
by a factor of ten. This seems to work smoothly.
tags/v1.11.90
Pierre Ossman 3 years ago
parent
commit
31f18bb357
1 changed files with 9 additions and 5 deletions
  1. 9
    5
      vncviewer/CConn.cxx

+ 9
- 5
vncviewer/CConn.cxx View File

@@ -72,6 +72,9 @@ static const PixelFormat lowColourPF(8, 6, false, true,
static const PixelFormat mediumColourPF(8, 8, false, true,
7, 7, 3, 5, 2, 0);

// Time new bandwidth estimates are weighted against (in ms)
static const unsigned bpsEstimateWindow = 1000;

CConn::CConn(const char* vncServerName, network::Socket* socket=NULL)
: serverHost(0), serverPort(0), desktop(NULL),
updateCount(0), pixelCount(0),
@@ -362,7 +365,7 @@ void CConn::framebufferUpdateStart()
// appropriately, and then request another incremental update.
void CConn::framebufferUpdateEnd()
{
unsigned long long elapsed, bps;
unsigned long long elapsed, bps, weight;
struct timeval now;

CConnection::framebufferUpdateEnd();
@@ -380,10 +383,11 @@ void CConn::framebufferUpdateEnd()
1000000 / elapsed;
// Allow this update to influence things more the longer it took, to a
// maximum of 20% of the new value.
if (elapsed > 2000000)
elapsed = 2000000;
bpsEstimate = ((bpsEstimate * (10000000 - elapsed)) +
(bps * elapsed)) / 10000000;
weight = elapsed * 1000 / bpsEstimateWindow;
if (weight > 200000)
weight = 200000;
bpsEstimate = ((bpsEstimate * (1000000 - weight)) +
(bps * weight)) / 1000000;

Fl::remove_timeout(handleUpdateTimeout, this);
desktop->updateWindow();

Loading…
Cancel
Save