Ensure final frame in preview is not duplicated

This commit is contained in:
Nicolas Mowen 2023-12-04 06:05:55 -07:00 committed by Blake Blackshear
parent cfda531f5a
commit c716e4b1cb

View File

@ -229,10 +229,6 @@ class PreviewRecorder:
self.write_frame_to_cache(frame_time, frame)
return
if self.should_write_frame(current_tracked_objects, motion_boxes, frame_time):
self.output_frames.append(frame_time)
self.write_frame_to_cache(frame_time, frame)
# check if PREVIEW clip should be generated and cached frames reset
if frame_time >= self.segment_end:
# save last frame to ensure consistent duration
@ -257,6 +253,9 @@ class PreviewRecorder:
# include first frame to ensure consistent duration
self.output_frames.append(frame_time)
self.write_frame_to_cache(frame_time, frame)
elif self.should_write_frame(current_tracked_objects, motion_boxes, frame_time):
self.output_frames.append(frame_time)
self.write_frame_to_cache(frame_time, frame)
def stop(self) -> None:
try: