mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-13 17:13:01 +03:00
end tracked events before replacing replay camera state on a scene switch
- test the replay model rebind against two configured models
This commit is contained in:
@@ -98,14 +98,22 @@ class TestHttpApp(BaseTestHttp):
|
|||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert app.frigate_config.cameras["front_door"].objects.track == ["person"]
|
assert app.frigate_config.cameras["front_door"].objects.track == ["person"]
|
||||||
|
|
||||||
def test_config_set_in_memory_rebinds_replay_model_on_scene_change(self):
|
@patch("frigate.detectors.detector_config.load_labels")
|
||||||
|
def test_config_set_in_memory_rebinds_replay_model_on_scene_change(
|
||||||
|
self, mock_labels
|
||||||
|
):
|
||||||
|
mock_labels.return_value = {}
|
||||||
replay = "_replay_front_door"
|
replay = "_replay_front_door"
|
||||||
|
self.minimal_config["models"] = [
|
||||||
|
{"devices": ["cpu"]},
|
||||||
|
{"scene": "thermal", "devices": ["openvino:CPU"], "width": 300},
|
||||||
|
]
|
||||||
self.minimal_config["cameras"][replay] = self.minimal_config["cameras"].pop(
|
self.minimal_config["cameras"][replay] = self.minimal_config["cameras"].pop(
|
||||||
"front_door"
|
"front_door"
|
||||||
)
|
)
|
||||||
app = super().create_app()
|
app = super().create_app()
|
||||||
app.config_publisher = Mock()
|
app.config_publisher = Mock()
|
||||||
app.frigate_config.model_for_camera(replay)
|
assert app.frigate_config.model_for_camera(replay).scene == "default"
|
||||||
|
|
||||||
with AuthTestClient(app) as client:
|
with AuthTestClient(app) as client:
|
||||||
response = client.put(
|
response = client.put(
|
||||||
@@ -122,7 +130,7 @@ class TestHttpApp(BaseTestHttp):
|
|||||||
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert app.frigate_config.cameras[replay].detect.scene == "thermal"
|
assert app.frigate_config.cameras[replay].detect.scene == "thermal"
|
||||||
assert replay not in app.frigate_config._camera_models
|
assert app.frigate_config.model_for_camera(replay).scene == "thermal"
|
||||||
topics = [
|
topics = [
|
||||||
call.args[0].update_type.name
|
call.args[0].update_type.name
|
||||||
for call in app.config_publisher.publish_update.call_args_list
|
for call in app.config_publisher.publish_update.call_args_list
|
||||||
|
|||||||
@@ -795,6 +795,7 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
self.force_end_all_events(camera, camera_state)
|
||||||
camera_state.shutdown()
|
camera_state.shutdown()
|
||||||
self.frame_manager.close_camera(camera)
|
self.frame_manager.close_camera(camera)
|
||||||
self.create_camera_state(camera)
|
self.create_camera_state(camera)
|
||||||
|
|||||||
Reference in New Issue
Block a user