fix(render): preserve normalized M4A edit timing

This commit is contained in:
Miguel Ángel
2026-07-25 21:14:17 +00:00
parent 113a4985b5
commit 59c56d3257
2 changed files with 30 additions and 1 deletions
@@ -418,6 +418,30 @@ describe("muxVideoWithAudio audio codec handling", () => {
});
});
it("preserves M4A priming edit lists instead of shifting copied video", async () => {
const { spawn, calls } = createSpawnSpy();
vi.resetModules();
vi.doMock("child_process", () => ({ spawn }));
const { muxVideoWithAudio } = await import("./chunkEncoder.js");
const muxPromise = muxVideoWithAudio(
"/tmp/video-only.mp4",
"/tmp/audio.duration-normalized.m4a",
"/tmp/output.mp4",
undefined,
{ audioCodec: "aac" },
{ num: 30, den: 1 },
);
await flushMuxCodecResolution();
expect(calls).toHaveLength(1);
expect(calls[0]!.args).toContain("copy");
expect(calls[0]!.args).not.toContain("-avoid_negative_ts");
emitClose(calls[0]!.proc, 0);
await expect(muxPromise).resolves.toMatchObject({ success: true });
});
it("uses the caller-provided AAC codec contract instead of the sidecar extension", async () => {
const { spawn, calls } = createSpawnSpy();
vi.resetModules();