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
This commit is contained in:
Cody Cutrer 2023-06-22 15:56:13 -06:00
parent 9e531b0b5b
commit ca99d94725

View File

@ -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):