Skip to content

NVR with realtime local object detection for IP cameras

SHM tweaks (#15274)

Nicolas Mowen002fdeae67d4
diff --git a/frigate/app.py b/frigate/app.py
index 6518c1ddf0..ba82757f99 100644
--- a/frigate/app.py
+++ b/frigate/app.py
@@ -36,6 +36,7 @@ from frigate.const import (
EXPORT_DIR,
MODEL_CACHE_DIR,
RECORD_DIR,
+ SHM_FRAMES_VAR,
)
from frigate.db.sqlitevecq import SqliteVecQueueDatabase
from frigate.embeddings import EmbeddingsContext, manage_embeddings
@@ -523,7 +524,10 @@ class FrigateApp:
if cam_total_frame_size == 0.0:
return 0
- shm_frame_count = min(200, int(available_shm / (cam_total_frame_size)))
+ shm_frame_count = min(
+ int(os.environ.get(SHM_FRAMES_VAR, "50")),
+ int(available_shm / (cam_total_frame_size)),
+ )
logger.debug(
f"Calculated total camera size {available_shm} / {cam_total_frame_size} :: {shm_frame_count} frames for each camera in SHM"
diff --git a/frigate/const.py b/frigate/const.py
index c83b10e73a..5976f47b1d 100644
--- a/frigate/const.py
+++ b/frigate/const.py
@@ -13,6 +13,8 @@ FRIGATE_LOCALHOST = "http://127.0.0.1:5000"
PLUS_ENV_VAR = "PLUS_API_KEY"
PLUS_API_HOST = "https://api.frigate.video"
+SHM_FRAMES_VAR = "SHM_MAX_FRAMES"
+
# Attribute & Object constants
DEFAULT_ATTRIBUTE_LABEL_MAP = {
diff --git a/frigate/review/maintainer.py b/frigate/review/maintainer.py
index 23a42e7a7a..de137cb268 100644
--- a/frigate/review/maintainer.py
+++ b/frigate/review/maintainer.py
@@ -480,7 +480,9 @@ class ReviewSegmentMaintainer(threading.Thread):
if not self.config.cameras[camera].record.enabled:
if current_segment:
- self.update_existing_segment(current_segment, frame_time, [])
+ self.update_existing_segment(
+ current_segment, frame_name, frame_time, []
+ )
continue