mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
fix(engine): render work is sized by the CPUs the process may use (#7612)
* fix(engine): render work is sized by the CPUs the process may use * fix(engine): keep the usable CPU count comment under the line limit
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { availableParallelism } from "node:os";
|
||||
import { usableCpuCount } from "./systemMemory.js";
|
||||
|
||||
export const X265_MAX_THREADS = 16;
|
||||
|
||||
@@ -6,7 +6,7 @@ export const X265_MAX_THREADS = 16;
|
||||
export function appendSoftwareEncoderThreadsArg(
|
||||
args: string[],
|
||||
encoder: "libx264" | "libx265",
|
||||
parallelism: number = availableParallelism(),
|
||||
parallelism: number = usableCpuCount(),
|
||||
): void {
|
||||
const cap = encoder === "libx265" ? X265_MAX_THREADS : Infinity;
|
||||
args.push("-threads", String(Math.min(cap, Math.max(1, Math.floor(parallelism)))));
|
||||
|
||||
Reference in New Issue
Block a user