fix(recording): keep embedded audio fallbacks safe

This commit is contained in:
wiiiii123
2026-05-13 02:41:08 +07:00
parent 2cd139ae4d
commit e8b81c71ff
3 changed files with 7 additions and 7 deletions
+1 -2
View File
@@ -512,8 +512,7 @@ export async function getCompanionAudioFallbackInfo(videoPath: string) {
new Set(
companionCandidates.flatMap((candidate) =>
candidate.usablePaths.filter(
(companionPath) =>
companionPath === candidate.micPath || companionPath === candidate.systemPath,
(companionPath) => companionPath === candidate.micPath,
),
),
),
+2 -2
View File
@@ -82,11 +82,11 @@ async function loadSavedProjectMediaPaths() {
editor?: { webcam?: { sourcePath?: unknown } };
}>(await fs.readFile(projectPath, "utf-8"));
} catch (error) {
console.warn("[prune] Skipping unreadable project while pruning recordings", {
console.warn("[prune] Aborting recording prune because a saved project is unreadable", {
projectPath,
error,
});
return;
throw error;
}
const candidatePaths = [
rawProject.videoPath,
+4 -3
View File
@@ -14,8 +14,8 @@ type OfflineRenderTestHarness = AudioProcessor & {
sourceAudioFallbackPaths: string[],
sourceAudioFallbackStartDelayMsByPath?: Record<string, number>,
): Promise<{
mainBuffer: AudioBuffer | null;
companionEntries: Array<{ buffer: AudioBuffer; startDelaySec: number }>;
mainBufferEntry: { buffer: AudioBuffer; gain: number } | null;
companionEntries: Array<{ buffer: AudioBuffer; startDelaySec: number; gain: number }>;
}>;
renderAndMuxOfflineAudio(
videoUrl: string,
@@ -55,7 +55,8 @@ describe("AudioProcessor offline render preparation", () => {
["/tmp/recording.mp4", "/tmp/recording.mic.wav"],
);
expect(prepared.mainBuffer).toBe(mainBuffer);
expect(prepared.mainBufferEntry?.buffer).toBe(mainBuffer);
expect(prepared.mainBufferEntry?.gain).toBe(1);
expect(prepared.companionEntries).toHaveLength(1);
expect(prepared.companionEntries[0]?.buffer).toBe(micBuffer);
expect(decodeAudioFromUrl).toHaveBeenCalledWith("file:///tmp/recording.mp4");