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,
|
workDir,
|
||||||
compiledDir,
|
compiledDir,
|
||||||
duration: job.duration,
|
duration: job.duration,
|
||||||
|
ffmpegProcessTimeout: cfg.ffmpegProcessTimeout,
|
||||||
|
audioGain: cfg.audioGain,
|
||||||
audios: composition.audios,
|
audios: composition.audios,
|
||||||
abortSignal,
|
abortSignal,
|
||||||
assertNotAborted,
|
assertNotAborted,
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ describe("runAudioStage", () => {
|
|||||||
workDir,
|
workDir,
|
||||||
compiledDir: join(workDir, "compiled"),
|
compiledDir: join(workDir, "compiled"),
|
||||||
duration: 5,
|
duration: 5,
|
||||||
|
ffmpegProcessTimeout: 3_600_000,
|
||||||
|
audioGain: 1,
|
||||||
audios,
|
audios,
|
||||||
abortSignal: undefined,
|
abortSignal: undefined,
|
||||||
assertNotAborted: () => {},
|
assertNotAborted: () => {},
|
||||||
@@ -72,6 +74,16 @@ describe("runAudioStage", () => {
|
|||||||
expect(result.audioFailures).toEqual([
|
expect(result.audioFailures).toEqual([
|
||||||
expect.objectContaining({ reason: "source_not_found", stage: "source" }),
|
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 () => {
|
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;
|
compiledDir: string;
|
||||||
/** Composition duration (post-probe). Must be > 0 — probeStage guarantees this. */
|
/** Composition duration (post-probe). Must be > 0 — probeStage guarantees this. */
|
||||||
duration: number;
|
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`. */
|
/** Read-only view of `composition.audios`. */
|
||||||
audios: CompositionMetadata["audios"];
|
audios: CompositionMetadata["audios"];
|
||||||
abortSignal: AbortSignal | undefined;
|
abortSignal: AbortSignal | undefined;
|
||||||
@@ -59,8 +63,18 @@ export interface AudioStageResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function runAudioStage(input: AudioStageInput): Promise<AudioStageResult> {
|
export async function runAudioStage(input: AudioStageInput): Promise<AudioStageResult> {
|
||||||
const { projectDir, workDir, compiledDir, duration, audios, abortSignal, assertNotAborted, log } =
|
const {
|
||||||
input;
|
projectDir,
|
||||||
|
workDir,
|
||||||
|
compiledDir,
|
||||||
|
duration,
|
||||||
|
ffmpegProcessTimeout,
|
||||||
|
audioGain,
|
||||||
|
audios,
|
||||||
|
abortSignal,
|
||||||
|
assertNotAborted,
|
||||||
|
log,
|
||||||
|
} = input;
|
||||||
|
|
||||||
const stage3Start = Date.now();
|
const stage3Start = Date.now();
|
||||||
const audioOutputPath = join(workDir, MIXED_AUDIO_FILENAME);
|
const audioOutputPath = join(workDir, MIXED_AUDIO_FILENAME);
|
||||||
@@ -84,7 +98,7 @@ export async function runAudioStage(input: AudioStageInput): Promise<AudioStageR
|
|||||||
audioOutputPath,
|
audioOutputPath,
|
||||||
duration,
|
duration,
|
||||||
abortSignal,
|
abortSignal,
|
||||||
undefined,
|
{ ffmpegProcessTimeout, audioGain },
|
||||||
compiledDir,
|
compiledDir,
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -2529,6 +2529,8 @@ async function executeRenderPipeline(input: {
|
|||||||
workDir,
|
workDir,
|
||||||
compiledDir,
|
compiledDir,
|
||||||
duration: probeResult.duration,
|
duration: probeResult.duration,
|
||||||
|
ffmpegProcessTimeout: cfg.ffmpegProcessTimeout,
|
||||||
|
audioGain: cfg.audioGain,
|
||||||
audios: composition.audios,
|
audios: composition.audios,
|
||||||
abortSignal: executionSignal,
|
abortSignal: executionSignal,
|
||||||
assertNotAborted,
|
assertNotAborted,
|
||||||
|
|||||||
Reference in New Issue
Block a user