From aa8086393b220b97fc078a1ffd5b1e2d0cbbd296 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 12 Nov 2026 17:39:19 -0600 Subject: [PATCH] end tracked events before replacing replay camera state on a scene switch - test the replay model rebind against two configured models --- frigate/test/http_api/test_http_app.py | 14 +++++++++++--- frigate/track/object_processing.py | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frigate/test/http_api/test_http_app.py b/frigate/test/http_api/test_http_app.py index 14f910658a..c77f8ac398 100644 --- a/frigate/test/http_api/test_http_app.py +++ b/frigate/test/http_api/test_http_app.py @@ -98,14 +98,22 @@ class TestHttpApp(BaseTestHttp): assert response.status_code == 200 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" + self.minimal_config["models"] = [ + {"devices": ["cpu"]}, + {"scene": "thermal", "devices": ["openvino:CPU"], "width": 300}, + ] self.minimal_config["cameras"][replay] = self.minimal_config["cameras"].pop( "front_door" ) app = super().create_app() 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: response = client.put( @@ -122,7 +130,7 @@ class TestHttpApp(BaseTestHttp): assert response.status_code == 200 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 = [ call.args[0].update_type.name for call in app.config_publisher.publish_update.call_args_list diff --git a/frigate/track/object_processing.py b/frigate/track/object_processing.py index d44dde95eb..c5c7b4db26 100644 --- a/frigate/track/object_processing.py +++ b/frigate/track/object_processing.py @@ -795,6 +795,7 @@ class TrackedObjectProcessor(threading.Thread): ): continue + self.force_end_all_events(camera, camera_state) camera_state.shutdown() self.frame_manager.close_camera(camera) self.create_camera_state(camera)