Correctly update segment data (#11922)

This commit is contained in:
Nicolas Mowen 2024-06-12 16:48:54 -05:00 committed by GitHub
parent 187d98a153
commit 3e1861e2ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -194,10 +194,9 @@ class ReviewSegmentMaintainer(threading.Thread):
camera_config: CameraConfig, camera_config: CameraConfig,
frame, frame,
objects: list[TrackedObject], objects: list[TrackedObject],
prev_data: dict[str, any],
) -> None: ) -> None:
"""Update segment.""" """Update segment."""
prev_data = segment.get_data(ended=False)
if frame is not None: if frame is not None:
segment.update_frame(camera_config, frame, objects) segment.update_frame(camera_config, frame, objects)
@ -240,6 +239,7 @@ class ReviewSegmentMaintainer(threading.Thread):
"""Validate if existing review segment should continue.""" """Validate if existing review segment should continue."""
camera_config = self.config.cameras[segment.camera] camera_config = self.config.cameras[segment.camera]
active_objects = get_active_objects(frame_time, camera_config, objects) active_objects = get_active_objects(frame_time, camera_config, objects)
prev_data = segment.get_data(False)
if len(active_objects) > 0: if len(active_objects) > 0:
should_update = False should_update = False
@ -288,7 +288,7 @@ class ReviewSegmentMaintainer(threading.Thread):
frame_id, camera_config.frame_shape_yuv frame_id, camera_config.frame_shape_yuv
) )
self.update_segment( self.update_segment(
segment, camera_config, yuv_frame, active_objects segment, camera_config, yuv_frame, active_objects, prev_data
) )
self.frame_manager.close(frame_id) self.frame_manager.close(frame_id)
except FileNotFoundError: except FileNotFoundError:
@ -302,7 +302,7 @@ class ReviewSegmentMaintainer(threading.Thread):
) )
segment.save_full_frame(camera_config, yuv_frame) segment.save_full_frame(camera_config, yuv_frame)
self.frame_manager.close(frame_id) self.frame_manager.close(frame_id)
self.update_segment(segment, camera_config, None, []) self.update_segment(segment, camera_config, None, [], prev_data)
except FileNotFoundError: except FileNotFoundError:
return return