From 7934c03490dccc5d64635611a11db455e49d0314 Mon Sep 17 00:00:00 2001 From: wiiiii123 Date: Wed, 13 May 2026 03:40:27 +0700 Subject: [PATCH] chore(export): add nvidia cuda dev launcher --- package.json | 1 + scripts/dev-nvidia-cuda.mjs | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 scripts/dev-nvidia-cuda.mjs diff --git a/package.json b/package.json index c0e30642..5d06568f 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "type": "module", "scripts": { "dev": "vite --config vite.config.ts", + "dev:nvidia-cuda": "node scripts/dev-nvidia-cuda.mjs", "postinstall": "node scripts/postinstall.mjs", "build": "npm run build:platform-native-helpers && tsc && vite build --config vite.config.ts && npm run normalize:electron-main-cjs && npm run smoke:electron-main-cjs && electron-builder", "lint": "biome check .", diff --git a/scripts/dev-nvidia-cuda.mjs b/scripts/dev-nvidia-cuda.mjs new file mode 100644 index 00000000..7d24ffee --- /dev/null +++ b/scripts/dev-nvidia-cuda.mjs @@ -0,0 +1,46 @@ +import { spawn } from "node:child_process"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm"; +const env = { + ...process.env, + RECORDLY_EXPERIMENTAL_NVIDIA_CUDA_EXPORT: "1", + RECORDLY_NATIVE_EXPORT_DIAGNOSTICS: + process.env.RECORDLY_NATIVE_EXPORT_DIAGNOSTICS ?? "always", + RECORDLY_NVIDIA_CUDA_EXPORT_DIAGNOSTICS: "1", + RECORDLY_NVIDIA_CUDA_EXPORT_HIGH_PRIORITY: "1", + RECORDLY_NVIDIA_CUDA_FORCE_VIDEO_ONLY: "1", + RECORDLY_NVIDIA_CUDA_SAMPLE_GPU: "1", +}; + +delete env.RECORDLY_NVIDIA_CUDA_ALLOW_AUDIO_EXPORT; + +const diagnosticsHint = + process.platform === "win32" && process.env.APPDATA + ? path.join(process.env.APPDATA, "Recordly-dev", "native-export-diagnostics") + : "the Recordly-dev native-export-diagnostics userData folder"; + +console.log("Starting Recordly dev with guarded NVIDIA CUDA/NVENC export enabled."); +console.log("CUDA mode: video-only native render, then shared app audio mux."); +console.log(`Diagnostics: ${diagnosticsHint}`); + +const child = spawn(npmCommand, ["run", "dev"], { + cwd: repoRoot, + env, + stdio: "inherit", +}); + +child.on("exit", (code, signal) => { + if (signal) { + process.kill(process.pid, signal); + return; + } + process.exit(code ?? 0); +}); + +child.on("error", (error) => { + console.error("Failed to launch Recordly dev:", error); + process.exit(1); +});