Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f8d920f
chore(quest): claim quest/m2/unused-api/net.md
kixelated Nov 19, 2026
2c20755
quest(unused-api/net): design the container reader's move onto Ordered
kixelated Nov 19, 2026
384500f
quest(unused-api/net): record B and the two decisions it leaves open
kixelated Nov 19, 2026
ffb0957
feat(moq-net)!: an ordered gap says when what it gave up landed, and …
kixelated Nov 19, 2026
92aa113
feat(moq-mux)!: the container reader reads through Ordered, which giv…
kixelated Nov 19, 2026
2f78356
quest(unused-api/net): the sweep finishes; follow up on moq-audio's e…
kixelated Nov 19, 2026
ba3bd08
feat(net,hang)!: an ordered gap says when what it gave up landed, and…
kixelated Nov 19, 2026
c5f9a9f
fix: the audio-quality JS client reads the join without Subscriber.st…
kixelated Nov 19, 2026
b4dcb3d
test(libmoq): the warmup keeps the history a newest-first backlog alr…
kixelated Nov 19, 2026
e942a91
test(moq-cli): a press after a lost group plays one delay out, since …
kixelated Nov 19, 2026
d1e0b48
quest(audio-playout): the browser's estimate observes landings throug…
kixelated Nov 19, 2026
9d0ac97
fix(moq-audio,hang): the playout estimate times packets by landing, a…
kixelated Nov 19, 2026
9dc6c97
style: format
kixelated Nov 19, 2026
911f8a0
test(hang): the open-group decode fault test runs on the Manual clock
kixelated Nov 19, 2026
5695fc8
Merge origin/main into quest/m2/unused-api/net
kixelated Nov 20, 2026
134c68d
fix(hang,mux): a gap reaching past the join folds no backlog; the buf…
kixelated Nov 20, 2026
491bc8f
docs(bindings): max is how far newer media runs past a missing group,…
kixelated Nov 20, 2026
0e36d35
fix(mux): an aborted group keeps an endpoint it already decoded
kixelated Nov 20, 2026
1fda6e8
style: format the new test and Kotlin doc
kixelated Nov 20, 2026
1cb4d72
fix(mux): the join is taken from the subscription's answer, not the f…
kixelated Nov 20, 2026
35f634b
fix(hang,audio): a step onto an open head waits for its first frame, …
kixelated Nov 20, 2026
daadb9b
style(audio): destructure the jitter traces with array map
kixelated Nov 20, 2026
749af26
fix(hang): a gap given up ahead of the first group waits for the join…
kixelated Nov 20, 2026
b6c3326
Merge remote-tracking branch 'origin/main' into HEAD
kixelated Nov 20, 2026
576021a
fix(audio): a packet held behind a hole keeps its landing time
kixelated Nov 20, 2026
f08d13f
Merge remote-tracking branch 'origin/main' into HEAD
kixelated Nov 20, 2026
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
13 changes: 7 additions & 6 deletions dart/moq/lib/src/aliases.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,14 @@ extension type Timestamp._(MoqTimestamp _timestamp) implements MoqTimestamp {

/// How far behind the live edge a subscriber or decoder plays: where it starts, and how late it may fall.
extension type Delay._(MoqDelay _delay) implements MoqDelay {
/// `min` is the target latency, where a cold join starts, and how long a decoder waits for a
/// missing group, and `max` is how far a non-latest group may fall behind before it is skipped.
/// `min` is the target latency, where a cold join starts, and `max` is how far a non-latest
/// group may fall behind before it is skipped, and how far newer media may run past a missing
/// group before a decoder gives it up.
/// Both default to zero, moq-net's default. An explicit null `min` leaves it unstated, which a
/// decoder starts as zero, waiting a missing group for `max` instead (an audio decoder floors it
/// at zero and waits only its playout estimate, which can be larger; a catalog warmup or an audio
/// decoder's playout delay still states a `min` to the publisher), and an
/// explicit null `max` sets no subscriber limit. A `min` past `max` starts at `max`.
/// decoder starts as zero (a catalog warmup or an audio decoder's playout delay still states a
/// `min` to the publisher), and an explicit null `max` sets no subscriber limit. A `min` past
/// `max` starts a cold join no further back than the group covering the point `max` behind the
/// live edge.
Delay({Duration? min = Duration.zero, Duration? max = Duration.zero})
: this._(MoqDelay(min: min, max: max));
}
Expand Down
12 changes: 6 additions & 6 deletions doc/concept/audio-jitter.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ Natively that holds only as far as the caller lets it. The container consumer
reads groups in sequence order and applies its age budget inside `read()`, so a
group skipped for age is never observed, and a frame queued behind a stalled
group is observed when the stall clears. A missing group, one that has delivered
no frame, is waited for only the playout delay, the subscription's `delay.min`,
since past that it would play late: a reordered backlog's holes waited out to the whole budget
would delay the frames behind them, which the estimator would measure as
jitter. The browser player leaves the hole to the transport: it reads its audio
no frame, is given up by the subscription's `delay.max` alone, like any stale
group; `delay.min` only sets where a join starts. Each frame is timed by when it
landed in the node's cache, not when the read reached it, so the frames a hole
holds back read as on time rather than as jitter. The browser player leaves the hole to the transport: it reads its audio
through an ordered track reader whose own `delay.max` is what the ring holds of
the delay plus the stretch threshold, past which the ring would skip the hole's
audio anyway, and plays each gap that reader reports as the hole. The reader
Expand Down Expand Up @@ -115,7 +115,7 @@ observe(arrival, media):
push (arrival, media) onto history

fastest = min over history of (entry.arrival - entry.media)
if first observation: start = arrival; joined = arrival
if first observation: start = arrival; joined = max(joined, arrival)
elif media + fastest < start: # produced before the subscription: backlog
joined = max(joined, arrival)

Expand Down Expand Up @@ -165,7 +165,7 @@ settle(): # a stall is one observation
fold(stall.bucket); fold(nothing) min(stall.span, IDLE_MAX) times; close it

backlog(arrival): # a backlog group skipped unread arrived
if not first observation and open:
if open: # before the first observation too: it may land later
joined = max(joined, arrival)

end(): # a declared end precedes the next observation
Expand Down
13 changes: 5 additions & 8 deletions go/wrapper/records.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,12 @@ type DatagramInfo = ffi.MoqDatagramInfo
// starts at the newest group and skips a superseded group at once.
type Delay struct {
// Min is the target latency: the playout or jitter-buffer delay held behind the live edge,
// where a cold join starts, and how long a decoder waits for a missing group. A Min past Max
// starts and waits at Max, since the publisher serves nothing older. moq-lite-07 sends it
// upstream.
// where a cold join starts. A missing group is given up by Max alone. A Min past Max starts a
// cold join no further back than the group covering the point Max behind the live edge, since the publisher serves no older group. moq-lite-07 sends it upstream.
Min time.Duration
// MinUnstated leaves Min unstated, ignoring it. A decoder starts it as zero and waits a
// missing group for Max (an audio decoder floors it at zero and waits only its playout
// estimate, which can be larger), while the subscription keeps it unstated, so it never
// pulls the aggregate across subscribers to zero, unless a catalog warmup or an audio
// decoder's playout delay states one.
// MinUnstated leaves Min unstated, ignoring it. A decoder starts it as zero, while the
// subscription keeps it unstated, so it never pulls the aggregate across subscribers to
// zero, unless a catalog warmup or an audio decoder's playout delay states one.
MinUnstated bool
// Max is how far a non-latest group may fall behind the live edge before it is skipped. Zero
// skips immediately; a larger value tolerates that much reordering. It caps every range,
Expand Down
6 changes: 0 additions & 6 deletions js/hang/api/container.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export interface ConsumerProps {
delay?: Signals.GetterInit<Net.Track.Delay>;
format: Format;
ordered?: Net.Track.Ordered;
playhead?: Playhead;
predecessor?: Consumer;
warmup?: Net.Clock.Duration;
}
Expand Down Expand Up @@ -80,11 +79,6 @@ export * as Loc from "@moq/loc";

export const MAX_AGE: Net.Clock.Duration;

export interface Playhead {
readonly anchor: Signals.Getter<unknown>;
now(): Net.Clock.Duration | undefined;
}

export type Read = {
frame: ReceivedFrame;
group: bigint;
Expand Down
35 changes: 15 additions & 20 deletions js/hang/bench/buffered.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,21 @@ function wire(group: number, frame: number): Group.Frame {
function open(track: Track.Producer, delay: Signal<Track.Delay>): Player {
const subscriber = track.subscribe({ delay: { max: HOLD } });
const received: Group.Consumer[] = [];
const recv = subscriber.recvGroup.bind(subscriber);
subscriber.recvGroup = async () => {
const group = await recv();
if (group) received.push(group);
return group;
// The consumer reads through the subscriber's ordered read, so that is where groups arrive.
const ordered = subscriber.ordered.bind(subscriber);
subscriber.ordered = () => {
const reader = ordered();
const next = reader.nextItem.bind(reader);
reader.nextItem = async () => {
const item = await next();
if (item?.group) received.push(item.group);
return item;
};
return reader;
};
return { track, consumer: new Consumer(subscriber, { format: new Format("video"), delay }), received };
}

// The deterministic arrival order of the sparse case: every group exactly once, shuffled.
function shuffled(count: number): number[] {
const order = Array.from({ length: count }, (_, i) => i);
let seed = 42;
for (let i = count - 1; i > 0; i--) {
seed = (Math.imul(seed, 1664525) + 1013904223) >>> 0;
const j = seed % (i + 1);
[order[i], order[j]] = [order[j], order[i]];
}
return order;
}

// Write one frame to every publisher, then wait until every player decoded it, as each arrival would
// be decoded before the next lands. A decoded frame always changes some buffered range.
async function arrive(groups: Group.Producer[], players: Player[], index: number, frame: number): Promise<void> {
Expand Down Expand Up @@ -120,8 +114,10 @@ async function measure(
warnings++;
};
try {
// Sparse groups skip every other key. They land in key order: the ordered read hands groups out
// in key order whatever order they land in, so a reordered arrival never reaches the consumer.
const sequence = (i: number) => (scenario === "sparse" ? i * 2 : i);
const order = scenario === "sparse" ? shuffled(groups) : Array.from({ length: groups }, (_, i) => i);
const order = Array.from({ length: groups }, (_, i) => i);
const expected = Array.from({ length: groups * frames }, (_, i) =>
timestamp(sequence(Math.floor(i / frames)), i % frames),
);
Expand Down Expand Up @@ -149,8 +145,6 @@ async function measure(
for (let frame = 0; frame < frames; frame++) await arrive(sources, players, sequence(i), frame);
for (const source of sources) source.finish();
}
// A finished track proves no missing group can still arrive.
if (scenario === "sparse") for (const track of tracks) track.finish();
await Promise.resolve();

for (const player of players) {
Expand All @@ -176,6 +170,7 @@ async function measure(
for (const player of players) {
if (ranges(player) !== JSON.stringify([{ start: newest, end: newest }]))
throw new Error(`skip left ${ranges(player)}`);
if (player.received.length < groups) throw new Error("groups not received");
if (player.received.slice(0, groups).some((group) => group.closed.peek() === undefined))
throw new Error("skipped group left open");
const read = await player.consumer.next();
Expand Down
Loading