From ca99d947253623ec6337b2ac445523d22d95c3c1 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Thu, 22 Jun 2023 15:56:13 -0600 Subject: [PATCH] reduce contention on frame_queue don't check if the queue is full, just attempt to add the frame in a non-blocking manner, and then if it fails, skip it --- frigate/video.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/frigate/video.py b/frigate/video.py index c02ad15c4..395271d6d 100755 --- a/frigate/video.py +++ b/frigate/video.py @@ -195,17 +195,15 @@ def capture_frames( frame_rate.update() - # if the queue is full, skip this frame - if frame_queue.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 frame skipped_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):