mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 12:54:29 +00:00
fix: budget workers for expensive captures
This commit is contained in:
@@ -5,7 +5,6 @@ const BASE: DockerRenderOptions = {
|
||||
fps: 30,
|
||||
quality: "standard",
|
||||
format: "mp4",
|
||||
workers: 4,
|
||||
gpu: false,
|
||||
hdr: false,
|
||||
crf: undefined,
|
||||
@@ -43,17 +42,28 @@ describe("buildDockerRunArgs", () => {
|
||||
"standard",
|
||||
"--format",
|
||||
"mp4",
|
||||
"--workers",
|
||||
"4",
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
it("omits --workers when auto sizing should happen inside the container", () => {
|
||||
const args = buildDockerRunArgs({ ...FIXED_INPUT, options: BASE });
|
||||
expect(args).not.toContain("--workers");
|
||||
});
|
||||
|
||||
it("matches snapshot when every renderer flag is enabled", () => {
|
||||
expect(
|
||||
buildDockerRunArgs({
|
||||
...FIXED_INPUT,
|
||||
options: { ...BASE, gpu: true, hdr: true, crf: 18, videoBitrate: undefined, quiet: true },
|
||||
options: {
|
||||
...BASE,
|
||||
workers: 4,
|
||||
gpu: true,
|
||||
hdr: true,
|
||||
crf: 18,
|
||||
videoBitrate: undefined,
|
||||
quiet: true,
|
||||
},
|
||||
}),
|
||||
).toMatchInlineSnapshot(`
|
||||
[
|
||||
|
||||
@@ -22,7 +22,7 @@ export interface DockerRenderOptions {
|
||||
fps: 24 | 30 | 60;
|
||||
quality: "draft" | "standard" | "high";
|
||||
format: "mp4" | "webm" | "mov";
|
||||
workers: number;
|
||||
workers?: number;
|
||||
gpu: boolean;
|
||||
hdr: boolean;
|
||||
crf?: number;
|
||||
@@ -54,8 +54,7 @@ export function buildDockerRunArgs(input: DockerRunArgsInput): string[] {
|
||||
options.quality,
|
||||
"--format",
|
||||
options.format,
|
||||
"--workers",
|
||||
String(options.workers),
|
||||
...(options.workers != null ? ["--workers", String(options.workers)] : []),
|
||||
...(options.crf != null ? ["--crf", String(options.crf)] : []),
|
||||
...(options.videoBitrate ? ["--video-bitrate", options.videoBitrate] : []),
|
||||
...(options.quiet ? ["--quiet"] : []),
|
||||
|
||||
Reference in New Issue
Block a user