add camera name to ffmpeg log messages

This commit is contained in:
Blake Blackshear 2020-01-14 20:38:55 -06:00
parent 50bcad8b77
commit 38efbd63ea

View File

@ -66,7 +66,7 @@ class CameraWatchdog(threading.Thread):
time.sleep(10) time.sleep(10)
if self.camera.frame_time.value != 0.0 and (datetime.datetime.now().timestamp() - self.camera.frame_time.value) > 300: if self.camera.frame_time.value != 0.0 and (datetime.datetime.now().timestamp() - self.camera.frame_time.value) > 300:
print("last frame is more than 5 minutes old, restarting camera capture...") print(self.camera.name + ": last frame is more than 5 minutes old, restarting camera capture...")
self.camera.start_or_restart_capture() self.camera.start_or_restart_capture()
time.sleep(5) time.sleep(5)
@ -81,13 +81,13 @@ class CameraCapture(threading.Thread):
frame_num = 0 frame_num = 0
while True: while True:
if self.camera.ffmpeg_process.poll() != None: if self.camera.ffmpeg_process.poll() != None:
print("ffmpeg process is not running. exiting capture thread...") print(self.camera.name + ": ffmpeg process is not running. exiting capture thread...")
break break
raw_image = self.camera.ffmpeg_process.stdout.read(self.camera.frame_size) raw_image = self.camera.ffmpeg_process.stdout.read(self.camera.frame_size)
if len(raw_image) == 0: if len(raw_image) == 0:
print("ffmpeg didnt return a frame. something is wrong. exiting capture thread...") print(self.camera.name + ": ffmpeg didnt return a frame. something is wrong. exiting capture thread...")
break break
frame_num += 1 frame_num += 1