def METHOD_NAME(self, bytes_received: int, bytes_total: int) -> None:
    # An MJPG stream is (for our purpose) a stream of concatenated JPG images.
    # JPG images start with the marker 0xFFD8, and end with 0xFFD9
    if self._image_reply is None:
        return
    self._stream_buffer += self._image_reply.readAll()
    if len(self._stream_buffer) > 2000000:  # No single camera frame should be 2 Mb or larger
        Logger.log("w", "MJPEG buffer exceeds reasonable size. Restarting stream...")
        self.stop()  # resets stream buffer and start index
        self.start()
        return
    if self._stream_buffer_start_index == -1:
        self._stream_buffer_start_index = self._stream_buffer.indexOf(b'\xff\xd8')
    stream_buffer_end_index = self._stream_buffer.lastIndexOf(b'\xff\xd9')
    # If this happens to be more than a single frame, then so be it; the JPG decoder will
    # ignore the extra data. We do it like this in order not to get a buildup of frames
    if self._stream_buffer_start_index != -1 and stream_buffer_end_index != -1:
        jpg_data = self._stream_buffer[self._stream_buffer_start_index:stream_buffer_end_index + 2]
        self._stream_buffer = self._stream_buffer[stream_buffer_end_index + 2:]
        self._stream_buffer_start_index = -1
        self._image.loadFromData(jpg_data)
        if self._image.rect() != self._image_rect:
            self.imageSizeChanged.emit()
        self.update()