Skip to content

Commit

Permalink
#2289 server-side encoding of clipboard data using brotli
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@22643 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 6, 2019
1 parent 3456bfb commit f65c11e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/xpra/server/source/clipboard_connection.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
# This file is part of Xpra.
# Copyright (C) 2010-2018 Antoine Martin <antoine@xpra.org>
# Copyright (C) 2010-2019 Antoine Martin <antoine@xpra.org>
# Copyright (C) 2008 Nathaniel Smith <njs@pobox.com>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

from collections import deque

from xpra.net.compression import Compressible
from xpra.net.compression import Compressible, compressed_wrapper
from xpra.server.source.stub_source_mixin import StubSourceMixin
from xpra.platform.features import CLIPBOARDS
from xpra.util import envint, XPRA_CLIPBOARD_NOTIFICATION_ID
Expand Down Expand Up @@ -132,5 +132,9 @@ def compress_clipboard(self, packet):
packet = list(packet)
for i, item in enumerate(packet):
if isinstance(item, Compressible):
packet[i] = self.compressed_wrapper(item.datatype, item.data)
if self.brotli:
packet[i] = compressed_wrapper(item.datatype, item.data,
level=9, brotli=True, can_inline=False)
else:
packet[i] = self.compressed_wrapper(item.datatype, item.data)
self.queue_packet(packet)
5 changes: 4 additions & 1 deletion src/xpra/server/source/encodings_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from xpra.server.server_core import ClientException
from xpra.codecs.video_helper import getVideoHelper
from xpra.codecs.codec_constants import video_spec
from xpra.net.compression import compressed_wrapper, Compressed, use_lz4, use_lzo
from xpra.net.compression import compressed_wrapper, Compressed, use_lz4, use_lzo, use_brotli
from xpra.os_util import monotonic_time, strtobytes
from xpra.server.background_worker import add_work_item
from xpra.util import csv, typedict, envint
Expand Down Expand Up @@ -252,6 +252,9 @@ def parse_batch_int(value, varname):
self.zlib = c.boolget("zlib", True)
self.lz4 = c.boolget("lz4", False) and use_lz4
self.lzo = c.boolget("lzo", False) and use_lzo
self.brotli = c.boolget("brotli", False) and use_brotli
log("compressors: zlib=%s, lz4=%s, lzo=%s, brotli=%s",
self.zlib, self.lz4, self.lzo, self.brotli)

self.vrefresh = c.intget("vrefresh", -1)

Expand Down

0 comments on commit f65c11e

Please sign in to comment.