Skip to content

Commit

Permalink
Don't run forever in autotracking (blakeblackshear#8579)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed Nov 11, 2023
1 parent 57a06d2 commit 3457dcd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frigate/ptz/autotrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ def __init__(
) -> None:
threading.Thread.__init__(self)
self.name = "ptz_autotracker"
self.ptz_autotracker = PtzAutoTracker(config, onvif, ptz_metrics, dispatcher)
self.ptz_autotracker = PtzAutoTracker(
config, onvif, ptz_metrics, dispatcher, stop_event
)
self.stop_event = stop_event
self.config = config

Expand Down Expand Up @@ -178,11 +180,13 @@ def __init__(
onvif: OnvifController,
ptz_metrics: PTZMetricsTypes,
dispatcher: Dispatcher,
stop_event: MpEvent,
) -> None:
self.config = config
self.onvif = onvif
self.ptz_metrics = ptz_metrics
self.dispatcher = dispatcher
self.stop_event = stop_event
self.tracked_object: dict[str, object] = {}
self.tracked_object_history: dict[str, object] = {}
self.tracked_object_metrics: dict[str, object] = {}
Expand Down Expand Up @@ -581,7 +585,7 @@ def _process_move_queue(self, camera):
camera_config.frame_shape[1]
camera_config.frame_shape[0]

while True:
while not self.stop_event.is_set():
move_data = self.move_queues[camera].get()

with self.move_queue_locks[camera]:
Expand Down

0 comments on commit 3457dcd

Please sign in to comment.