mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-03 10:31:14 +03:00
factor stale-resolution state drop into a CameraState method
This commit is contained in:
parent
eb1709fa49
commit
548f772a7b
@ -304,14 +304,15 @@ class CameraState:
|
|||||||
def on(self, event_type: str, callback: Callable[..., Any]) -> None:
|
def on(self, event_type: str, callback: Callable[..., Any]) -> None:
|
||||||
self.callbacks[event_type].append(callback)
|
self.callbacks[event_type].append(callback)
|
||||||
|
|
||||||
def update(
|
def _discard_stale_resolution_state(
|
||||||
self,
|
self, current_detections: dict[str, dict[str, Any]]
|
||||||
frame_name: str,
|
) -> bool:
|
||||||
frame_time: float,
|
"""Drop tracked state when the camera's detect resolution has
|
||||||
current_detections: dict[str, dict[str, Any]],
|
changed, and signal the caller to skip this batch if it contains
|
||||||
motion_boxes: list[tuple[int, int, int, int]],
|
out-of-bounds boxes from the pre-recycle detect process.
|
||||||
regions: list[tuple[int, int, int, int]],
|
|
||||||
) -> None:
|
Returns True when the batch should be skipped entirely.
|
||||||
|
"""
|
||||||
# detect resolution changed — drop tracked state so old-grid
|
# detect resolution changed — drop tracked state so old-grid
|
||||||
# boxes don't leak through end-callbacks
|
# boxes don't leak through end-callbacks
|
||||||
current_shape = self.camera_config.frame_shape_yuv
|
current_shape = self.camera_config.frame_shape_yuv
|
||||||
@ -335,7 +336,20 @@ class CameraState:
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
f"{self.name}: dropping stale-resolution detection batch (box {box} exceeds {detect.width}x{detect.height})"
|
f"{self.name}: dropping stale-resolution detection batch (box {box} exceeds {detect.width}x{detect.height})"
|
||||||
)
|
)
|
||||||
return
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
def update(
|
||||||
|
self,
|
||||||
|
frame_name: str,
|
||||||
|
frame_time: float,
|
||||||
|
current_detections: dict[str, dict[str, Any]],
|
||||||
|
motion_boxes: list[tuple[int, int, int, int]],
|
||||||
|
regions: list[tuple[int, int, int, int]],
|
||||||
|
) -> None:
|
||||||
|
if self._discard_stale_resolution_state(current_detections):
|
||||||
|
return
|
||||||
|
|
||||||
current_frame = self.frame_manager.get(
|
current_frame = self.frame_manager.get(
|
||||||
frame_name, self.camera_config.frame_shape_yuv
|
frame_name, self.camera_config.frame_shape_yuv
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user