Fix recording segment management (#8220)

* Fix timing error

* Downgrade logs
This commit is contained in:
Nicolas Mowen 2023-10-18 17:18:22 -06:00 committed by GitHub
parent 282cbf8f40
commit 98200b7dda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -406,6 +406,7 @@ class RecordingMaintainer(threading.Thread):
return None return None
def run(self) -> None: def run(self) -> None:
camera_count = len(self.config.cameras.keys())
# Check for new files every 5 seconds # Check for new files every 5 seconds
wait_time = 0.0 wait_time = 0.0
while not self.stop_event.wait(wait_time): while not self.stop_event.wait(wait_time):
@ -421,7 +422,7 @@ class RecordingMaintainer(threading.Thread):
current_tracked_objects, current_tracked_objects,
motion_boxes, motion_boxes,
regions, regions,
) = self.object_recordings_info_queue.get(True, timeout=0.1) ) = self.object_recordings_info_queue.get(True, timeout=0.01)
if frame_time < run_start - stale_frame_count_threshold: if frame_time < run_start - stale_frame_count_threshold:
stale_frame_count += 1 stale_frame_count += 1
@ -437,15 +438,15 @@ class RecordingMaintainer(threading.Thread):
) )
except queue.Empty: except queue.Empty:
q_size = self.object_recordings_info_queue.qsize() q_size = self.object_recordings_info_queue.qsize()
if q_size > 5: if q_size > camera_count:
logger.warning( logger.debug(
f"object_recordings_info loop queue not empty ({q_size}) - recording segments may be missing" f"object_recordings_info loop queue not empty ({q_size})."
) )
break break
if stale_frame_count > 0: if stale_frame_count > 0:
logger.error( logger.warning(
f"Found {stale_frame_count} old frames, segments from recordings may be missing" f"Found {stale_frame_count} old frames, segments from recordings may be missing."
) )
# empty the audio recordings info queue if audio is enabled # empty the audio recordings info queue if audio is enabled
@ -458,7 +459,7 @@ class RecordingMaintainer(threading.Thread):
camera, camera,
frame_time, frame_time,
dBFS, dBFS,
) = self.audio_recordings_info_queue.get(True, timeout=0.1) ) = self.audio_recordings_info_queue.get(True, timeout=0.01)
if frame_time < run_start - stale_frame_count_threshold: if frame_time < run_start - stale_frame_count_threshold:
stale_frame_count += 1 stale_frame_count += 1
@ -472,9 +473,9 @@ class RecordingMaintainer(threading.Thread):
) )
except queue.Empty: except queue.Empty:
q_size = self.audio_recordings_info_queue.qsize() q_size = self.audio_recordings_info_queue.qsize()
if q_size > 5: if q_size > camera_count:
logger.warning( logger.debug(
f"object_recordings_info loop audio queue not empty ({q_size}) - recording segments may be missing" f"object_recordings_info loop audio queue not empty ({q_size})."
) )
break break