From 5e140af3fd297286386af4848b07590069c0c4c2 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 23 Aug 2016 12:40:15 +0000 Subject: [PATCH] #1232: don't try to do scrolling detection with hashes without xxhash, too slow git-svn-id: https://xpra.org/svn/Xpra/trunk@13442 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/server/window/motion.pyx | 18 ++++++++++++------ src/xpra/server/window/window_video_source.py | 7 ++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/xpra/server/window/motion.pyx b/src/xpra/server/window/motion.pyx index 5fcb857efd..f0a842d7c4 100644 --- a/src/xpra/server/window/motion.pyx +++ b/src/xpra/server/window/motion.pyx @@ -10,18 +10,22 @@ import os import time +from xpra.log import Logger +logger = Logger("encoding") + import zlib -hashfn = zlib.crc32 +hashfn = None if os.environ.get("XPRA_XXHASH", "1")=="1": try: import xxhash def hashfn(x): return xxhash.xxh64(x).intdigest() except ImportError as e: - from xpra.log import Logger - logger = Logger("encoding") - logger.warn("Warning: xxhash python bindings not found,") - logger.warn(" using the slow zlib.crc32 fallback") + logger.warn("Warning: xxhash python bindings not found") +else: + logger.warn("Warning: xxhash disabled") +if hashfn is None: + logger.warn(" no scrolling detection") cdef extern from "math.h": @@ -45,13 +49,15 @@ cdef extern from "../../buffers/buffers.h": def CRC_Image(pixels, unsigned int width, unsigned int height, unsigned int rowstride, unsigned char bpp=4): + global hashfn + if not hashfn: + return None cdef uint8_t *buf = NULL cdef Py_ssize_t buf_len = 0 assert object_as_buffer(pixels, &buf, &buf_len)==0 assert buf_len>=0 and ( buf_len)>=rowstride*height, "buffer is too small for %ix%i" % (rowstride, height) cdef unsigned int i cdef size_t row_len = width*bpp - global hashfn f = hashfn crcs = [] for i in range(height): diff --git a/src/xpra/server/window/window_video_source.py b/src/xpra/server/window/window_video_source.py index d6356bd2f3..66eeed17ac 100644 --- a/src/xpra/server/window/window_video_source.py +++ b/src/xpra/server/window/window_video_source.py @@ -1459,9 +1459,10 @@ def video_fallback(): width = image.get_width() height = image.get_height() csums = CRC_Image(pixels, width, height, stride) - self.scroll_data = (width, height, csums) - scrolllog("updated scroll data") - if lsd: + if csums: + self.scroll_data = (width, height, csums) + scrolllog("updated scroll data") + if lsd and csums: lw, lh, lcsums = lsd if lw!=width or lh!=height: scrolllog("scroll data size mismatch: %ix%i vs %ix%i", lw, lh, width, height)