Skip to content

Commit

Permalink
#4366 make 'inline' mode the default
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Sep 24, 2024
1 parent fbb0eec commit cf3ac51
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion xpra/client/base/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def compressed_wrapper(self, datatype, data, level=5, **kwargs) -> compression.C
# the compressed version is smaller, use it:
return cw
# we can't compress, so at least avoid warnings in the protocol layer:
return compression.Compressed(f"raw {datatype}", data, can_inline=True)
return compression.Compressed(f"raw {datatype}", data)

def send(self, packet_type: str, *parts: PacketElement) -> None:
packet = (packet_type, *parts)
Expand Down
2 changes: 1 addition & 1 deletion xpra/client/base/stub_client_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def compressed_wrapper(self, datatype, data, level=5, **kwargs) -> Compressed:
subclasses should override this method.
"""
assert level >= 0
return Compressed("raw %s" % datatype, data, can_inline=True)
return Compressed("raw %s" % datatype, data)

def init_authenticated_packet_handlers(self) -> None:
"""
Expand Down
4 changes: 2 additions & 2 deletions xpra/client/mixins/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,8 @@ def send_audio_data(self, audio_source, data: bytes,
metadata: dict, packet_metadata: Sequence[SizedBuffer]) -> None:
codec = audio_source.codec
# tag the packet metadata as already compressed:
pmetadata = Compressed("packet metadata", packet_metadata, can_inline=True)
packet_data = [codec, Compressed(codec, data, True), metadata, pmetadata]
pmetadata = Compressed("packet metadata", packet_metadata)
packet_data = [codec, Compressed(codec, data), metadata, pmetadata]
self.send("sound-data", *packet_data)

def send_audio_sync(self, v: int) -> None:
Expand Down
2 changes: 1 addition & 1 deletion xpra/codecs/argb/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def encode(coding: str, image, options: dict) -> tuple[str, Compressed, dict[str
# can't pass a raw buffer to rencodeplus,
# and even if we could, the image containing those pixels may be freed by the time we get to the encoder
algo = "not"
cwrapper = Compressed(coding, rgb_transform.pixels_to_bytes(pixels), True)
cwrapper = Compressed(coding, rgb_transform.pixels_to_bytes(pixels))
if pixel_format.find("A") >= 0 or pixel_format.find("X") >= 0:
bpp = 32
else:
Expand Down
4 changes: 2 additions & 2 deletions xpra/net/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def get_compressor(name) -> Callable:
class Compressed:
__slots__ = ("datatype", "data", "can_inline")

def __init__(self, datatype: str, data: SizedBuffer | Sequence, can_inline=False):
def __init__(self, datatype: str, data: SizedBuffer | Sequence, can_inline=True):
if not data and not isinstance(data, Sequence):
raise ValueError(f"missing compressed data, got {data!r} ({type(data)})")
self.datatype = datatype
Expand Down Expand Up @@ -201,7 +201,7 @@ def compress(self):
def compressed_wrapper(datatype, data, level=5, can_inline=True, **kwargs) -> Compressed:
size = len(data)

def no():
def no() -> Compressed:
return Compressed(f"raw {datatype}", data, can_inline=can_inline)

if size <= MIN_COMPRESS_SIZE:
Expand Down
2 changes: 1 addition & 1 deletion xpra/server/proxy/instance_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def process_client_packet(self, proto, packet: PacketType) -> None:
self.queue_server_packet(packet)

def compressed_marker(self, packet: PacketType, index: int, description: str) -> PacketType:
return replace_packet_item(packet, index, Compressed(description, packet[index], can_inline=False))
return replace_packet_item(packet, index, Compressed(description, packet[index]))

def queue_server_packet(self, packet: PacketType) -> None:
log("queueing server packet: %s (queue size=%s)", packet[0], self.server_packets.qsize())
Expand Down
4 changes: 2 additions & 2 deletions xpra/server/source/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ def new_audio_buffer(self, audio_source, data: bytes,
def send_audio_data(self, audio_source, data: bytes, metadata: dict,
packet_metadata: Sequence[SizedBuffer]) -> None:
# tag the packet metadata as already compressed:
pmetadata = Compressed("packet metadata", packet_metadata, can_inline=True)
packet_data = [audio_source.codec, Compressed(audio_source.codec, data, True), metadata, pmetadata]
pmetadata = Compressed("packet metadata", packet_metadata)
packet_data = [audio_source.codec, Compressed(audio_source.codec, data), metadata, pmetadata]
sequence = audio_source.sequence
if sequence >= 0:
metadata["sequence"] = sequence
Expand Down
2 changes: 1 addition & 1 deletion xpra/server/source/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def do_send_cursor(self, delay, cursor_data, cursor_sizes, encoding_prefix="") -
img.save(buf, "PNG")
pngdata = buf.getvalue()
buf.close()
cpixels = Compressed("png cursor", pngdata, can_inline=True)
cpixels = Compressed("png cursor", pngdata)
encoding = "png"
if SAVE_CURSORS:
filename = f"raw-cursor-{serial:x}.png"
Expand Down

0 comments on commit cf3ac51

Please sign in to comment.