Skip to content

Commit

Permalink
#1320: boost non-scroll quality, more so if we have a high match perc…
Browse files Browse the repository at this point in the history
…entage (less to send)

git-svn-id: https://xpra.org/svn/Xpra/trunk@22190 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 21, 2019
1 parent 25719dd commit af8eac0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/xpra/server/window/window_video_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -1736,15 +1736,15 @@ def make_draw_packet(self, x, y, w, h, coding, data, outstride, client_options={
return packet


def encode_scrolling(self, scroll_data, image, options={}):
def encode_scrolling(self, scroll_data, image, options, match_pct):
start = monotonic_time()
try:
del options["av-sync"]
except KeyError:
pass
#tells make_data_packet not to invalidate the scroll data:
ww, wh = self.window_dimensions
scrolllog("encode_scrolling(%s, %s) window-dimensions=%s", image, options, (ww, wh))
scrolllog("encode_scrolling([], %s, %s, %i) window-dimensions=%s", image, options, match_pct, (ww, wh))
x, y, w, h = image.get_geometry()[:4]
raw_scroll, non_scroll = {}, {0 : h}
if x+y>ww or y+h>wh:
Expand Down Expand Up @@ -1791,6 +1791,9 @@ def encode_scrolling(self, scroll_data, image, options={}):
#send the rest as rectangles:
if non_scroll:
speed, quality = self._current_speed, self._current_quality
#boost quality a bit, because lossless saves refreshing,
#more so if we have a high match percentage (less to send):
quality = min(100, quality + 10 + max(0, match_pct-50)//2)
nsstart = monotonic_time()
client_options = options.copy()
for sy, sh in non_scroll.items():
Expand Down Expand Up @@ -1960,7 +1963,7 @@ def do_video_encode(self, encoding, image, options):
(end-start)*1000, match_pct, h, scroll)
#if enough scrolling is detected, use scroll encoding for this frame:
if match_pct>=self.scroll_min_percent:
return self.encode_scrolling(scroll_data, image, options)
return self.encode_scrolling(scroll_data, image, options, match_pct)
except Exception:
scrolllog("do_video_encode%s scrolling detection", (encoding, image, options), exc_info=True)
if not self.is_cancelled():
Expand Down

0 comments on commit af8eac0

Please sign in to comment.