summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2021-01-23 07:35:34 +0300
committerDevaev Maxim <[email protected]>2021-01-23 08:11:38 +0300
commit61f52a36a27b68306fad04224f1964be9ea1d032 (patch)
tree85151e5afc1eb6a8b03b9babb31630a0c3bd502d /kvmd/apps
parent4d4fb69d2eb2e9b3d677b82098d888bd899c8c33 (diff)
rename
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/vnc/rfb/__init__.py12
-rw-r--r--kvmd/apps/vnc/server.py10
2 files changed, 11 insertions, 11 deletions
diff --git a/kvmd/apps/vnc/rfb/__init__.py b/kvmd/apps/vnc/rfb/__init__.py
index ce2b0daf..f0a42223 100644
--- a/kvmd/apps/vnc/rfb/__init__.py
+++ b/kvmd/apps/vnc/rfb/__init__.py
@@ -151,18 +151,18 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
# =====
- async def _send_fb_jpeg(self, jpeg: bytes) -> None:
+ async def _send_fb_jpeg(self, data: bytes) -> None:
assert self._encodings.has_tight
assert self._encodings.tight_jpeg_quality > 0
- assert len(jpeg) <= 4194303, len(jpeg)
+ assert len(data) <= 4194303, len(data)
await self._write_fb_update(self._width, self._height, RfbEncodings.TIGHT, drain=False)
- length = len(jpeg)
+ length = len(data)
if length <= 127:
- await self._write_struct("", bytes([0b10011111, length & 0x7F]), jpeg)
+ await self._write_struct("", bytes([0b10011111, length & 0x7F]), data)
elif length <= 16383:
- await self._write_struct("", bytes([0b10011111, length & 0x7F | 0x80, length >> 7 & 0x7F]), jpeg)
+ await self._write_struct("", bytes([0b10011111, length & 0x7F | 0x80, length >> 7 & 0x7F]), data)
else:
- await self._write_struct("", bytes([0b10011111, length & 0x7F | 0x80, length >> 7 & 0x7F | 0x80, length >> 14 & 0xFF]), jpeg)
+ await self._write_struct("", bytes([0b10011111, length & 0x7F | 0x80, length >> 7 & 0x7F | 0x80, length >> 14 & 0xFF]), data)
async def _send_resize(self, width: int, height: int) -> None:
assert self._encodings.has_resize
diff --git a/kvmd/apps/vnc/server.py b/kvmd/apps/vnc/server.py
index d00360a6..e6bfe3e2 100644
--- a/kvmd/apps/vnc/server.py
+++ b/kvmd/apps/vnc/server.py
@@ -194,12 +194,12 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
while True:
try:
streaming = False
- async for (online, width, height, jpeg) in streamer.read_stream():
+ async for (online, width, height, data) in streamer.read_stream():
if not streaming:
logger.info("[%s] %s: Streaming ...", name, self._remote)
streaming = True
if online:
- await self.__send_fb_real(width, height, jpeg)
+ await self.__send_fb_real(width, height, data)
else:
await self.__send_fb_stub("No signal")
except StreamerError as err:
@@ -211,10 +211,10 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
await self.__send_fb_stub("Waiting for stream ...")
await asyncio.sleep(1)
- async def __send_fb_real(self, width: int, height: int, jpeg: bytes) -> None:
+ async def __send_fb_real(self, width: int, height: int, data: bytes) -> None:
async with self.__lock:
if self.__fb_requested:
- if (self._width, self._height) != (width, height):
+ if self._width != width or self._height != height:
self.__shared_params.width = width
self.__shared_params.height = height
if not self._encodings.has_resize:
@@ -222,7 +222,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
await self.__send_fb_stub(msg, no_lock=True)
return
await self._send_resize(width, height)
- await self._send_fb_jpeg(jpeg)
+ await self._send_fb_jpeg(data)
self.__fb_stub_text = ""
self.__fb_stub_quality = 0
self.__fb_requested = False