mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-09 04:35:25 +03:00
simplify
This commit is contained in:
parent
3d539c93eb
commit
9091fc4c4a
@ -201,13 +201,13 @@ class PreviewRecorder:
|
|||||||
frame_time: float,
|
frame_time: float,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Decide if this frame should be added to PREVIEW."""
|
"""Decide if this frame should be added to PREVIEW."""
|
||||||
|
active_objs = get_active_objects(frame_time, self.config, current_tracked_objects)
|
||||||
|
|
||||||
preview_output_fps = (
|
preview_output_fps = (
|
||||||
2
|
2
|
||||||
if any(
|
if any(
|
||||||
o["label"] == "car"
|
o["label"] == "car"
|
||||||
for o in get_active_objects(
|
for o in active_objs
|
||||||
frame_time, self.config, current_tracked_objects
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
else 1
|
else 1
|
||||||
)
|
)
|
||||||
@ -217,10 +217,7 @@ class PreviewRecorder:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# send frame if a non-stationary object is in a zone
|
# send frame if a non-stationary object is in a zone
|
||||||
if any(
|
if len(active_objs > 0):
|
||||||
(len(o["current_zones"]) > 0 and not o["stationary"])
|
|
||||||
for o in current_tracked_objects
|
|
||||||
):
|
|
||||||
self.last_output_time = frame_time
|
self.last_output_time = frame_time
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -228,6 +225,11 @@ class PreviewRecorder:
|
|||||||
self.last_output_time = frame_time
|
self.last_output_time = frame_time
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# ensure that at least 2 frames are written every minute
|
||||||
|
if frame_time - self.last_output_time > 30:
|
||||||
|
self.last_output_time = frame_time
|
||||||
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def write_frame_to_cache(self, frame_time: float, frame) -> None:
|
def write_frame_to_cache(self, frame_time: float, frame) -> None:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user