NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
reduce contention on frame_queue (#6890)
Cody Cutrer2fae9dcb93f4
diff --git a/frigate/video.py b/frigate/video.pyindex 5928a84d55..630859b493 100755--- a/frigate/video.py+++ b/frigate/video.py@@ -206,17 +206,16 @@ def capture_frames(frame_rate.update()- # if the queue is full, skip this frame- if frame_queue.full():+ # don't lock the queue to check, just try since it should rarely be full+ try:+ # add to the queue+ frame_queue.put(current_frame.value, False)+ # close the frame+ frame_manager.close(frame_name)+ except queue.Full:+ # if the queue is full, skip this frameskipped_eps.update()frame_manager.delete(frame_name)- continue-- # close the frame- frame_manager.close(frame_name)-- # add to the queue- frame_queue.put(current_frame.value)class CameraWatchdog(threading.Thread):@@ -757,13 +756,15 @@ def process_frames(region_min_size = get_min_region_size(model_config)while not stop_event.is_set():- if exit_on_empty and frame_queue.empty():- logger.info("Exiting track_objects...")- break-try:- frame_time = frame_queue.get(True, 1)+ if exit_on_empty:+ frame_time = frame_queue.get(False)+ else:+ frame_time = frame_queue.get(True, 1)except queue.Empty:+ if exit_on_empty:+ logger.info("Exiting track_objects...")+ breakcontinuecurrent_frame_time.value = frame_time