summaryrefslogtreecommitdiff
path: root/kvmd/apps/vnc/server.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-03-20 15:33:47 +0300
committerDevaev Maxim <[email protected]>2020-03-20 15:33:47 +0300
commit3cafcaf4314e9a8fe66219d72ed4ae99abc04ab1 (patch)
treedf4d10e8197f38eb42d4a8a6d1642b52f2e0b901 /kvmd/apps/vnc/server.py
parent55307fe8da9b483a5d99f459cee5178879f69911 (diff)
configurable desired_fps
Diffstat (limited to 'kvmd/apps/vnc/server.py')
-rw-r--r--kvmd/apps/vnc/server.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/kvmd/apps/vnc/server.py b/kvmd/apps/vnc/server.py
index adf6f32d..e55e51a1 100644
--- a/kvmd/apps/vnc/server.py
+++ b/kvmd/apps/vnc/server.py
@@ -63,6 +63,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
kvmd: KvmdClient,
streamer: StreamerClient,
+ desired_fps: int,
symmap: Dict[int, str],
shared_params: _SharedParams,
@@ -72,6 +73,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
self.__kvmd = kvmd
self.__streamer = streamer
+ self.__desired_fps = desired_fps
self.__symmap = symmap
self.__shared_params = shared_params
@@ -244,10 +246,9 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
async def _on_set_encodings(self) -> None:
assert self.__authorized.done()
(user, passwd) = self.__authorized.result()
- (quality, desired_fps) = (self._encodings.tight_jpeg_quality, 30)
get_logger(0).info("[main] Client %s: Applying streamer params: quality=%d%%; desired_fps=%d ...",
- self._remote, quality, desired_fps)
- await self.__kvmd.set_streamer_params(user, passwd, quality=quality, desired_fps=desired_fps)
+ self._remote, self._encodings.tight_jpeg_quality, self.__desired_fps)
+ await self.__kvmd.set_streamer_params(user, passwd, self._encodings.tight_jpeg_quality, self.__desired_fps)
async def _on_fb_update_request(self) -> None:
self.__fb_requested = True
@@ -264,6 +265,7 @@ class VncServer:
kvmd: KvmdClient,
streamer: StreamerClient,
+ desired_fps: int,
symmap: Dict[int, str],
) -> None:
@@ -271,12 +273,13 @@ class VncServer:
self.__port = port
self.__max_clients = max_clients
- self.__kvmd = kvmd
- self.__streamer = streamer
-
- self.__symmap = symmap
-
- self.__shared_params = _SharedParams()
+ self.__client_kwargs = {
+ "kvmd": kvmd,
+ "streamer": streamer,
+ "desired_fps": desired_fps,
+ "symmap": symmap,
+ "shared_params": _SharedParams(),
+ }
def run(self) -> None:
logger = get_logger(0)
@@ -309,4 +312,4 @@ class VncServer:
logger.info("Bye-bye")
async def __handle_client(self, reader: asyncio.StreamReader, writer: asyncio.StreamWriter) -> None:
- await _Client(reader, writer, self.__kvmd, self.__streamer, self.__symmap, self.__shared_params).run()
+ await _Client(reader, writer, **self.__client_kwargs).run() # type: ignore