mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
Check initial capture_enabled setting
This commit is contained in:
parent
a12ccf5d6c
commit
8390f054ac
@ -397,10 +397,19 @@ def capture_camera(name, config: CameraConfig, process_info):
|
||||
|
||||
setproctitle(f"frigate.capture:{name}")
|
||||
|
||||
# Set initial paused or resumed state
|
||||
init_sig = resume_sigs[0] if config.capture_enabled else pause_sigs[0]
|
||||
|
||||
def run_capture():
|
||||
frame_queue = process_info["frame_queue"]
|
||||
prev_sig = None
|
||||
prev_sig = init_sig
|
||||
while prev_sig not in stop_sigs:
|
||||
# Pause here until stopped or resumed
|
||||
while not sig_queue.empty() or prev_sig not in resume_sigs:
|
||||
# Abort on a STOP signal
|
||||
if( prev_sig := sig_queue.get() ) in stop_sigs:
|
||||
break
|
||||
|
||||
logger.info(f"{name}: capture starting")
|
||||
camera_watchdog = CameraWatchdog(
|
||||
name,
|
||||
@ -419,13 +428,6 @@ def capture_camera(name, config: CameraConfig, process_info):
|
||||
else:
|
||||
logger.info(f"{name}: capture stopped")
|
||||
|
||||
# Go through the queued signals, aborting on any STOP or
|
||||
# otherwise using the last state when the queue is emptied
|
||||
while not sig_queue.empty() or prev_sig not in resume_sigs:
|
||||
# Abort on a STOP signal
|
||||
if( prev_sig := sig_queue.get() ) in stop_sigs:
|
||||
break
|
||||
|
||||
# Run a background thread to prevent deadlock in signal handlers
|
||||
capture_thread = threading.Thread(target=run_capture)
|
||||
capture_thread.start()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user