Update FrigateConfig to set default values for stream_info if resolution detection fails

This commit is contained in:
Sergey Krashevich 2023-06-26 04:17:46 +03:00
parent 76886ec2f7
commit 2682aa9989
No known key found for this signature in database
GPG Key ID: 625171324E7D3856

View File

@ -966,17 +966,18 @@ class FrigateConfig(FrigateBaseModel):
logger.warn( logger.warn(
f"Error detecting stream resolution automatically for {input.path} Applying default values." f"Error detecting stream resolution automatically for {input.path} Applying default values."
) )
stream_info = {"width": 0, "height": 0}
camera_config.detect.width = ( camera_config.detect.width = (
stream_info["width"] stream_info["width"]
if stream_info["width"] > 0 if stream_info["width"] > 0
else DEFAULT_DETECT_DIMENSIONS["width"] else DEFAULT_DETECT_DIMENSIONS["width"]
) )
camera_config.detect.height = ( camera_config.detect.height = (
stream_info["height"] stream_info["height"]
if stream_info["height"] > 0 if stream_info["height"] > 0
else DEFAULT_DETECT_DIMENSIONS["height"] else DEFAULT_DETECT_DIMENSIONS["height"]
) )
# Default max_disappeared configuration # Default max_disappeared configuration
max_disappeared = camera_config.detect.fps * 5 max_disappeared = camera_config.detect.fps * 5