Limit shm frame count (#12363)

* Limited shm frame count (#12346)

* Only keep 2x detect fps frames in SHM

* Don't delete previous shm frames in output

* Catch case where images do not exist

* Ensure files are closed

* Clear out all frames when shutting down

* Correct the number of frames saved

* Simplify empty shm error handling

* Improve frame safety

* Add handler logs when frame is None

* Don't fail on cleanup

* Cleanup logging

* Update docs

* Update calculation

* Restore condition

* Fix case where thumbnail is saved without frame

* Adjust debug logs

* Calculate best shm frame count

* Fix shm count calculation

* Catch missing frame

* Formatting

* Clarify docs

* Catch none frame in autotracking
This commit is contained in:
Nicolas Mowen
2024-09-03 10:22:30 -06:00
committed by GitHub
parent 58a471e466
commit 9afa1354da
11 changed files with 160 additions and 80 deletions
+15
View File
@@ -292,6 +292,11 @@ class ReviewSegmentMaintainer(threading.Thread):
yuv_frame = self.frame_manager.get(
frame_id, camera_config.frame_shape_yuv
)
if yuv_frame is None:
logger.debug(f"Failed to get frame {frame_id} from SHM")
return
self.update_segment(
segment, camera_config, yuv_frame, active_objects, prev_data
)
@@ -305,6 +310,11 @@ class ReviewSegmentMaintainer(threading.Thread):
yuv_frame = self.frame_manager.get(
frame_id, camera_config.frame_shape_yuv
)
if yuv_frame is None:
logger.debug(f"Failed to get frame {frame_id} from SHM")
return
segment.save_full_frame(camera_config, yuv_frame)
self.frame_manager.close(frame_id)
self.update_segment(segment, camera_config, None, [], prev_data)
@@ -401,6 +411,11 @@ class ReviewSegmentMaintainer(threading.Thread):
yuv_frame = self.frame_manager.get(
frame_id, camera_config.frame_shape_yuv
)
if yuv_frame is None:
logger.debug(f"Failed to get frame {frame_id} from SHM")
return
self.active_review_segments[camera].update_frame(
camera_config, yuv_frame, active_objects
)