mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-29 16:57:06 +03:00
track where each camera's detect resolution came from
The health tab's stream check told users to set the detect resolution whenever a probe returned no size, even when they had already set it, and a camera running on the 1280x720 fallback after a failed startup probe was never flagged unless the stream check was run by hand. The config now records whether the resolution came from the config, a startup probe, or the fallback, and /api/config exposes it per camera. The stream check skips the probe warning when the resolution is set, a camera on the fallback gets a detect settings warning that also shows on the health tab, and cloning detect from a fallback camera no longer copies the fallback size.
This commit is contained in:
@@ -2483,5 +2483,45 @@ class TestFfmpegPath(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
class TestDetectResolutionSource(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.config = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"cameras": {
|
||||
"back": {
|
||||
"ffmpeg": {
|
||||
"inputs": [
|
||||
{"path": "rtsp://10.0.0.1:554/video", "roles": ["detect"]}
|
||||
]
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
def test_set_in_config(self):
|
||||
self.config["cameras"]["back"]["detect"] = {"width": 1920, "height": 1080}
|
||||
camera = FrigateConfig(**self.config).cameras["back"]
|
||||
assert camera.detect_resolution_source == "config"
|
||||
|
||||
def test_set_globally(self):
|
||||
self.config["detect"] = {"width": 1920, "height": 1080}
|
||||
camera = FrigateConfig(**self.config).cameras["back"]
|
||||
assert camera.detect_resolution_source == "config"
|
||||
|
||||
@patch(
|
||||
"frigate.config.config.stream_info_retriever.get_stream_info",
|
||||
return_value={"width": 2560, "height": 1440, "fourcc": "h264"},
|
||||
)
|
||||
def test_probed_from_stream(self, _):
|
||||
camera = FrigateConfig(**self.config).cameras["back"]
|
||||
assert camera.detect_resolution_source == "probed"
|
||||
assert (camera.detect.width, camera.detect.height) == (2560, 1440)
|
||||
|
||||
def test_probe_failed_uses_default(self):
|
||||
camera = FrigateConfig(**self.config).cameras["back"]
|
||||
assert camera.detect_resolution_source == "default"
|
||||
assert (camera.detect.width, camera.detect.height) == (1280, 720)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
Reference in New Issue
Block a user