New AutoSelect policy:
* Never autoselect ZRLE, chose Tight instead.
* Only select Hextile if we've been timing for at least a second.
* Start with full colour enabled. Turn full colour on/off as the
bandwidth changes. Note, however: This code is currently disabled. See
comment.
* Default to lowcolourlevel 2 instead of 1.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@49 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer/CViewOptions.cxx b/vncviewer/CViewOptions.cxx
index 1740c19..d4c647a 100644
--- a/vncviewer/CViewOptions.cxx
+++ b/vncviewer/CViewOptions.cxx
@@ -35,13 +35,11 @@
static BoolParameter useDesktopResize("UseDesktopResize", "Support dynamic desktop resizing", true);
static BoolParameter fullColour("FullColour",
- "Use full colour (default is to use low colour "
- "unless auto select decides the link is fast enough)",
- false);
+ "Use full colour", true);
static IntParameter lowColourLevel("LowColourLevel",
"Colour level to use on slow connections. "
"0 = Very Low (8 colours), 1 = Low (64 colours), 2 = Medium (256 colours)",
- 1);
+ 2);
static BoolParameter fullScreen("FullScreen",
"Use the whole display to show the remote desktop."
"(Press F8 to access the viewer menu)",
diff --git a/vncviewer/cview.cxx b/vncviewer/cview.cxx
index 782758d..5f8a901 100644
--- a/vncviewer/cview.cxx
+++ b/vncviewer/cview.cxx
@@ -1112,41 +1112,63 @@
showLocalCursor();
}
+
+// Note: The method below is duplicated in vncviewer_unix/CConn.cxx!
+
// autoSelectFormatAndEncoding() chooses the format and encoding appropriate
// to the connection speed:
+//
// Above 16Mbps (timing for at least a second), same machine, switch to raw
// Above 3Mbps, switch to hextile
-// Below 1.5Mbps, switch to ZRLE
-// Above 1Mbps, switch to full colour mode
-void
+// Otherwise, switch to Tight
+//
+// Above 256Kbps, use full colour mode
+//
+void
CView::autoSelectFormatAndEncoding() {
int kbitsPerSecond = sock->inStream().kbitsPerSecond();
unsigned int newEncoding = options.preferredEncoding;
+ bool newFullColour = options.fullColour;
+ unsigned int timeWaited = sock->inStream().timeWaited();
- if (kbitsPerSecond > 16000 && sameMachine &&
- sock->inStream().timeWaited() >= 10000) {
+ // Select best encoding
+ if (kbitsPerSecond > 16000 && sameMachine && timeWaited >= 10000) {
newEncoding = encodingRaw;
- } else if (kbitsPerSecond > 3000) {
+ } else if (kbitsPerSecond > 3000 && timeWaited >= 10000) {
newEncoding = encodingHextile;
- } else if (kbitsPerSecond < 1500) {
- newEncoding = encodingZRLE;
+ } else {
+ newEncoding = encodingTight;
}
if (newEncoding != options.preferredEncoding) {
vlog.info("Throughput %d kbit/s - changing to %s encoding",
- kbitsPerSecond, encodingName(newEncoding));
+ kbitsPerSecond, encodingName(newEncoding));
options.preferredEncoding = newEncoding;
encodingChange = true;
}
- if (kbitsPerSecond > 1000) {
- if (!options.fullColour) {
- vlog.info("Throughput %d kbit/s - changing to full colour",
- kbitsPerSecond);
- options.fullColour = true;
- formatChange = true;
- }
+ if (kbitsPerSecond == 0) {
+ return;
}
+
+ // FIXME: The code below is currently disabled, since, as far as I
+ // understand, it is not possible to switch pixel format on the fly
+ // against TightVNC 1.2.X servers, for example. See mail to the
+ // mailing list, sent on 2004-12-21. If we cannot find any better
+ // solution, we could add code to only allow pixel format switching
+ // against VNC4 servers (if these don't use deferred updates).
+
+#if 0
+ // Select best color level
+ newFullColour = (kbitsPerSecond > 256);
+ if (newFullColour != options.fullColour) {
+ vlog.info("Throughput %d kbit/s - full colour is now %s",
+ kbitsPerSecond,
+ newFullColour ? "enabled" : "disabled");
+ options.fullColour = newFullColour;
+ formatChange = true;
+ }
+#endif
}
void