def METHOD_NAME(self) -> None:
    """
    Core loop for video parsing
    """
    try:
        from av.codec import CodecContext
        from av.error import InvalidDataError
    except ImportError as e:
        logger.error(e)
        logger.error('You must have `av` installed to use scrcpy screenshot, please update dependencies')
        raise RequestHumanTakeover
    codec = CodecContext.create("h264", "r")
    while self._scrcpy_alive:
        try:
            raw_h264 = self._scrcpy_video_socket.recv(0x10000)
            if raw_h264 == b"":
                raise ScrcpyError("Video stream is disconnected")
            packets = codec.parse(raw_h264)
            for packet in packets:
                frames = codec.decode(packet)
                for frame in frames:
                    # logger.info('frame received')
                    frame = frame.to_ndarray(format="rgb24")
                    self._scrcpy_last_frame = frame
                    self._scrcpy_last_frame_time = time.time()
                    self._scrcpy_resolution = (frame.shape[1], frame.shape[0])
        except (BlockingIOError, InvalidDataError):
            # only return nonempty frames, may block cv2 render thread
            time.sleep(0.001)
        except (ConnectionError, OSError) as e:  # Socket Closed
            if self._scrcpy_alive:
                logger.error(f'_scrcpy_stream_loop_thread: {repr(e)}')
                raise
    raise ScrcpyError('_scrcpy_stream_loop stopped')