Skip to content

Commit

Permalink
#2052 / #1933: make it possible to turn off server-side downscaling
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jun 7, 2021
1 parent 91899c0 commit c764baf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions xpra/server/window/window_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
FORCE_BATCH = envint("XPRA_FORCE_BATCH", True)
STRICT_MODE = envint("XPRA_ENCODING_STRICT_MODE", False)
MERGE_REGIONS = envbool("XPRA_MERGE_REGIONS", True)
DOWNSCALE = envbool("XPRA_DOWNSCALE", True)
DOWNSCALE_THRESHOLD = envint("XPRA_DOWNSCALE_THRESHOLD", 20)
INTEGRITY_HASH = envint("XPRA_INTEGRITY_HASH", False)
MAX_SYNC_BUFFER_SIZE = envint("XPRA_MAX_SYNC_BUFFER_SIZE", 256)*1024*1024 #256MB
Expand Down Expand Up @@ -712,7 +713,7 @@ def do_set_client_properties(self, properties):
#or convert to grayscale,
#and for that we need to use the pillow encoder:
grayscale = self.encoding=="grayscale"
if self.enc_pillow and (self.client_render_size or grayscale):
if self.enc_pillow and ((DOWNSCALE and self.client_render_size) or grayscale):
crsw, crsh = self.client_render_size
ww, wh = self.window_dimensions
if grayscale or (ww-crsw>DOWNSCALE_THRESHOLD and wh-crsh>DOWNSCALE_THRESHOLD):
Expand Down Expand Up @@ -853,7 +854,7 @@ def update_encoding_options(self, force_reload=False):
max_rgb_threshold = min(max_rgb_threshold, max(bwl//1000, 1024))
v = int(MAX_PIXELS_PREFER_RGB * pcmult * smult * qmult * (1 + int(self.is_OR or self.is_tray or self.is_shadow)*2))
crs = self.client_render_size
if crs:
if crs and DOWNSCALE:
ww, wh = self.window_dimensions
if crs[0]<ww or crs[1]<wh:
#client will downscale, best to avoid sending rgb,
Expand Down Expand Up @@ -2556,7 +2557,7 @@ def pillow_encode(self, coding, image, options):
w, h = image.get_width(), image.get_height()
ww, wh = self.window_dimensions
crs = self.client_render_size
if crs:
if crs and DOWNSCALE:
crsw, crsh = crs
#resize if the render size is smaller
if ww-crsw>DOWNSCALE_THRESHOLD and wh-crsh>DOWNSCALE_THRESHOLD:
Expand Down
4 changes: 3 additions & 1 deletion xpra/server/window/window_video_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,9 @@ def calculate_scaling(self, width, height, max_w=4096, max_h=4096):
q = self._current_quality
s = self._current_speed
now = monotonic_time()
crs = self.client_render_size
crs = None
if DOWNSCALE:
crs = self.client_render_size
def get_min_required_scaling(default_value=(1, 1)):
mw = max_w
mh = max_h
Expand Down

0 comments on commit c764baf

Please sign in to comment.