-alrqual only changes the quality of images sent when an automatic
lossless refresh occurs.  It doesn't change the base quality of images
that the server sends.

In the RFB protocol, the encoding type and (in the case of Tight
encoding) the compression level, quality, and subencoding types are
configurable using client-to-server messages, so the only way to forbid
clients from changing those parameters is to tell the server to ignore
those messages.  There's no way to do that without modifying the
TurboVNC Server source code.  I'm attaching a patch to demonstrate how
to do that.  I don't have any interest in making such functionality an
official feature, but it should be relatively straightforward to
maintain a GitHub fork with this patch.

On 10/1/20 5:22 PM, Andrew wrote:
> I'm using TurboVNC 2.2.5 and am trying to limit the total bandwidth
> all VNC sessions consume in my environment. Analysis has shown the
> "Tight + Medium-Quality JPEG" Encoding method is much easier on the
> network without sacrificing quality. 
>
> What I'd like to do is enforce this encoding method and prevent users
> from changing it. I've tried the "-alrqual" parameter on the vncserver
> which works, but a user is still able to change the encoding method by
> bringing up the options menu in their viewer. 
>
> Is this "lock down" currently possible? I appreciate any feedback.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboVNC User Discussion/Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/turbovnc-users/af873bb1-e2d0-249a-865c-831a71f6909c%40virtualgl.org.
diff --git a/unix/Xvnc/programs/Xserver/hw/vnc/rfb.h 
b/unix/Xvnc/programs/Xserver/hw/vnc/rfb.h
index 3de2cb80..54abfcf1 100644
--- a/unix/Xvnc/programs/Xserver/hw/vnc/rfb.h
+++ b/unix/Xvnc/programs/Xserver/hw/vnc/rfb.h
@@ -950,9 +950,9 @@ char *strsep(char **stringp, const char *delim);
 
 #define TVNC_SAMPOPT 4
 enum { TVNC_1X = 0, TVNC_4X, TVNC_2X, TVNC_GRAY };
-#define TIGHT_DEFAULT_COMPRESSION  1
-#define TIGHT_DEFAULT_SUBSAMP      TVNC_1X
-#define TIGHT_DEFAULT_QUALITY      95
+#define TIGHT_DEFAULT_COMPRESSION  6
+#define TIGHT_DEFAULT_SUBSAMP      TVNC_2X
+#define TIGHT_DEFAULT_QUALITY      80
 
 extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x, int y, int w, int h);
 extern Bool rfbSendRectEncodingTight(rfbClientPtr cl, int x, int y, int w,
diff --git a/unix/Xvnc/programs/Xserver/hw/vnc/rfbserver.c 
b/unix/Xvnc/programs/Xserver/hw/vnc/rfbserver.c
index 77f77fa2..618c8c6f 100644
--- a/unix/Xvnc/programs/Xserver/hw/vnc/rfbserver.c
+++ b/unix/Xvnc/programs/Xserver/hw/vnc/rfbserver.c
@@ -268,6 +268,7 @@ void InterframeOff(rfbClientPtr cl)
  * clients
  */
 
+#if 0
 static int JPEG_QUAL[10] = {
   15, 29, 41, 42, 62, 77, 79, 86, 92, 100
 };
@@ -275,6 +276,7 @@ static int JPEG_QUAL[10] = {
 static int JPEG_SUBSAMP[10] = {
   1, 1, 1, 2, 2, 2, 0, 0, 0, 0
 };
+#endif
 
 
 /*
@@ -755,7 +757,7 @@ static void rfbProcessClientInitMessage(rfbClientPtr cl)
 /* Update these constants on changing capability lists below! */
 #define N_SMSG_CAPS  0
 #define N_CMSG_CAPS  0
-#define N_ENC_CAPS  17
+#define N_ENC_CAPS  13
 
 void rfbSendInteractionCaps(rfbClientPtr cl)
 {
@@ -809,10 +811,12 @@ void rfbSendInteractionCaps(rfbClientPtr cl)
   SetCapInfo(&enc_list[i++],  rfbEncodingZRLE,           rfbTridiaVncVendor);
   SetCapInfo(&enc_list[i++],  rfbEncodingZYWRLE,         rfbTridiaVncVendor);
   SetCapInfo(&enc_list[i++],  rfbEncodingTight,          rfbTightVncVendor);
+#if 0
   SetCapInfo(&enc_list[i++],  rfbEncodingCompressLevel0, rfbTightVncVendor);
   SetCapInfo(&enc_list[i++],  rfbEncodingQualityLevel0,  rfbTightVncVendor);
   SetCapInfo(&enc_list[i++],  rfbEncodingFineQualityLevel0, rfbTurboVncVendor);
   SetCapInfo(&enc_list[i++],  rfbEncodingSubsamp1X,         rfbTurboVncVendor);
+#endif
   SetCapInfo(&enc_list[i++],  rfbEncodingXCursor,        rfbTightVncVendor);
   SetCapInfo(&enc_list[i++],  rfbEncodingRichCursor,     rfbTightVncVendor);
   SetCapInfo(&enc_list[i++],  rfbEncodingPointerPos,     rfbTightVncVendor);
@@ -1054,6 +1058,7 @@ static void rfbProcessClientNormalMessage(rfbClientPtr cl)
           default:
             if (enc >= (CARD32)rfbEncodingCompressLevel0 &&
                 enc <= (CARD32)rfbEncodingCompressLevel9) {
+#if 0
               cl->zlibCompressLevel = enc & 0x0F;
               cl->tightCompressLevel = enc & 0x0F;
               if (cl->preferredEncoding == rfbEncodingTight)
@@ -1070,13 +1075,17 @@ static void rfbProcessClientNormalMessage(rfbClientPtr 
cl)
                 } else
                   InterframeOff(cl);
               }
+#endif
             } else if (enc >= (CARD32)rfbEncodingSubsamp1X &&
                        enc <= (CARD32)rfbEncodingSubsampGray) {
+#if 0
               cl->tightSubsampLevel = enc & 0xFF;
               rfbLog("Using JPEG subsampling %d for client %s\n",
                      cl->tightSubsampLevel, cl->host);
+#endif
             } else if (enc >= (CARD32)rfbEncodingQualityLevel0 &&
                        enc <= (CARD32)rfbEncodingQualityLevel9) {
+#if 0
               cl->tightQualityLevel = JPEG_QUAL[enc & 0x0F];
               cl->tightSubsampLevel = JPEG_SUBSAMP[enc & 0x0F];
               cl->imageQualityLevel = enc & 0x0F;
@@ -1086,11 +1095,14 @@ static void rfbProcessClientNormalMessage(rfbClientPtr 
cl)
               else
                 rfbLog("Using image quality level %d for client %s\n",
                        cl->imageQualityLevel, cl->host);
+#endif
             } else if (enc >= (CARD32)rfbEncodingFineQualityLevel0 + 1 &&
                        enc <= (CARD32)rfbEncodingFineQualityLevel100) {
+#if 0
               cl->tightQualityLevel = enc & 0xFF;
               rfbLog("Using JPEG quality %d for client %s\n",
                      cl->tightQualityLevel, cl->host);
+#endif
             } else {
               rfbLog("rfbProcessClientNormalMessage: ignoring unknown encoding 
%d (%x)\n",
                      (int)enc, (int)enc);

Reply via email to