Disabling Camera for processes, no config changes

This commit is contained in:
banthungprong 2022-10-27 06:34:11 +02:00
parent 4c78b49743
commit 79548ff0dd
2 changed files with 33 additions and 31 deletions

View File

@ -250,36 +250,42 @@ class FrigateApp:
def start_camera_processors(self) -> None:
model_shape = (self.config.model.height, self.config.model.width)
for name, config in self.config.cameras.items():
camera_process = mp.Process(
target=track_camera,
name=f"camera_processor:{name}",
args=(
name,
config,
model_shape,
self.config.model.merged_labelmap,
self.detection_queue,
self.detection_out_events[name],
self.detected_frames_queue,
self.camera_metrics[name],
),
)
camera_process.daemon = True
self.camera_metrics[name]["process"] = camera_process
camera_process.start()
logger.info(f"Camera processor started for {name}: {camera_process.pid}")
if self.config.cameras[name].enabled:
camera_process = mp.Process(
target=track_camera,
name=f"camera_processor:{name}",
args=(
name,
config,
model_shape,
self.config.model.merged_labelmap,
self.detection_queue,
self.detection_out_events[name],
self.detected_frames_queue,
self.camera_metrics[name],
),
)
camera_process.daemon = True
self.camera_metrics[name]["process"] = camera_process
camera_process.start()
logger.info(f"Camera processor started for {name}: {camera_process.pid}")
else:
logger.info(f"Camera processor not started for disabled camera {name}")
def start_camera_capture_processes(self) -> None:
for name, config in self.config.cameras.items():
capture_process = mp.Process(
target=capture_camera,
name=f"camera_capture:{name}",
args=(name, config, self.camera_metrics[name]),
)
capture_process.daemon = True
self.camera_metrics[name]["capture_process"] = capture_process
capture_process.start()
logger.info(f"Capture process started for {name}: {capture_process.pid}")
if self.config.cameras[name].enabled:
capture_process = mp.Process(
target=capture_camera,
name=f"camera_capture:{name}",
args=(name, config, self.camera_metrics[name]),
)
capture_process.daemon = True
self.camera_metrics[name]["capture_process"] = capture_process
capture_process.start()
logger.info(f"Capture process started for {name}: {capture_process.pid}")
else:
logger.info(f"Capture process not started for disabled camera {name}")
def start_event_processor(self) -> None:
self.event_processor = EventProcessor(

View File

@ -823,10 +823,6 @@ class FrigateConfig(FrigateBaseModel):
{"name": name, **merged_config}
)
if not camera_config.enabled:
config.cameras.pop(name)
continue
# Default max_disappeared configuration
max_disappeared = camera_config.detect.fps * 5
if camera_config.detect.max_disappeared is None: