diff options
author | Devaev Maxim <[email protected]> | 2020-05-26 21:19:26 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-05-26 21:19:26 +0300 |
commit | 00bf4a2ab113bbbd061c7b3d011e040bd9297cd5 (patch) | |
tree | ccc21da7330c3ba9b16cecadc530fcab5b47bbcb /kvmd | |
parent | 99f994c866a6c8c41bca784210d75e69a1aff69a (diff) |
don't restart streamer with the same params
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/kvmd/server.py | 8 | ||||
-rw-r--r-- | kvmd/apps/kvmd/streamer.py | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py index d88982aa..893f95c3 100644 --- a/kvmd/apps/kvmd/server.py +++ b/kvmd/apps/kvmd/server.py @@ -206,13 +206,15 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins @exposed_http("POST", "/streamer/set_params") async def __streamer_set_params_handler(self, request: aiohttp.web.Request) -> aiohttp.web.Response: + current_params = self.__streamer.get_params() for (name, validator) in [ ("quality", valid_stream_quality), ("desired_fps", valid_stream_fps), ]: - value = request.query.get(name) - if value: - self.__new_streamer_params[name] = validator(value) + if (value := request.query.get(name)): + value = validator(value) + if current_params[name] != value: + self.__new_streamer_params[name] = value await self.__streamer_notifier.notify() return make_json_response() diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py index 98b5ae0c..5f2d2b42 100644 --- a/kvmd/apps/kvmd/streamer.py +++ b/kvmd/apps/kvmd/streamer.py @@ -173,6 +173,9 @@ class Streamer: # pylint: disable=too-many-instance-attributes ] } + def get_params(self) -> Dict: + return dict(self.__params) + async def get_state(self) -> Dict: state = None if self.__streamer_task: |