mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-29 16:57:06 +03:00
CI / ARM Build (push) Canceled after 0s
CI / AMD64 Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
The object_processing_behind notice fired after 5 dropped frames in 30 seconds per camera, which doesn't scale with detect fps, tripped on a single short stall, and never resolved. Camera processes now track a dropped frame rate, exposed as dropped_fps and dropped_pct in /api/stats, and the stats emitter raises one system notice when drops stay at or above 5% for over a minute, the same rule as skipped detections. The queue hand-off uses put_nowait so a camera that loses the race for the last slot counts a drop instead of blocking and showing up as skipped frames. Also adds a troubleshooting section to the cpu docs explaining the notice.
70 lines
2.1 KiB
Python
70 lines
2.1 KiB
Python
import multiprocessing as mp
|
|
import queue
|
|
from multiprocessing.managers import SyncManager, ValueProxy
|
|
from multiprocessing.sharedctypes import Synchronized
|
|
from multiprocessing.synchronize import Event
|
|
|
|
|
|
class CameraMetrics:
|
|
camera_fps: ValueProxy[float]
|
|
detection_fps: ValueProxy[float]
|
|
detection_frame: ValueProxy[float]
|
|
process_fps: ValueProxy[float]
|
|
skipped_fps: ValueProxy[float]
|
|
dropped_fps: ValueProxy[float]
|
|
read_start: ValueProxy[float]
|
|
audio_rms: ValueProxy[float]
|
|
audio_dBFS: ValueProxy[float]
|
|
|
|
frame_queue: queue.Queue
|
|
|
|
process_pid: ValueProxy[int]
|
|
capture_process_pid: ValueProxy[int]
|
|
ffmpeg_pid: ValueProxy[int]
|
|
reconnects_last_hour: ValueProxy[int]
|
|
stalls_last_hour: ValueProxy[int]
|
|
|
|
def __init__(self, manager: SyncManager):
|
|
self.camera_fps = manager.Value("d", 0)
|
|
self.detection_fps = manager.Value("d", 0)
|
|
self.detection_frame = manager.Value("d", 0)
|
|
self.process_fps = manager.Value("d", 0)
|
|
self.skipped_fps = manager.Value("d", 0)
|
|
self.dropped_fps = manager.Value("d", 0)
|
|
self.read_start = manager.Value("d", 0)
|
|
self.audio_rms = manager.Value("d", 0)
|
|
self.audio_dBFS = manager.Value("d", 0)
|
|
|
|
self.frame_queue = manager.Queue(maxsize=2)
|
|
|
|
self.process_pid = manager.Value("i", 0)
|
|
self.capture_process_pid = manager.Value("i", 0)
|
|
self.ffmpeg_pid = manager.Value("i", 0)
|
|
self.reconnects_last_hour = manager.Value("i", 0)
|
|
self.stalls_last_hour = manager.Value("i", 0)
|
|
|
|
|
|
class PTZMetrics:
|
|
start_time: Synchronized
|
|
stop_time: Synchronized
|
|
frame_time: Synchronized
|
|
zoom_level: Synchronized
|
|
max_zoom: Synchronized
|
|
min_zoom: Synchronized
|
|
|
|
motor_stopped: Event
|
|
reset: Event
|
|
|
|
def __init__(self) -> None:
|
|
self.start_time = mp.Value("d", 0)
|
|
self.stop_time = mp.Value("d", 0)
|
|
self.frame_time = mp.Value("d", 0)
|
|
self.zoom_level = mp.Value("d", 0)
|
|
self.max_zoom = mp.Value("d", 0)
|
|
self.min_zoom = mp.Value("d", 0)
|
|
|
|
self.motor_stopped = mp.Event()
|
|
self.reset = mp.Event()
|
|
|
|
self.motor_stopped.set()
|