- Consolidated API route definitions by registering routes from separate modules for better organization and maintainability. - Removed redundant route definitions from the APIServer class, improving code clarity. - Updated camera monitoring and recording modules to utilize a shared context manager for suppressing camera SDK errors, enhancing error handling. - Adjusted timeout settings in camera operations for improved reliability during frame capture. - Enhanced logging and error handling across camera operations to facilitate better debugging and monitoring.
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
"""
|
|
Constants for camera operations.
|
|
"""
|
|
|
|
# Timeouts (milliseconds)
|
|
CAMERA_GET_BUFFER_TIMEOUT = 200 # Standard frame capture timeout
|
|
CAMERA_INIT_TIMEOUT = 1000 # Camera initialization timeout
|
|
CAMERA_TEST_CAPTURE_TIMEOUT = 1000 # Test capture timeout
|
|
CAMERA_GET_BUFFER_SHORT_TIMEOUT = 100 # Shorter timeout for quick checks
|
|
|
|
# Frame queue sizes
|
|
MJPEG_QUEUE_MAXSIZE = 5 # Buffer for latest frames (for MJPEG streaming)
|
|
RTSP_QUEUE_MAXSIZE = 10 # Buffer for RTSP frames (larger buffer for smoother streaming)
|
|
RECORDING_QUEUE_MAXSIZE = 30 # Buffer for recording frames (shared with recorder)
|
|
|
|
# Frame rates (FPS)
|
|
PREVIEW_FPS = 10.0 # Lower FPS for preview to reduce load
|
|
RTSP_FPS = 15.0 # RTSP FPS (can be higher than MJPEG preview)
|
|
DEFAULT_VIDEO_FPS = 30.0 # Default video FPS when target_fps is 0 or unspecified
|
|
|
|
# Sleep intervals (seconds)
|
|
STREAMING_LOOP_SLEEP = 0.1 # Sleep interval in streaming loops when waiting
|
|
BRIEF_PAUSE_SLEEP = 0.1 # Brief pause before retrying operations
|
|
|
|
# JPEG quality (0-100)
|
|
PREVIEW_JPEG_QUALITY = 70 # JPEG quality for streaming preview
|
|
|
|
# Video writer buffer size
|
|
VIDEO_WRITER_CHUNK_SIZE = 8192 # Buffer size for video writer operations
|
|
|