From 4ae9b2d57dfb9ac4a179316048cfdf74b7e6e8e1 Mon Sep 17 00:00:00 2001 From: lengyue Date: Tue, 3 May 2022 16:38:30 -0400 Subject: [PATCH] fix pyav incompatible --- pyproject.toml | 2 +- scrcpy/core.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8c827ef..0346316 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "scrcpy-client" -version = "0.4.2" +version = "0.4.3" description = "A client of scrcpy" authors = ["lengyue "] readme = "README.md" diff --git a/scrcpy/core.py b/scrcpy/core.py index 796b116..233617e 100644 --- a/scrcpy/core.py +++ b/scrcpy/core.py @@ -10,6 +10,7 @@ import numpy as np from adbutils import AdbDevice, AdbError, Network, _AdbStreamConnection, adb from av.codec import CodecContext +from av.error import InvalidDataError from .const import EVENT_FRAME, EVENT_INIT, LOCK_SCREEN_ORIENTATION_UNLOCKED from .control import ControlSender @@ -190,7 +191,7 @@ def __stream_loop(self) -> None: self.last_frame = frame self.resolution = (frame.shape[1], frame.shape[0]) self.__send_to_listeners(EVENT_FRAME, frame) - except BlockingIOError: + except (BlockingIOError, InvalidDataError): time.sleep(0.01) if not self.block_frame: self.__send_to_listeners(EVENT_FRAME, None)