Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Nov 28, 2021
1 parent 4fa676f commit a2c5113
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 4 additions & 8 deletions xpra/server/window/window_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from collections import deque
from time import monotonic

from xpra.os_util import strtobytes, bytestostr
from xpra.util import envint, envbool, csv, typedict, first_time, decode_str, repr_ellipsized
from xpra.common import MAX_WINDOW_SIZE
from xpra.server.window.windowicon_source import WindowIconSource
Expand Down Expand Up @@ -712,11 +711,8 @@ def set_client_properties(self, properties):
#filter out stuff we don't care about
#to see if there is anything to set at all,
#and if not, don't bother doing the potentially expensive update_encoding_selection()
for k in ("workspace", "screen"):
if k in properties:
del properties[k]
elif strtobytes(k) in properties:
del properties[strtobytes(k)]
for k in ("workspace", b"workspace", "screen", b"screen"):
properties.pop(k, None)
if properties:
self.do_set_client_properties(properties)

Expand Down Expand Up @@ -2050,7 +2046,7 @@ def schedule_auto_refresh(self, packet, options):
if not self.can_refresh():
self.cancel_refresh_timer()
return
encoding = bytestostr(packet[6])
encoding = packet[6]
data = packet[7]
region = rectangle(*packet[2:6]) #x,y,w,h
client_options = packet[10] #info about this packet from the encoder
Expand Down Expand Up @@ -2540,7 +2536,6 @@ def nodata(msg, *args):
return nodata("encoder %s returned None for %s", encoder, (coding, image, options))

coding, data, client_options, outw, outh, outstride, bpp = ret
coding = bytestostr(coding)
#check for cancellation again since the code above may take some time to encode:
#but never cancel mmap after encoding because we need to reclaim the space
#by getting the client to move the mmap received pointer
Expand Down Expand Up @@ -2578,6 +2573,7 @@ def nodata(msg, *args):
return self.make_draw_packet(x, y, outw, outh, coding, data, outstride, client_options, options)

def make_draw_packet(self, x, y, outw, outh, coding, data, outstride, client_options, options):
assert isinstance(coding, str), "invalid type for encoding: %r (%s)" % (coding, type(coding))
for v in (x, y, outw, outh, outstride):
assert isinstance(v, int), "expected int, found %r (%s)" % (v, type(v))
if self.send_window_size:
Expand Down
3 changes: 1 addition & 2 deletions xpra/server/window/window_video_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from xpra.codecs.codec_constants import PREFERRED_ENCODING_ORDER, EDGE_ENCODING_ORDER
from xpra.codecs.loader import has_codec
from xpra.util import parse_scaling_value, engs, envint, envbool, csv, roundup, print_nested_dict, first_time, typedict
from xpra.os_util import bytestostr
from xpra.log import Logger

log = Logger("encoding")
Expand Down Expand Up @@ -1717,7 +1716,7 @@ def setup_pipeline_option(self, width, height, src_format,
self._csc_encoder = csce
enc_start = monotonic()
#FIXME: filter dst_formats to only contain formats the encoder knows about?
dst_formats = tuple(bytestostr(x) for x in self.full_csc_modes.strtupleget(encoder_spec.encoding))
dst_formats = self.full_csc_modes.strtupleget(encoder_spec.encoding)
ve = encoder_spec.make_instance()
options = typedict(self.encoding_options)
options.update(self.get_video_encoder_options(encoder_spec.encoding, width, height))
Expand Down

0 comments on commit a2c5113

Please sign in to comment.