mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-12-03 02:37:06 +03:00
Improve hwaccel widget in the Settings UI (#25143)
CI / AMD64 Build (push) Waiting to run
CI / AMD64 Smoke Test (push) Blocked by required conditions
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
CI / AMD64 Smoke Test (push) Blocked by required conditions
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
* replace hwaccel None with Auto and Disabled Choosing None for the global hardware acceleration args sent undefined, which deleted the key, so the backend default `auto` turned detection back on (VAAPI on Intel hosts). On a config without the key the save returned a 500 from the update_yaml KeyError. Global hwaccel now offers Auto, which writes `auto`, and Disabled, which writes `[]`. Cameras get Disabled next to Inherit from global setting, and `""` and `[]` both display as Disabled. Camera-level Inherit restores the saved value instead of sending a delete for a key that may not be in the YAML, and camera export also counts as inherited when it matches the camera's own hwaccel value, since that's what the backend falls back to. The mode choice survives the remount RJSF does when the value flips between a string and a list, and every ffmpeg args field forces the split layout so a list value no longer stacks. The docs now say what Auto detects and how to turn decoding off. * keep Manual selected when switching to it from Disabled or Auto Choosing Manual after an unsaved Disabled or Auto sent `""`, which counts as no change, so BaseSection reset the form to the saved value and the field snapped back to the saved option. Manual now stays selected when the form falls back to the saved value, and it starts from the saved manual args when there are any, otherwise from an empty box. * don't copy camera args into an input's Manual box Switching an input from Preset to Manual read the saved value from the camera-level field, so the camera's manual args replaced the input's own. Input-scoped fields now have no saved value to fall back to. * keep saved manual lists intact and scope the empty Manual box to its value Switching back to Manual turned a saved YAML list into a string, so the round trip dirtied the form and saving rewrote the list. The cleared Manual box also followed its input index, so deleting an input showed it on the next one. Manual now restores the raw saved value, and the empty box only applies while the remembered choice still matches the current value. * keep a cleared input's Manual box empty Clearing an input's saved manual args after an edit reset the form to the saved value, and with no saved value for inputs the box refilled with the old text. Inputs now read their own saved value from `inputs.N`, but only while the input at that index still has the same path, so a delete or reorder doesn't pick up another input's value. * match dev for input args and fix Inherit on list values The per-input saved value lookup could match the wrong input (same path and roles, empty roles, or roles edited or re-added after a delete), so Preset to Manual restored another input's args. Inputs no longer read a saved value and behave like dev, which already refills a cleared box with the saved args. A cleared Manual hwaccel box also showed Disabled after a section or camera switch, and Inherit on a list-valued camera field showed Disabled or an empty Manual box because RJSF hands the unset list back as `[]`. A pending `""` now shows as Manual unless `""` is the saved value, and an Inherit choice also matches an empty list.
This commit is contained in:
@@ -0,0 +1,578 @@
|
||||
/**
|
||||
* Hardware acceleration args widget -- MEDIUM tier.
|
||||
*
|
||||
* Global hwaccel offers Auto (writes "auto") and Disabled (writes []).
|
||||
* Cameras offer Disabled next to "Inherit from global setting".
|
||||
*/
|
||||
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { test, expect, type FrigateApp } from "../../fixtures/frigate-test";
|
||||
import {
|
||||
configFactory,
|
||||
type DeepPartial,
|
||||
} from "../../fixtures/mock-data/config";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const CONFIG_SCHEMA = JSON.parse(
|
||||
readFileSync(
|
||||
resolve(__dirname, "../../fixtures/mock-data/config-schema.json"),
|
||||
"utf-8",
|
||||
),
|
||||
);
|
||||
|
||||
const MANUAL_WARNING = "Manual hardware acceleration arguments are not";
|
||||
|
||||
async function openSettings(
|
||||
app: FrigateApp,
|
||||
url: string,
|
||||
overrides: DeepPartial<ReturnType<typeof configFactory>> = {},
|
||||
) {
|
||||
const { page } = app;
|
||||
const config = configFactory(overrides);
|
||||
let lastSaved: unknown = null;
|
||||
|
||||
await page.route("**/api/config/schema.json", (route) =>
|
||||
route.fulfill({ json: CONFIG_SCHEMA }),
|
||||
);
|
||||
await page.route("**/api/config", (route) => route.fulfill({ json: config }));
|
||||
await page.route("**/api/config/raw_paths", (route) =>
|
||||
route.fulfill({ json: { cameras: {}, go2rtc: { streams: {} } } }),
|
||||
);
|
||||
await page.route("**/api/config/set", async (route) => {
|
||||
lastSaved = route.request().postDataJSON();
|
||||
await route.fulfill({ json: { success: true, require_restart: false } });
|
||||
});
|
||||
await page.route("**/api/ffmpeg/presets", (route) =>
|
||||
route.fulfill({
|
||||
json: {
|
||||
hwaccel_args: ["preset-vaapi", "preset-nvidia"],
|
||||
input_args: ["preset-rtsp-generic"],
|
||||
output_args: { record: ["preset-record-generic"], detect: [] },
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
await app.goto(url);
|
||||
return { saved: () => lastSaved };
|
||||
}
|
||||
|
||||
const radio = (app: FrigateApp, field: string, mode: string) =>
|
||||
app.page.locator(`[id="${field}-${mode}"]`);
|
||||
|
||||
const manualInput = (app: FrigateApp, field = "root_hwaccel_args") =>
|
||||
app.page.locator(`input[id="${field}"]`);
|
||||
|
||||
const save = (app: FrigateApp) =>
|
||||
app.page.getByRole("button", { name: "Save", exact: true });
|
||||
|
||||
test.describe("hwaccel args widget @medium", () => {
|
||||
test("global resolved preset shows Preset, Auto saves the literal auto", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
const capture = await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=globalFfmpeg",
|
||||
);
|
||||
|
||||
await expect(
|
||||
radio(frigateApp, "root_hwaccel_args", "preset"),
|
||||
).toBeChecked();
|
||||
await radio(frigateApp, "root_hwaccel_args", "auto").click();
|
||||
await expect(
|
||||
frigateApp.page.getByText("Frigate detects Nvidia or VAAPI hardware"),
|
||||
).toBeVisible();
|
||||
|
||||
await save(frigateApp).click();
|
||||
await expect
|
||||
.poll(capture.saved, { timeout: 5_000 })
|
||||
.toMatchObject({ config_data: { ffmpeg: { hwaccel_args: "auto" } } });
|
||||
});
|
||||
|
||||
test("global Disabled saves an empty list", async ({ frigateApp }) => {
|
||||
const capture = await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=globalFfmpeg",
|
||||
);
|
||||
|
||||
await radio(frigateApp, "root_hwaccel_args", "disabled").click();
|
||||
await save(frigateApp).click();
|
||||
await expect
|
||||
.poll(capture.saved, { timeout: 5_000 })
|
||||
.toMatchObject({ config_data: { ffmpeg: { hwaccel_args: [] } } });
|
||||
});
|
||||
|
||||
test("global empty list shows Disabled", async ({ frigateApp }) => {
|
||||
await openSettings(frigateApp, "/settings?page=globalFfmpeg", {
|
||||
ffmpeg: { hwaccel_args: [] },
|
||||
});
|
||||
|
||||
await expect(
|
||||
radio(frigateApp, "root_hwaccel_args", "disabled"),
|
||||
).toBeChecked();
|
||||
});
|
||||
|
||||
test("global empty string shows Disabled", async ({ frigateApp }) => {
|
||||
await openSettings(frigateApp, "/settings?page=globalFfmpeg", {
|
||||
ffmpeg: { hwaccel_args: "" },
|
||||
});
|
||||
|
||||
await expect(
|
||||
radio(frigateApp, "root_hwaccel_args", "disabled"),
|
||||
).toBeChecked();
|
||||
await expect(frigateApp.page.getByText(MANUAL_WARNING)).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("clearing manual args keeps Manual selected", async ({ frigateApp }) => {
|
||||
await openSettings(frigateApp, "/settings?page=globalFfmpeg", {
|
||||
ffmpeg: { hwaccel_args: "-hwaccel vaapi" },
|
||||
});
|
||||
|
||||
const manual = radio(frigateApp, "root_hwaccel_args", "manual");
|
||||
await expect(manual).toBeChecked();
|
||||
await frigateApp.page.locator('input[id="root_hwaccel_args"]').fill("");
|
||||
|
||||
await expect(manual).toBeChecked();
|
||||
await expect(manualInput(frigateApp)).toHaveValue("");
|
||||
});
|
||||
|
||||
test("saved Disabled switches to Manual and saves typed args", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
const capture = await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=globalFfmpeg",
|
||||
{ ffmpeg: { hwaccel_args: [] } },
|
||||
);
|
||||
|
||||
const manual = radio(frigateApp, "root_hwaccel_args", "manual");
|
||||
await manual.click();
|
||||
await expect(manual).toBeChecked();
|
||||
await manualInput(frigateApp).fill("-hwaccel none");
|
||||
await expect(manual).toBeChecked();
|
||||
|
||||
await save(frigateApp).click();
|
||||
await expect.poll(capture.saved, { timeout: 5_000 }).toMatchObject({
|
||||
config_data: { ffmpeg: { hwaccel_args: "-hwaccel none" } },
|
||||
});
|
||||
});
|
||||
|
||||
test("Preset then Disabled then Manual stays on Manual", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(frigateApp, "/settings?page=globalFfmpeg");
|
||||
|
||||
await radio(frigateApp, "root_hwaccel_args", "disabled").click();
|
||||
const manual = radio(frigateApp, "root_hwaccel_args", "manual");
|
||||
await manual.click();
|
||||
|
||||
await expect(manual).toBeChecked();
|
||||
await expect(manualInput(frigateApp)).toHaveValue("");
|
||||
});
|
||||
|
||||
test("Auto then Manual starts with an empty box", async ({ frigateApp }) => {
|
||||
await openSettings(frigateApp, "/settings?page=globalFfmpeg");
|
||||
|
||||
await radio(frigateApp, "root_hwaccel_args", "auto").click();
|
||||
const manual = radio(frigateApp, "root_hwaccel_args", "manual");
|
||||
await manual.click();
|
||||
|
||||
await expect(manual).toBeChecked();
|
||||
await expect(manualInput(frigateApp)).toHaveValue("");
|
||||
});
|
||||
|
||||
test("switching back to Manual shows the saved manual args", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(frigateApp, "/settings?page=globalFfmpeg", {
|
||||
ffmpeg: { hwaccel_args: "-hwaccel vaapi" },
|
||||
});
|
||||
|
||||
const manual = radio(frigateApp, "root_hwaccel_args", "manual");
|
||||
for (const from of ["preset", "disabled", "auto"]) {
|
||||
await radio(frigateApp, "root_hwaccel_args", from).click();
|
||||
await manual.click();
|
||||
|
||||
await expect(manual).toBeChecked();
|
||||
await expect(manualInput(frigateApp)).toHaveValue("-hwaccel vaapi");
|
||||
}
|
||||
});
|
||||
|
||||
test("an input's Manual does not take the camera's saved args", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
{
|
||||
cameras: {
|
||||
front_door: {
|
||||
ffmpeg: {
|
||||
input_args: "-rtsp_transport tcp",
|
||||
inputs: [
|
||||
{
|
||||
path: "rtsp://10.0.0.1:554/video",
|
||||
roles: ["record", "detect"],
|
||||
input_args: "-rtsp_transport udp",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const field = "root_inputs_0_input_args";
|
||||
await expect(manualInput(frigateApp, field)).toHaveValue(
|
||||
"-rtsp_transport udp",
|
||||
);
|
||||
await radio(frigateApp, field, "preset").click();
|
||||
await radio(frigateApp, field, "manual").click();
|
||||
|
||||
await expect(radio(frigateApp, field, "manual")).toBeChecked();
|
||||
await expect(manualInput(frigateApp, field)).toHaveValue(
|
||||
"-rtsp_transport udp",
|
||||
);
|
||||
});
|
||||
|
||||
test("a cleared input box does not carry to the next input after a delete", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
{
|
||||
cameras: {
|
||||
front_door: {
|
||||
ffmpeg: {
|
||||
inputs: [
|
||||
{
|
||||
path: "rtsp://10.0.0.1:554/main",
|
||||
roles: ["record"],
|
||||
input_args: "-first 1",
|
||||
},
|
||||
{
|
||||
path: "rtsp://10.0.0.1:554/sub",
|
||||
roles: ["detect"],
|
||||
input_args: "-second 2",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const field = "root_inputs_0_input_args";
|
||||
await manualInput(frigateApp, field).fill("");
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: "Delete", exact: true })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
await expect(manualInput(frigateApp, field)).toHaveValue("-second 2");
|
||||
});
|
||||
|
||||
test("a deleted input's args don't return on an input with the same path", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
{
|
||||
cameras: {
|
||||
front_door: {
|
||||
ffmpeg: {
|
||||
inputs: [
|
||||
{
|
||||
path: "rtsp://10.0.0.1:554/video",
|
||||
roles: ["record"],
|
||||
input_args: "-rtsp_transport tcp",
|
||||
},
|
||||
{
|
||||
path: "rtsp://10.0.0.1:554/video",
|
||||
roles: ["detect"],
|
||||
input_args: "-rtsp_transport udp",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: "Delete", exact: true })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
const field = "root_inputs_0_input_args";
|
||||
await expect(manualInput(frigateApp, field)).toHaveValue(
|
||||
"-rtsp_transport udp",
|
||||
);
|
||||
await radio(frigateApp, field, "preset").click();
|
||||
await radio(frigateApp, field, "manual").click();
|
||||
|
||||
await expect(manualInput(frigateApp, field)).toHaveValue("");
|
||||
});
|
||||
|
||||
test("a cleared Manual hwaccel box stays Manual across a camera switch", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
{ cameras: { front_door: { ffmpeg: { hwaccel_args: "-hw g" } } } },
|
||||
);
|
||||
|
||||
// Another edit keeps the form dirty, so the cleared "" stays pending.
|
||||
await frigateApp.page
|
||||
.getByRole("switch", { name: "Apple compatibility" })
|
||||
.click();
|
||||
await manualInput(frigateApp).fill("");
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: "Select a camera" })
|
||||
.click();
|
||||
await frigateApp.page.getByRole("switch", { name: "Backyard" }).click();
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: "Select a camera" })
|
||||
.click();
|
||||
await frigateApp.page.getByRole("switch", { name: "Front Door" }).click();
|
||||
|
||||
await expect(
|
||||
radio(frigateApp, "root_hwaccel_args", "manual"),
|
||||
).toBeChecked();
|
||||
await expect(manualInput(frigateApp)).toHaveValue("");
|
||||
});
|
||||
|
||||
test("Inherit on a list-valued camera field shows Inherit", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
const capture = await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
{
|
||||
cameras: {
|
||||
front_door: {
|
||||
ffmpeg: { hwaccel_args: [], input_args: ["-a", "1"] },
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
for (const field of ["root_hwaccel_args", "root_input_args"]) {
|
||||
const inherit = radio(frigateApp, field, "inherit");
|
||||
await inherit.click();
|
||||
await expect(inherit).toBeChecked();
|
||||
}
|
||||
|
||||
await save(frigateApp).click();
|
||||
await expect.poll(capture.saved, { timeout: 5_000 }).toMatchObject({
|
||||
config_data: {
|
||||
cameras: {
|
||||
front_door: { ffmpeg: { hwaccel_args: "", input_args: "" } },
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("a saved list round-trips through Manual unchanged", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(frigateApp, "/settings?page=globalFfmpeg", {
|
||||
ffmpeg: { hwaccel_args: ["-hwaccel", "vaapi"] },
|
||||
});
|
||||
|
||||
const manual = radio(frigateApp, "root_hwaccel_args", "manual");
|
||||
await expect(manual).toBeChecked();
|
||||
await radio(frigateApp, "root_hwaccel_args", "disabled").click();
|
||||
await expect(save(frigateApp)).toBeEnabled();
|
||||
await manual.click();
|
||||
|
||||
await expect(manual).toBeChecked();
|
||||
await expect(manualInput(frigateApp)).toHaveValue("-hwaccel vaapi");
|
||||
await expect(save(frigateApp)).toBeDisabled();
|
||||
});
|
||||
|
||||
test("Disabled keeps the side-by-side layout", async ({ frigateApp }) => {
|
||||
test.skip(frigateApp.isMobile, "the layout stacks on narrow screens");
|
||||
await openSettings(frigateApp, "/settings?page=globalFfmpeg");
|
||||
|
||||
const label = frigateApp.page
|
||||
.getByText("Hardware acceleration arguments", { exact: true })
|
||||
.first();
|
||||
const auto = radio(frigateApp, "root_hwaccel_args", "auto");
|
||||
const before = await auto.boundingBox();
|
||||
|
||||
await radio(frigateApp, "root_hwaccel_args", "disabled").click();
|
||||
await expect(
|
||||
radio(frigateApp, "root_hwaccel_args", "disabled"),
|
||||
).toBeChecked();
|
||||
|
||||
const labelBox = await label.boundingBox();
|
||||
const after = await auto.boundingBox();
|
||||
expect(after!.x).toBeGreaterThan(labelBox!.x + labelBox!.width);
|
||||
expect(after!.x).toBeCloseTo(before!.x, 0);
|
||||
});
|
||||
|
||||
test("camera Disabled overrides the global preset", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
const capture = await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
);
|
||||
|
||||
await expect(
|
||||
radio(frigateApp, "root_hwaccel_args", "inherit"),
|
||||
).toBeChecked();
|
||||
await expect(radio(frigateApp, "root_hwaccel_args", "auto")).toHaveCount(0);
|
||||
|
||||
await radio(frigateApp, "root_hwaccel_args", "disabled").click();
|
||||
await save(frigateApp).click();
|
||||
await expect.poll(capture.saved, { timeout: 5_000 }).toMatchObject({
|
||||
config_data: {
|
||||
cameras: { front_door: { ffmpeg: { hwaccel_args: [] } } },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("camera with an explicit empty list shows Disabled", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
{ cameras: { front_door: { ffmpeg: { hwaccel_args: [] } } } },
|
||||
);
|
||||
|
||||
await expect(
|
||||
radio(frigateApp, "root_hwaccel_args", "disabled"),
|
||||
).toBeChecked();
|
||||
});
|
||||
|
||||
test("camera with an empty string shows Disabled", async ({ frigateApp }) => {
|
||||
await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
{ cameras: { front_door: { ffmpeg: { hwaccel_args: "" } } } },
|
||||
);
|
||||
|
||||
await expect(
|
||||
radio(frigateApp, "root_hwaccel_args", "disabled"),
|
||||
).toBeChecked();
|
||||
await expect(
|
||||
frigateApp.page.getByText("Frigate detects Nvidia or VAAPI hardware"),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("camera saved Disabled switches to Preset", async ({ frigateApp }) => {
|
||||
await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
{ cameras: { front_door: { ffmpeg: { hwaccel_args: [] } } } },
|
||||
);
|
||||
|
||||
const preset = radio(frigateApp, "root_hwaccel_args", "preset");
|
||||
await preset.click();
|
||||
|
||||
await expect(preset).toBeChecked();
|
||||
await expect(
|
||||
frigateApp.page.locator('button[id="root_hwaccel_args"]'),
|
||||
).toContainText("VAAPI");
|
||||
});
|
||||
|
||||
test("a mode choice does not follow to another camera", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
);
|
||||
|
||||
// Both cameras hold the global preset, so only the key separates them.
|
||||
const preset = radio(frigateApp, "root_hwaccel_args", "preset");
|
||||
await preset.click();
|
||||
await expect(preset).toBeChecked();
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: "Select a camera" })
|
||||
.click();
|
||||
await frigateApp.page.getByRole("switch", { name: "Backyard" }).click();
|
||||
|
||||
await expect(
|
||||
radio(frigateApp, "root_hwaccel_args", "inherit"),
|
||||
).toBeChecked();
|
||||
});
|
||||
|
||||
test("camera Disabled then Inherit leaves nothing to save", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraFfmpeg&camera=front_door",
|
||||
);
|
||||
|
||||
const inherit = radio(frigateApp, "root_hwaccel_args", "inherit");
|
||||
await expect(inherit).toBeChecked();
|
||||
await radio(frigateApp, "root_hwaccel_args", "disabled").click();
|
||||
await expect(save(frigateApp)).toBeEnabled();
|
||||
await inherit.click();
|
||||
|
||||
await expect(inherit).toBeChecked();
|
||||
await expect(save(frigateApp)).toBeDisabled();
|
||||
});
|
||||
|
||||
test("global export Same as FFmpeg saves auto without the detect hint", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
const capture = await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=globalRecording",
|
||||
);
|
||||
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /Advanced/ })
|
||||
.first()
|
||||
.click();
|
||||
const sameAsFfmpeg = radio(frigateApp, "root_export_hwaccel_args", "auto");
|
||||
await expect(
|
||||
frigateApp.page.getByText("Same as FFmpeg hardware acceleration"),
|
||||
).toBeVisible();
|
||||
await sameAsFfmpeg.click();
|
||||
await expect(sameAsFfmpeg).toBeChecked();
|
||||
await expect(
|
||||
frigateApp.page.getByText("Frigate detects Nvidia or VAAPI hardware"),
|
||||
).toHaveCount(0);
|
||||
|
||||
await save(frigateApp).click();
|
||||
await expect.poll(capture.saved, { timeout: 5_000 }).toMatchObject({
|
||||
config_data: { record: { export: { hwaccel_args: "auto" } } },
|
||||
});
|
||||
});
|
||||
|
||||
test("camera export following a Disabled camera shows Inherit", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await openSettings(
|
||||
frigateApp,
|
||||
"/settings?page=cameraRecording&camera=front_door",
|
||||
{
|
||||
cameras: {
|
||||
front_door: {
|
||||
ffmpeg: { hwaccel_args: [] },
|
||||
record: { export: { hwaccel_args: [] } },
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /Advanced/ })
|
||||
.first()
|
||||
.click();
|
||||
await expect(
|
||||
radio(frigateApp, "root_export_hwaccel_args", "inherit"),
|
||||
).toBeChecked();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user