SHM tweaks (#15274)

* Use env var to control max number of frames

* Handle type

* Fix frame_name not being sent

* Formatting
This commit is contained in:
Nicolas Mowen
2024-12-01 10:39:35 -06:00
committed by GitHub
parent 5802a66469
commit 002fdeae67
3 changed files with 10 additions and 2 deletions

View File

@@ -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"