mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
* feat(engine): a chunk-fed encoder and the rule for which films may use it, off by default * test(engine): end the chunk encoder's ffprobe call with --
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolveInPageEncode, type InPageEncodeInput } from "./inPageEncodeEligibility.js";
|
|
|
|
const ready: InPageEncodeInput = {
|
|
enabled: true,
|
|
captureMode: "drawelement",
|
|
format: "mp4",
|
|
codec: "h264",
|
|
hdr: false,
|
|
transparent: false,
|
|
workers: 1,
|
|
hls: false,
|
|
videoLayer: false,
|
|
encoderSupported: true,
|
|
};
|
|
|
|
describe("resolveInPageEncode", () => {
|
|
it("takes a plain h264 mp4 drawElement film", () => {
|
|
expect(resolveInPageEncode(ready)).toEqual({ eligible: true });
|
|
});
|
|
|
|
it.each([
|
|
[{ enabled: false }, "disabled"],
|
|
[{ captureMode: "screenshot" as const }, "capture is not drawElement"],
|
|
[{ format: "webm" }, "output is not mp4"],
|
|
[{ codec: "h265" }, "codec is not h264"],
|
|
[{ hdr: true }, "hdr"],
|
|
[{ transparent: true }, "transparent"],
|
|
[{ workers: 3 }, "parallel workers"],
|
|
[{ hls: true }, "hls"],
|
|
[{ videoLayer: true }, "video layer passthrough"],
|
|
[{ encoderSupported: false }, "page encoder unsupported"],
|
|
])("leaves %j to today's path: %s", (change, reason) => {
|
|
expect(resolveInPageEncode({ ...ready, ...change })).toEqual({ eligible: false, reason });
|
|
});
|
|
});
|