mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 06:30:03 +00:00
fix(producer): propagate audio mixer config (#3239)
* fix(producer): forward ffmpeg timeout to audio mixer * fix(producer): propagate audio gain with timeout
This commit is contained in:
@@ -1063,6 +1063,8 @@ export async function buildLocalExecutionPlan(
|
||||
workDir,
|
||||
compiledDir,
|
||||
duration: job.duration,
|
||||
ffmpegProcessTimeout: cfg.ffmpegProcessTimeout,
|
||||
audioGain: cfg.audioGain,
|
||||
audios: composition.audios,
|
||||
abortSignal,
|
||||
assertNotAborted,
|
||||
|
||||
@@ -39,6 +39,8 @@ describe("runAudioStage", () => {
|
||||
workDir,
|
||||
compiledDir: join(workDir, "compiled"),
|
||||
duration: 5,
|
||||
ffmpegProcessTimeout: 3_600_000,
|
||||
audioGain: 1,
|
||||
audios,
|
||||
abortSignal: undefined,
|
||||
assertNotAborted: () => {},
|
||||
@@ -72,6 +74,16 @@ describe("runAudioStage", () => {
|
||||
expect(result.audioFailures).toEqual([
|
||||
expect.objectContaining({ reason: "source_not_found", stage: "source" }),
|
||||
]);
|
||||
expect(processCompositionAudioMock).toHaveBeenCalledWith(
|
||||
audios,
|
||||
expect.any(String),
|
||||
expect.any(String),
|
||||
expect.any(String),
|
||||
5,
|
||||
undefined,
|
||||
{ ffmpegProcessTimeout: 3_600_000, audioGain: 1 },
|
||||
expect.any(String),
|
||||
);
|
||||
});
|
||||
|
||||
it("falls back to a generic message when the mixer fails without an error string", async () => {
|
||||
|
||||
@@ -33,6 +33,10 @@ export interface AudioStageInput {
|
||||
compiledDir: string;
|
||||
/** Composition duration (post-probe). Must be > 0 — probeStage guarantees this. */
|
||||
duration: number;
|
||||
/** Timeout forwarded to ffmpeg subprocesses used by the audio mixer. */
|
||||
ffmpegProcessTimeout: number;
|
||||
/** Master gain forwarded to the audio mixer. */
|
||||
audioGain: number;
|
||||
/** Read-only view of `composition.audios`. */
|
||||
audios: CompositionMetadata["audios"];
|
||||
abortSignal: AbortSignal | undefined;
|
||||
@@ -59,8 +63,18 @@ export interface AudioStageResult {
|
||||
}
|
||||
|
||||
export async function runAudioStage(input: AudioStageInput): Promise<AudioStageResult> {
|
||||
const { projectDir, workDir, compiledDir, duration, audios, abortSignal, assertNotAborted, log } =
|
||||
input;
|
||||
const {
|
||||
projectDir,
|
||||
workDir,
|
||||
compiledDir,
|
||||
duration,
|
||||
ffmpegProcessTimeout,
|
||||
audioGain,
|
||||
audios,
|
||||
abortSignal,
|
||||
assertNotAborted,
|
||||
log,
|
||||
} = input;
|
||||
|
||||
const stage3Start = Date.now();
|
||||
const audioOutputPath = join(workDir, MIXED_AUDIO_FILENAME);
|
||||
@@ -84,7 +98,7 @@ export async function runAudioStage(input: AudioStageInput): Promise<AudioStageR
|
||||
audioOutputPath,
|
||||
duration,
|
||||
abortSignal,
|
||||
undefined,
|
||||
{ ffmpegProcessTimeout, audioGain },
|
||||
compiledDir,
|
||||
);
|
||||
} catch (err) {
|
||||
|
||||
@@ -2529,6 +2529,8 @@ async function executeRenderPipeline(input: {
|
||||
workDir,
|
||||
compiledDir,
|
||||
duration: probeResult.duration,
|
||||
ffmpegProcessTimeout: cfg.ffmpegProcessTimeout,
|
||||
audioGain: cfg.audioGain,
|
||||
audios: composition.audios,
|
||||
abortSignal: executionSignal,
|
||||
assertNotAborted,
|
||||
|
||||
Reference in New Issue
Block a user