Miscellaneous fixes (#23238)
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run

* start audio transcription post processor when enabled on any camera

* Fetch embed key whenever an error occurs in case the llama server was restarted

* mypy

* add tooltips for colored dots in settings menu

* add ability to reorder cameras from management pane

* add ability to reorder birdseye

* add reordering save text to camera management view

* Include NPU in latency performance hint

* Implement turbo for NPU on object detection

* hide order fields

* drop auto-derived field paths from camera value when unset globally

* use correct field type for export hwaccel args

* add debug replay to detail actions menu

* clarify debug replay in docs

* guard get_current_frame_time against missing camera state

* Implement debug reply from export

* Refactor debug replay to use sources for dynamic playback

* Mypy

* fix debug export replay source timestamp handling

* skip replay cameras in stats immediately

* broadcast debug replay state over ws and buffer pre-OPEN sends

- push debug replay session state over the job_state ws topic so the status bar reacts instantly to start/stop without polling
- fix child-effect-before-parent-effect race in WsProvider that silently dropped initial snapshot requests on cold load

* fix debug replay test hang

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
Josh Hawkins
2026-05-18 22:52:40 -05:00
committed by GitHub
co-authored by Nicolas Mowen
parent d968f00500
commit 43d97acd21
28 changed files with 1176 additions and 170 deletions
+96 -6
View File
@@ -59,6 +59,64 @@ function stripHiddenPaths(value: JsonValue, hiddenFields: string[]): JsonValue {
return cloned;
}
/**
* Field paths that the backend resolves per-camera at runtime (from `fps`,
* stream introspection, or other camera-local state) but defaults to `None`
* in the global Pydantic model. Because the `/config` endpoint serializes
* with `exclude_none=True`, these paths are absent from the global section
* yet always populated on cameras, which would otherwise make every camera
* appear to override fields the user never set globally.
*/
const AUTO_DERIVED_FIELDS: Record<string, readonly string[]> = {
detect: [
"width",
"height",
"min_initialized",
"max_disappeared",
"stationary.interval",
"stationary.threshold",
],
};
/**
* Drop auto-derived field paths from the camera value when the global value
* has no explicit setting for that path. If the user later sets one of these
* fields globally, the path will be present in `globalValue` and normal
* comparison resumes.
*/
function stripAutoDerivedMissingFromGlobal(
sectionPath: string,
globalValue: JsonValue,
cameraValue: JsonValue,
): JsonValue {
const fields = AUTO_DERIVED_FIELDS[sectionPath];
if (!fields || !isJsonObject(cameraValue)) return cameraValue;
const cloned = cloneDeep(cameraValue) as JsonObject;
for (const path of fields) {
if (get(globalValue, path) === undefined) {
unsetWithWildcard(cloned as Record<string, unknown>, path);
}
}
return cloned;
}
/**
* Whether the given field is auto-derived for `sectionPath` and the global
* value at that path is missing — in which case a per-camera value should
* not be treated as an override.
*/
function isAutoDerivedMissingFromGlobal(
sectionPath: string,
fieldPath: string,
globalValue: unknown,
): boolean {
const fields = AUTO_DERIVED_FIELDS[sectionPath];
if (!fields) return false;
if (!fields.includes(fieldPath)) return false;
const value = get(globalValue as JsonObject, fieldPath);
return value === undefined || value === null;
}
/**
* Collapse null and empty-object values for override comparisons so
* semantically equivalent shapes match. The schema may default `mask: None`
@@ -234,10 +292,15 @@ export function useConfigOverride({
collapseEmpty(normalizedGlobalValue),
hiddenFields,
);
const collapsedCamera = stripHiddenPaths(
const collapsedCameraRaw = stripHiddenPaths(
collapseEmpty(normalizedCameraValue),
hiddenFields,
);
const collapsedCamera = stripAutoDerivedMissingFromGlobal(
sectionPath,
collapsedGlobal,
collapsedCameraRaw,
);
const comparisonGlobal = compareFields
? pickFields(collapsedGlobal, compareFields)
@@ -258,6 +321,20 @@ export function useConfigOverride({
const globalFieldValue = get(normalizedGlobalValue, fieldPath);
const cameraFieldValue = get(normalizedCameraValue, fieldPath);
if (
isAutoDerivedMissingFromGlobal(
sectionPath,
fieldPath,
normalizedGlobalValue,
)
) {
return {
isOverridden: false,
globalValue: globalFieldValue,
cameraValue: cameraFieldValue,
};
}
return {
isOverridden: !isEqual(
collapseEmpty(globalFieldValue as JsonValue),
@@ -367,10 +444,15 @@ export function useAllCameraOverrides(
collapseEmpty(globalValue),
hiddenFields,
);
const collapsedCamera = stripHiddenPaths(
const collapsedCameraRaw = stripHiddenPaths(
collapseEmpty(cameraValue),
hiddenFields,
);
const collapsedCamera = stripAutoDerivedMissingFromGlobal(
key,
collapsedGlobal,
collapsedCameraRaw,
);
const comparisonGlobal = compareFields
? pickFields(collapsedGlobal, compareFields)
: collapsedGlobal;
@@ -615,7 +697,11 @@ export function useCamerasOverridingSection(
const deltasByPath = new Map<string, FieldDelta>();
// 1. Camera-level overrides (uses base_config when a profile is active)
const cameraValue = collapseEmpty(cameraSectionValues[idx]);
const cameraValue = stripAutoDerivedMissingFromGlobal(
sectionPath,
globalValue,
collapseEmpty(cameraSectionValues[idx]),
);
for (const delta of collectFieldDeltas(
globalValue,
cameraValue,
@@ -696,9 +782,13 @@ export function useCameraSectionDeltas(
const globalValue = collapseEmpty(
getEffectiveGlobalBaseline(config, sectionPath, compareFields, schema),
);
const cameraValue = collapseEmpty(
normalizeConfigValue(
getBaseCameraSectionValue(config, cameraName, sectionPath),
const cameraValue = stripAutoDerivedMissingFromGlobal(
sectionPath,
globalValue,
collapseEmpty(
normalizeConfigValue(
getBaseCameraSectionValue(config, cameraName, sectionPath),
),
),
);
+18 -14
View File
@@ -10,7 +10,7 @@ import useSWR from "swr";
import useDeepMemo from "./use-deep-memo";
import { capitalizeAll, capitalizeFirstLetter } from "@/utils/stringUtil";
import { isReplayCamera } from "@/utils/cameraUtil";
import { useFrigateStats } from "@/api/ws";
import { useFrigateStats, useJobStatus } from "@/api/ws";
import { useIsAdmin } from "./use-is-admin";
import { useTranslation } from "react-i18next";
@@ -19,11 +19,15 @@ export default function useStats(stats: FrigateStats | undefined) {
const { t } = useTranslation(["views/system"]);
const { data: config } = useSWR<FrigateConfig>("config");
const isAdmin = useIsAdmin();
const { data: debugReplayStatus } = useSWR(
isAdmin ? "debug_replay/status" : null,
{
revalidateOnFocus: false,
},
// Pass isAdmin as revalidateOnFocus so non-admins never send the jobState snapshot pull
const { payload: replayJob } = useJobStatus("debug_replay", isAdmin);
const replayActive = Boolean(
isAdmin &&
replayJob &&
(replayJob.status === "queued" ||
replayJob.status === "running" ||
replayJob.status === "success"),
);
const memoizedStats = useDeepMemo(stats);
@@ -102,6 +106,11 @@ export default function useStats(stats: FrigateStats | undefined) {
// check camera cpu usages
Object.entries(memoizedStats["cameras"]).forEach(([name, cam]) => {
// Skip replay cameras
if (isReplayCamera(name)) {
return;
}
const ffmpegAvg = parseFloat(
memoizedStats["cpu_usages"][cam["ffmpeg_pid"]]?.cpu_average,
);
@@ -111,12 +120,7 @@ export default function useStats(stats: FrigateStats | undefined) {
const cameraName = config?.cameras?.[name]?.friendly_name ?? name;
// Skip ffmpeg warnings for replay cameras
if (
!isNaN(ffmpegAvg) &&
ffmpegAvg >= CameraFfmpegThreshold.error &&
!isReplayCamera(name)
) {
if (!isNaN(ffmpegAvg) && ffmpegAvg >= CameraFfmpegThreshold.error) {
problems.push({
text: t("stats.ffmpegHighCpuUsage", {
camera: capitalizeFirstLetter(capitalizeAll(cameraName)),
@@ -140,7 +144,7 @@ export default function useStats(stats: FrigateStats | undefined) {
});
// Add message if debug replay is active
if (debugReplayStatus?.active) {
if (replayActive) {
problems.push({
text: t("stats.debugReplayActive", {
defaultValue: "Debug replay session is active",
@@ -151,7 +155,7 @@ export default function useStats(stats: FrigateStats | undefined) {
}
return problems;
}, [config, memoizedStats, t, debugReplayStatus]);
}, [config, memoizedStats, t, replayActive]);
return { potentialProblems };
}