From ec59ffe961e42a46a5aa333484e85feb29857a8f Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Wed, 24 Feb 2016 05:46:34 +0000 Subject: [PATCH] #1135: * make the video region detection thresholds configurable * add an expiry delay for damage events (set to 5 seconds by default) git-svn-id: https://xpra.org/svn/Xpra/trunk@12028 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/server/window/video_subregion.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/xpra/server/window/video_subregion.py b/src/xpra/server/window/video_subregion.py index df0b721df1..49839360f0 100644 --- a/src/xpra/server/window/video_subregion.py +++ b/src/xpra/server/window/video_subregion.py @@ -4,6 +4,7 @@ # Xpra is released under the terms of the GNU GPL v2, or, at your option, any # later version. See the file COPYING for details. +import os import time import math @@ -14,9 +15,10 @@ sslog = Logger("regiondetect") refreshlog = Logger("regionrefresh") -MIN_EVENTS = 20 -MIN_W = 128 -MIN_H = 96 +MAX_TIME = int(os.environ.get("XPRA_VIDEO_DETECT_MAX_TIME", "5")) +MIN_EVENTS = int(os.environ.get("XPRA_VIDEO_DETECT_MIN_EVENTS", "20")) +MIN_W = int(os.environ.get("XPRA_VIDEO_DETECT_MIN_WIDTH", "128")) +MIN_H = int(os.environ.get("XPRA_VIDEO_DETECT_MIN_HEIGHT", "96")) class VideoSubregion(object): @@ -218,8 +220,9 @@ def few_damage_events(event_types, event_count): few_damage_events("total", event_count) return + from_time = max(starting_at, time.time()-MAX_TIME) #create a list (copy) to work on: - lde = [x for x in list(last_damage_events) if x[0]>=starting_at] + lde = [x for x in list(last_damage_events) if x[0]>=from_time] dc = len(lde) if dc<=MIN_EVENTS: return self.novideoregion("not enough damage events yet (%s)", dc)