Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
totaam committed Feb 24, 2016
1 parent ac0f62e commit ec59ffe
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/xpra/server/window/video_subregion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ec59ffe

Please sign in to comment.