diff --git a/gui/src/aaregui/threads/axis_video_thread.py b/gui/src/aaregui/threads/axis_video_thread.py index 97d10d13..b858cdd4 100644 --- a/gui/src/aaregui/threads/axis_video_thread.py +++ b/gui/src/aaregui/threads/axis_video_thread.py @@ -28,7 +28,7 @@ class VideoThread(QThread): self.session = requests.Session() # Set connection timeout and read timeout - timeout = (5, 30) # (connect_timeout, read_timeout) + timeout = (1, 3) # (connect_timeout, read_timeout) try: # Start streaming @@ -124,10 +124,8 @@ class VideoThread(QThread): def stop(self): self.running = False - print("Video thread stop requested") if self.session: self.session.close() self.quit() - print("Video thread stopped. Exiting...") self.wait() diff --git a/gui/src/aaregui/threads/camera_thread.py b/gui/src/aaregui/threads/camera_thread.py index 4633fa75..99fac945 100644 --- a/gui/src/aaregui/threads/camera_thread.py +++ b/gui/src/aaregui/threads/camera_thread.py @@ -16,6 +16,7 @@ class SampleCameraThread(QThread): context = zmq.Context() self.__socket = context.socket(zmq.SUB) self.__socket.setsockopt(zmq.SUBSCRIBE, b"") + self.__socket.setsockopt(zmq.RCVTIMEO, 500) self.__socket.connect(zmq_url) self.running = True @@ -40,6 +41,8 @@ class SampleCameraThread(QThread): self.camera_image.emit(QPixmap.fromImage(qimage)) else: print("Sample camera image has wrong dimensions") + except zmq.Again: # Timeout occurred + continue # Check self.running again except Exception as e: print(f"Error in sample camera thread {e}") @@ -50,5 +53,4 @@ class SampleCameraThread(QThread): if self.__socket: self.__socket.close() self.quit() - print("Camera thread stopped. Exiting...") self.wait()