summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-09-30 07:55:32 +0300
committerDevaev Maxim <[email protected]>2019-09-30 07:55:32 +0300
commitbcae85c8b98059b091c9aeea70eaf414b2ad068b (patch)
tree397fa878419a530818952c7111ad5b03fb974e81
parent5b8ac7ba70ee0ade4139fa888a23e4d4d3eb22cd (diff)
hdmi: decreased stream restart
-rw-r--r--configs/kvmd/main/v0-hdmi.yaml2
-rw-r--r--configs/kvmd/main/v1-hdmi.yaml2
-rw-r--r--configs/kvmd/main/v2-hdmi.yaml2
-rw-r--r--kvmd/apps/__init__.py7
-rw-r--r--kvmd/validators/basic.py4
-rw-r--r--testenv/main.yaml2
-rw-r--r--testenv/tests/validators/test_basic.py15
7 files changed, 31 insertions, 3 deletions
diff --git a/configs/kvmd/main/v0-hdmi.yaml b/configs/kvmd/main/v0-hdmi.yaml
index 7ad0fa4b..c1e0b001 100644
--- a/configs/kvmd/main/v0-hdmi.yaml
+++ b/configs/kvmd/main/v0-hdmi.yaml
@@ -28,6 +28,8 @@ kvmd:
type: disabled
streamer:
+ sync_delay: 0
+ init_delay: 1
desired_fps: 30
max_fps: 60
unix: /run/kvmd/ustreamer.sock
diff --git a/configs/kvmd/main/v1-hdmi.yaml b/configs/kvmd/main/v1-hdmi.yaml
index 830ff378..5bb7cb3e 100644
--- a/configs/kvmd/main/v1-hdmi.yaml
+++ b/configs/kvmd/main/v1-hdmi.yaml
@@ -30,6 +30,8 @@ kvmd:
device: /dev/kvmd-msd
streamer:
+ sync_delay: 0
+ init_delay: 1
desired_fps: 30
max_fps: 60
unix: /run/kvmd/ustreamer.sock
diff --git a/configs/kvmd/main/v2-hdmi.yaml b/configs/kvmd/main/v2-hdmi.yaml
index 060bede5..0b4233a3 100644
--- a/configs/kvmd/main/v2-hdmi.yaml
+++ b/configs/kvmd/main/v2-hdmi.yaml
@@ -26,6 +26,8 @@ kvmd:
type: otg
streamer:
+ sync_delay: 0
+ init_delay: 1
desired_fps: 30
max_fps: 60
unix: /run/kvmd/ustreamer.sock
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py
index 8014d8f6..b04f13a6 100644
--- a/kvmd/apps/__init__.py
+++ b/kvmd/apps/__init__.py
@@ -51,6 +51,7 @@ from ..yamlconf.loader import load_yaml_file
from ..validators.basic import valid_bool
from ..validators.basic import valid_number
+from ..validators.basic import valid_float_f0
from ..validators.basic import valid_float_f01
from ..validators.auth import valid_users_list
@@ -224,9 +225,9 @@ def _get_config_scheme() -> Dict:
"cap_pin": Option(-1, type=valid_gpio_pin_optional),
"conv_pin": Option(-1, type=valid_gpio_pin_optional),
- "sync_delay": Option(1.0, type=valid_float_f01),
- "init_delay": Option(3.0, type=valid_float_f01),
- "init_restart_after": Option(0.0, type=(lambda arg: valid_number(arg, min=0.0, type=float))),
+ "sync_delay": Option(1.0, type=valid_float_f0),
+ "init_delay": Option(3.0, type=valid_float_f0),
+ "init_restart_after": Option(0.0, type=valid_float_f0),
"shutdown_delay": Option(10.0, type=valid_float_f01),
"state_poll": Option(1.0, type=valid_float_f01),
diff --git a/kvmd/validators/basic.py b/kvmd/validators/basic.py
index 87056428..0328490d 100644
--- a/kvmd/validators/basic.py
+++ b/kvmd/validators/basic.py
@@ -74,6 +74,10 @@ def valid_int_f1(arg: Any) -> int:
return int(valid_number(arg, min=1))
+def valid_float_f0(arg: Any) -> float:
+ return float(valid_number(arg, min=0, type=float))
+
+
def valid_float_f01(arg: Any) -> float:
return float(valid_number(arg, min=0.1, type=float))
diff --git a/testenv/main.yaml b/testenv/main.yaml
index f0f48d4d..e1589a34 100644
--- a/testenv/main.yaml
+++ b/testenv/main.yaml
@@ -25,6 +25,8 @@ kvmd:
streamer:
cap_pin: 17
conv_pin: 18
+ sync_delay: 0
+ init_delay: 1
init_restart_after: 1
desired_fps: 30
max_fps: 40
diff --git a/testenv/tests/validators/test_basic.py b/testenv/tests/validators/test_basic.py
index 96feb666..15964a54 100644
--- a/testenv/tests/validators/test_basic.py
+++ b/testenv/tests/validators/test_basic.py
@@ -29,6 +29,7 @@ from kvmd.validators import ValidatorError
from kvmd.validators.basic import valid_bool
from kvmd.validators.basic import valid_number
from kvmd.validators.basic import valid_int_f1
+from kvmd.validators.basic import valid_float_f0
from kvmd.validators.basic import valid_float_f01
from kvmd.validators.basic import valid_string_list
@@ -96,6 +97,20 @@ def test_fail__valid_int_f1(arg: Any) -> None:
# =====
[email protected]("arg", [0, 1, 5, "5 ", "5.0 "])
+def test_ok__valid_float_f0(arg: Any) -> None:
+ value = valid_float_f0(arg)
+ assert type(value) == float # pylint: disable=unidiomatic-typecheck
+ assert value == float(str(arg).strip())
+
+
[email protected]("arg", ["test", "", None, -6, "-6"])
+def test_fail__valid_float_f0(arg: Any) -> None:
+ with pytest.raises(ValidatorError):
+ print(valid_float_f0(arg))
+
+
+# =====
@pytest.mark.parametrize("arg", [0.1, 1, 5, "5 ", "5.0 "])
def test_ok__valid_float_f01(arg: Any) -> None:
value = valid_float_f01(arg)