Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

fix(export): gate packaged cuda audio fallback

wiiiii123cc4adb13f00b
diff --git a/electron/ipc/export/native-video.test.ts b/electron/ipc/export/native-video.test.ts
index be54d364..6508e6d2 100644
--- a/electron/ipc/export/native-video.test.ts
+++ b/electron/ipc/export/native-video.test.ts
@@ -449,6 +449,49 @@ describe("getExperimentalNvidiaCudaExportSkipReason", () => {
}
});
+ it("does not use packaged auto-candidate audio bypass when CUDA is explicitly enabled", async () => {
+ const exportEnvName = "RECORDLY_EXPERIMENTAL_NVIDIA_CUDA_EXPORT";
+ const forceEnvName = "RECORDLY_NVIDIA_CUDA_FORCE_VIDEO_ONLY";
+ const allowAudioEnvName = "RECORDLY_NVIDIA_CUDA_ALLOW_AUDIO_EXPORT";
+ const originalExportEnv = process.env[exportEnvName];
+ const originalForceEnv = process.env[forceEnvName];
+ const originalAllowAudioEnv = process.env[allowAudioEnvName];
+ const originalIsPackaged = electronAppMock.isPackaged;
+ electronAppMock.isPackaged = true;
+ process.env[exportEnvName] = "1";
+ delete process.env[forceEnvName];
+ delete process.env[allowAudioEnvName];
+
+ try {
+ const reason = await getExperimentalNvidiaCudaExportSkipReason(
+ createNvidiaCudaSkipOptions({
+ audioOptions: { audioMode: "copy-source", audioSourcePath: "input.mp4" },
+ }),
+ );
+
+ expect(reason).toBe(
+ process.platform === "win32" ? "audio-mode:copy-source" : "not-windows",
+ );
+ } finally {
+ if (originalExportEnv === undefined) {
+ delete process.env[exportEnvName];
+ } else {
+ process.env[exportEnvName] = originalExportEnv;
+ }
+ if (originalForceEnv === undefined) {
+ delete process.env[forceEnvName];
+ } else {
+ process.env[forceEnvName] = originalForceEnv;
+ }
+ if (originalAllowAudioEnv === undefined) {
+ delete process.env[allowAudioEnvName];
+ } else {
+ process.env[allowAudioEnvName] = originalAllowAudioEnv;
+ }
+ electronAppMock.isPackaged = originalIsPackaged;
+ }
+ });
+
it("skips packaged CUDA auto-candidates when Electron reports no NVIDIA GPU", async () => {
const reason = await withPackagedCudaCandidate(
{ gpuDevice: [{ vendorId: 0x8086, deviceString: "Intel UHD Graphics" }] },
diff --git a/electron/ipc/export/native-video.ts b/electron/ipc/export/native-video.ts
index 13adbdd2..0f9e36f6 100644
--- a/electron/ipc/export/native-video.ts
+++ b/electron/ipc/export/native-video.ts
@@ -2010,15 +2010,16 @@ export async function getExperimentalNvidiaCudaExportSkipReason(
return "not-windows";
}
const explicitCuda = isExplicitNvidiaCudaExportEnabled();
- const packagedAutoCandidate = isPackagedNvidiaCudaExportAutoCandidateEnabled();
- if (!explicitCuda && !packagedAutoCandidate) {
+ const packagedAutoCandidateEnabled = isPackagedNvidiaCudaExportAutoCandidateEnabled();
+ const packagedAutoCandidateActive = isPackagedNvidiaCudaExportAutoCandidateActive();
+ if (!explicitCuda && !packagedAutoCandidateEnabled) {
return "env-disabled";
}
if (!options.experimentalWindowsGpuCompositor) {
return "windows-gpu-compositor-disabled";
}
- if (packagedAutoCandidate && !explicitCuda) {
+ if (packagedAutoCandidateActive) {
if (!(await resolveExperimentalNvidiaCudaExportScriptPath())) {
return "cuda-wrapper-unavailable";
}
@@ -2029,7 +2030,7 @@ export async function getExperimentalNvidiaCudaExportSkipReason(
return getNvidiaCudaAudioExportSkipReason(options.audioOptions?.audioMode, {
allowValidatedFallbackCandidate:
- packagedAutoCandidate || isNvidiaCudaForceVideoOnlyEnabled(),
+ packagedAutoCandidateActive || isNvidiaCudaForceVideoOnlyEnabled(),
});
}