summaryrefslogtreecommitdiff
path: root/kvmd/apps/vnc
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/apps/vnc')
-rw-r--r--kvmd/apps/vnc/__init__.py1
-rw-r--r--kvmd/apps/vnc/server.py23
2 files changed, 14 insertions, 10 deletions
diff --git a/kvmd/apps/vnc/__init__.py b/kvmd/apps/vnc/__init__.py
index 49f7fcbe..568a34d7 100644
--- a/kvmd/apps/vnc/__init__.py
+++ b/kvmd/apps/vnc/__init__.py
@@ -43,6 +43,7 @@ def main(argv: Optional[List[str]]=None) -> None:
VncServer(
kvmd=KvmdClient(**config.kvmd._unpack()),
streamer=StreamerClient(**config.streamer._unpack()),
+ desired_fps=config.desired_fps,
symmap=build_symmap(config.keymap),
**config.server._unpack(),
).run()
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