mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-05 00:56:23 +00:00
fix(producer): fail renders when audio mixing fails (#2429)
This commit is contained in:
@@ -74,9 +74,9 @@ describe("distributed warning policy", () => {
|
|||||||
expect(job.warnings.map((warning) => warning.code)).toEqual(["audio_processing_failed"]);
|
expect(job.warnings.map((warning) => warning.code)).toEqual(["audio_processing_failed"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("records distributed audio degradation in best-effort mode", () => {
|
it("rejects distributed audio degradation in best-effort mode", () => {
|
||||||
const job = createJob("best-effort");
|
const job = createJob("best-effort");
|
||||||
expect(() => applyDistributedAudioWarningPolicy(job, "mix failed")).not.toThrow();
|
expect(() => applyDistributedAudioWarningPolicy(job, "mix failed")).toThrow(RenderQualityError);
|
||||||
expect(job.warnings.map((warning) => warning.code)).toEqual(["audio_processing_failed"]);
|
expect(job.warnings.map((warning) => warning.code)).toEqual(["audio_processing_failed"]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ describe("updateJobStatus", () => {
|
|||||||
expect(job.warnings).toHaveLength(1);
|
expect(job.warnings).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("preserves best-effort behavior when strictness is omitted", () => {
|
it("blocks audio processing failures when strictness is omitted", () => {
|
||||||
const job = createRenderJob({ fps: 30, quality: "high" });
|
const job = createRenderJob({ fps: 30, quality: "high" });
|
||||||
const log = { error: vi.fn(), warn: vi.fn(), info: vi.fn(), debug: vi.fn() };
|
const log = { error: vi.fn(), warn: vi.fn(), info: vi.fn(), debug: vi.fn() };
|
||||||
expect(() =>
|
expect(() =>
|
||||||
@@ -143,7 +143,7 @@ describe("updateJobStatus", () => {
|
|||||||
],
|
],
|
||||||
log,
|
log,
|
||||||
),
|
),
|
||||||
).not.toThrow();
|
).toThrow(RenderQualityError);
|
||||||
expect(job.config.strictness).toBe("best-effort");
|
expect(job.config.strictness).toBe("best-effort");
|
||||||
expect(job.warnings).toHaveLength(1);
|
expect(job.warnings).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -558,7 +558,10 @@ export function applyRenderWarningPolicy(
|
|||||||
strictness,
|
strictness,
|
||||||
warningCodes: job.warnings.map((warning) => warning.code),
|
warningCodes: job.warnings.map((warning) => warning.code),
|
||||||
});
|
});
|
||||||
if (strictness === "strict") {
|
const hasAudioProcessingFailure = job.warnings.some(
|
||||||
|
(warning) => warning.code === "audio_processing_failed",
|
||||||
|
);
|
||||||
|
if (strictness === "strict" || hasAudioProcessingFailure) {
|
||||||
throw new RenderQualityError(job.warnings);
|
throw new RenderQualityError(job.warnings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user