From fb8c1daf94dc427084730dee73ac2d828b9d1b76 Mon Sep 17 00:00:00 2001 From: FeliciaWen Date: Tue, 26 Jul 2022 11:58:17 +0800 Subject: [PATCH] Try 4 times more if can't read a frame. --- howdy/src/recorders/video_capture.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) mode change 100644 => 100755 howdy/src/recorders/video_capture.py diff --git a/howdy/src/recorders/video_capture.py b/howdy/src/recorders/video_capture.py old mode 100644 new mode 100755 index 50032ad3..07c43204 --- a/howdy/src/recorders/video_capture.py +++ b/howdy/src/recorders/video_capture.py @@ -81,10 +81,13 @@ def read_frame(self): # Grab a single frame of video # Don't remove ret, it doesn't work without it ret, frame = self.internal.read() - if not ret: - print(_("Failed to read camera specified in the 'device_path' config option, aborting")) - sys.exit(1) - + i = 0 + while not ret and i<=4: + ret, frame = self.internal.read() + if i == 4: + print(_("Failed to read camera specified in the 'device_path' config option, aborting")) + sys.exit(1) + i+=1 try: # Convert from color to grayscale # First processing of frame, so frame errors show up here