Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions js/publish/src/audio/encoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,24 +305,33 @@ test("a push completing several frames keeps the encoder running", async () => {
// it, which the catalog advertises as `delay`.
test("a rendition trailing the broadcast's earliest advertises delay", async () => {
using _webcodecs = installFakeWebCodecs();
const baseline = new Baseline();
using env = await setup(baseline);
const { encoder, feed } = env;
const clock = spyOn(performance, "now").mockReturnValue(200);

expect(encoder.out.catalog.peek()?.delay).toBeUndefined();
try {
const baseline = new Baseline();
using env = await setup(baseline);
const { encoder, feed } = env;

// A sibling that flushes each frame the instant it is captured.
baseline.observe(0, performance.now() * 1000);
expect(encoder.out.catalog.peek()?.delay).toBeUndefined();

// Captured 100ms ago, so this rendition flushes at least that late.
const start = performance.now() * 1000 - 100_000;
for (let index = 0; index < 4; index++) {
await feed.push({ timestamp: Time.Micro(start + index * 20_000), channels: [new Float32Array(960)] });
}
await feed.drain();
// A sibling that flushes each frame the instant it is captured.
baseline.observe(0, performance.now() * 1000);

// Captured 100ms ago, with a clock origin that keeps timestamps nonnegative.
const start = performance.now() * 1000 - 100_000;
for (let index = 0; index < 4; index++) {
await feed.push({ timestamp: Time.Micro(start + index * 20_000), channels: [new Float32Array(960)] });
}
await feed.drain();

expect(env.written.length).toBe(2);
expect(encoder.out.catalog.peek()?.delay).toBeGreaterThanOrEqual(100);
expect(env.written).toEqual([
[100_000, 1],
[120_000, 1],
]);
expect(encoder.out.catalog.peek()).toMatchObject({ delay: 100 });
} finally {
clock.mockRestore();
}
});

// Regression: codec settings that can't resolve left the encoder unsettled, so `<moq-publish>` never
Expand Down
1 change: 0 additions & 1 deletion quest/m1/test-flakes-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Public API: none. Wire: none.
- [moq-cli tests on a paused clock](/quest/m1/test-flakes-2/cli-paused-clock.md) - the fetch timeout and completion tests stop racing wall-clock budgets
- [Subscription cut by disconnect](/quest/m1/test-flakes-2/subscription-cut.md) - a publisher disconnect never ends a subscription clean
- [Media late join](/quest/m1/test-flakes-2/media-late-join.md) - `just test media` late join stays within one GOP, or the regression is fixed
- [js/publish audio clock](/quest/m1/test-flakes-2/publish-audio-clock.md) - the audio encoder delay test runs on mock time
- [moq-mux live import clock](/quest/m1/test-flakes-2/mux-live-import-clock.md) - the live import restart tests advance a paused clock instead of sleeping

## Related
Expand Down
11 changes: 0 additions & 11 deletions quest/m1/test-flakes-2/publish-audio-clock.md

This file was deleted.

Loading