summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kvmd/apps/kvmd/streamer.py13
-rw-r--r--web/share/js/kvm/stream.js3
2 files changed, 9 insertions, 7 deletions
diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py
index 51f737aa..4c4499ab 100644
--- a/kvmd/apps/kvmd/streamer.py
+++ b/kvmd/apps/kvmd/streamer.py
@@ -55,7 +55,6 @@ class StreamerSnapshot:
class _StreamerParams:
__DESIRED_FPS = "desired_fps"
- __MAX_FPS = "max_fps"
__QUALITY = "quality"
@@ -84,7 +83,7 @@ class _StreamerParams:
self.__has_h264 = bool(h264_bitrate)
self.__params: Dict = {self.__DESIRED_FPS: min(desired_fps, max_fps)}
- self.__limits: Dict = {self.__MAX_FPS: max_fps}
+ self.__limits: Dict = {self.__DESIRED_FPS: {"min": 0, "max": max_fps}}
if self.__has_quality:
self.__params[self.__QUALITY] = quality
@@ -117,7 +116,8 @@ class _StreamerParams:
new_params = dict(self.__params)
if self.__DESIRED_FPS in params:
- new_params[self.__DESIRED_FPS] = min(max(params[self.__DESIRED_FPS], 0), self.__limits[self.__MAX_FPS])
+ if self.__check_limits_min_max(self.__DESIRED_FPS, params[self.__DESIRED_FPS]):
+ new_params[self.__DESIRED_FPS] = params[self.__DESIRED_FPS]
if self.__QUALITY in params and self.__has_quality:
new_params[self.__QUALITY] = min(max(params[self.__QUALITY], 1), 100)
@@ -127,13 +127,14 @@ class _StreamerParams:
new_params[self.__RESOLUTION] = params[self.__RESOLUTION]
if self.__H264_BITRATE in params and self.__has_h264:
- min_bitrate = self.__limits[self.__H264_BITRATE]["min"]
- max_bitrate = self.__limits[self.__H264_BITRATE]["max"]
- if min_bitrate <= params[self.__H264_BITRATE] <= max_bitrate:
+ if self.__check_limits_min_max(self.__H264_BITRATE, params[self.__H264_BITRATE]):
new_params[self.__H264_BITRATE] = params[self.__H264_BITRATE]
self.__params = new_params
+ def __check_limits_min_max(self, key: str, value: int) -> bool:
+ return (self.__limits[key]["min"] <= value <= self.__limits[key]["max"])
+
class Streamer: # pylint: disable=too-many-instance-attributes
def __init__( # pylint: disable=too-many-arguments,too-many-locals
diff --git a/web/share/js/kvm/stream.js b/web/share/js/kvm/stream.js
index 44a28b96..3490d046 100644
--- a/web/share/js/kvm/stream.js
+++ b/web/share/js/kvm/stream.js
@@ -98,7 +98,8 @@ export function Streamer() {
}
if (!$("stream-desired-fps-slider").activated) {
- $("stream-desired-fps-slider").max = state.limits.max_fps;
+ $("stream-desired-fps-slider").min = state.limits.desired_fps.min;
+ $("stream-desired-fps-slider").max = state.limits.desired_fps.max;
wm.setElementEnabled($("stream-desired-fps-slider"), true);
if ($("stream-desired-fps-slider").value !== state.streamer.source.desired_fps) {
$("stream-desired-fps-slider").value = state.streamer.source.desired_fps;