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
21 changes: 21 additions & 0 deletions js/watch/src/audio/decoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,27 @@ for (const cmaf of [false, true]) {
});
}

it("rejoins the clock after decoding returns from absence", async () => {
const playback = await play(Duration.millis(100));
const reanchor = spyOn(playback.sync, "reset");
try {
await playback.play(12);
const [ring] = playback.rings();
expect(ring.read([new Float32Array(128), new Float32Array(128)])).toBe(128);
playback.decoding.set(false);
await microtasks();
playback.decoding.set(true);
await microtasks();
expect(playback.resets()).toBe(1);
expect(ring.length).toBe(0);
expect(reanchor).not.toHaveBeenCalled();
await playback.play();
expect(playback.rings()).toEqual([ring]);
} finally {
playback.close();
}
});

describe("Decoder across a broadcast disable", () => {
it("releases the graph when its broadcast is disabled and rebuilds on return", async () => {
const playback = await play(Duration.millis(100));
Expand Down
17 changes: 11 additions & 6 deletions js/watch/src/audio/decoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,21 +576,26 @@ export class Decoder {
});

// Another broadcast (a new name, or a republish) brings its own timeline, which a ring and a
// clock anchored on the previous one would discard as already played. A return to the same
// instance keeps the anchor, so the relay's redelivered last group is still dropped as old.
// clock anchored on the previous one would discard as already played.
// Every handle to one instance shares `closed`, so it identifies the instance where the
// handle itself does not.
if (this.#instance !== undefined && this.#instance !== active.closed) {
this.sync.reset();
this.reset();
} else if (this.#instance !== undefined && phase.kind === "stopped") {
// The picture returns at the live edge. Re-join audio to that clock immediately,
// rather than stretching the retained ring's lag back over several seconds. A
// running rendition swap keeps its seamless handover.
this.reset();
Comment thread
pullfrog[bot] marked this conversation as resolved.
Resolved
}
this.#instance = active.closed;

// The ring outlives this effect (it's keyed on the sample rate, channel count, and mode), so a
// replacement subscription on the same broadcast (a rendition swap, a return from an absence)
// inherits whatever its predecessor decoded. Samples are timestamp indexed, so the replacement
// overwrites the slots it lands on, but a publisher writing ahead of real-time leaves seconds
// of tail beyond them. Drop that once the replacement's first frame says where it starts.
// replacement subscription on the same broadcast (a rendition swap, or a fallback that stays
// running) inherits whatever its predecessor decoded; a return from an absence was reset above.
// Samples are timestamp indexed, so the replacement overwrites the slots it lands on, but a
// publisher writing ahead of real-time leaves seconds of tail beyond them. Drop that once the
// replacement's first frame says where it starts.
this.#handover.opened();

effect.run((run) => {
Expand Down
6 changes: 3 additions & 3 deletions quest/m0/interop-green/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Interop and Video pass on main
# [XS] Interop and Video pass on main

## Goal

Expand All @@ -11,7 +11,7 @@ so it only needs to stay green.
## Waiting

- moq-dev/moq: the next scheduled Interop run on `main` passes, once the
[resumed-audio child](/quest/m0/interop-green/resume-sync.md) lands
[resumed-audio fix](https://github.com/moq-dev/moq/pull/8635) lands
([moq-dev/moq#8572](https://github.com/moq-dev/moq/pull/8572), the max-age
fix, merged 2026-11-12). Check
with `gh run list --repo moq-dev/moq --workflow interop.yml --event schedule`,
Expand Down Expand Up @@ -184,7 +184,7 @@ Scheduled run
picture by about 1.7 s. [moq-dev/moq#8507](https://github.com/moq-dev/moq/pull/8507)
keeps audio that trails the clock up to its 2 s stretch bound and plays it
faster, and a resume keeps the ring it had. Fixed by the child
[resumed audio snaps to the clock](/quest/m0/interop-green/resume-sync.md),
[resumed audio snaps to the clock](https://github.com/moq-dev/moq/pull/8635),
decided 2026-11-12 (maintainer) to snap to the live picture rather than
stretch the lag back.

Expand Down
26 changes: 0 additions & 26 deletions quest/m0/interop-green/resume-sync.md

This file was deleted.

2 changes: 1 addition & 1 deletion quest/m0/nightly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ more children, all in m0. Owned elsewhere: the fuzz build
([moq-dev/moq#8657](https://github.com/moq-dev/moq/pull/8657)), the Python
audit ([moq-dev/moq#8648](https://github.com/moq-dev/moq/pull/8648)), the size
report's output ([moq-dev/moq#8654](https://github.com/moq-dev/moq/pull/8654)),
the firefox resume ([resume sync](/quest/m0/interop-green/resume-sync.md)),
the firefox resume ([moq-dev/moq#8635](https://github.com/moq-dev/moq/pull/8635)),
and the chromium `av_lag` rows
([output latency](/quest/m2/audio-playout/output-latency.md) and
[congestion catch-up](/quest/m2/audio-playout/congestion-catch-up.md)).
Expand Down
2 changes: 1 addition & 1 deletion quest/m2/audio-playout/congestion-catch-up.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ native in the PR.

## Related

- [Resume sync](/quest/m0/interop-green/resume-sync.md) - snaps resumed audio to the clock, the same rule for a return from absence
- [moq-dev/moq#8635](https://github.com/moq-dev/moq/pull/8635) - snaps resumed audio to the clock, the same rule for a return from absence