refactor: simplify review fixes for WebM PR

- Use static import for copyFileSync (was unnecessary dynamic import)
- Shallow-copy config before mutating forceScreenshot (prevents
  caller-provided config from being permanently modified)
- Consolidate isWebm/isWebmRender/outputFormat into single early
  declaration in renderOrchestrator
- Fix debug output extension for WebM (was hardcoded .mp4)
- Log unexpected audio extraction errors instead of silently swallowing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
James
2026-03-27 03:40:35 +00:00
co-authored by Claude Opus 4.6
parent 684b103ba4
commit 83d11ac595
3 changed files with 16 additions and 15 deletions
+1 -3
View File
@@ -6,7 +6,7 @@
*/
import { spawn } from "child_process";
import { existsSync, mkdirSync, readdirSync, statSync, writeFileSync } from "fs";
import { copyFileSync, existsSync, mkdirSync, readdirSync, statSync, writeFileSync } from "fs";
import { join, dirname } from "path";
import { DEFAULT_CONFIG, type EngineConfig } from "../config.js";
import { type GpuEncoder, getCachedGpuEncoder, getGpuEncoderName } from "../utils/gpuEncoder.js";
@@ -414,8 +414,6 @@ export async function applyFaststart(
): Promise<MuxResult> {
// faststart is MP4-only (moves moov atom to file start for streaming)
if (outputPath.endsWith(".webm")) {
// For WebM, just copy the file as-is
const { copyFileSync } = await import("fs");
if (inputPath !== outputPath) copyFileSync(inputPath, outputPath);
return { success: true, outputPath, durationMs: 0 };
}