mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 15:25:44 +00:00
fix: keep embedded audio in legacy mac mic sidecar exports
This commit is contained in:
@@ -161,6 +161,28 @@ describe("AudioProcessor offline render preparation", () => {
|
||||
expect(renderAndMuxOfflineAudio).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("avoids the single-sidecar fast path for legacy mac mic sidecars that still need embedded audio", async () => {
|
||||
const processor = new AudioProcessor() as unknown as OfflineRenderTestHarness;
|
||||
const loadAudioFileDemuxer = vi.spyOn(processor, "loadAudioFileDemuxer");
|
||||
const renderAndMuxOfflineAudio = vi
|
||||
.spyOn(processor, "renderAndMuxOfflineAudio")
|
||||
.mockResolvedValue();
|
||||
|
||||
await processor.process(
|
||||
{} as never,
|
||||
{} as never,
|
||||
"file:///tmp/recording.mp4",
|
||||
[],
|
||||
[],
|
||||
undefined,
|
||||
[],
|
||||
["/tmp/recording.mic.m4a"],
|
||||
);
|
||||
|
||||
expect(loadAudioFileDemuxer).not.toHaveBeenCalled();
|
||||
expect(renderAndMuxOfflineAudio).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("soft-limits mixed peaks before encoding or WAV conversion", () => {
|
||||
const samples = new Float32Array([
|
||||
-1.6,
|
||||
|
||||
@@ -263,12 +263,18 @@ export class AudioProcessor {
|
||||
videoUrl,
|
||||
sortedSourceAudioFallbackPaths,
|
||||
);
|
||||
const requiresLegacyMacMicSidecarMix =
|
||||
routingPolicy.includeEmbeddedInExport &&
|
||||
!routingPolicy.hasEmbeddedSourceAudio &&
|
||||
routingPolicy.playbackPaths.length === 1 &&
|
||||
routingPolicy.playbackPaths[0]?.toLowerCase().endsWith(".mic.m4a") === true;
|
||||
const hasTimedCompanionAudio = routingPolicy.playbackPaths.some(
|
||||
(audioPath) => (sourceAudioFallbackStartDelayMsByPath?.[audioPath] ?? 0) > 0,
|
||||
);
|
||||
const needsSourceAudioMixing =
|
||||
routingPolicy.playbackPaths.length > 1 ||
|
||||
(routingPolicy.hasEmbeddedSourceAudio && routingPolicy.playbackPaths.length > 0) ||
|
||||
requiresLegacyMacMicSidecarMix ||
|
||||
hasTimedCompanionAudio;
|
||||
|
||||
// When speed edits, audio regions, or multiple audio sources need mixing, use offline AudioContext pipeline.
|
||||
|
||||
Reference in New Issue
Block a user