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
15 changes: 10 additions & 5 deletions c/moq/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The hand-written crate never published as moq-c: a libmoq 0.6 user applies these

### Paths with an empty segment are refused ([#6648](https://github.com/moq-dev/moq/pull/6648))

`moq_origin_create_broadcast`, `moq_origin_requests`, `moq_origin_announced_broadcast`, and `moq_origin_request` return an error for a path with a leading, trailing, or doubled `/` instead of collapsing it. Pass the canonical path, such as `room/cam`. The generated API refuses the same paths.
`moq_origin_create_broadcast`, `moq_origin_requests`, `moq_origin_follow`, and `moq_origin_request` return an error for a path with a leading, trailing, or doubled `/` instead of collapsing it. Pass the canonical path, such as `room/cam`. The generated API refuses the same paths.

### Session allocator ([#6751](https://github.com/moq-dev/moq/pull/6751))

Expand Down Expand Up @@ -59,11 +59,16 @@ With deltas on, the track carries a refresh ratio of 8 and the producer restates
Higher is first and 0 is the unset midpoint, so a zeroed `moq_track_info` now uses the default priority rather than the least urgent one.
To keep a value's moq-lite byte, subtract 128 from it: 255 becomes 127, 128 becomes 0, and 0 becomes -128.

### `moq_origin_follow` replaces `moq_origin_announced_broadcast`, and both resolutions take an instance ([#7193](https://github.com/moq-dev/moq/pull/7193), [#7489](https://github.com/moq-dev/moq/pull/7489))

Rename `moq_origin_announced_broadcast` and `moq_origin_announced_broadcast_cancel` to `moq_origin_follow` and `moq_origin_follow_cancel`.
`moq_origin_request` and `moq_origin_follow` take `instance, instance_len` after `path_len`: pass `NULL, 0` to accept whichever publisher instance serves the path, or an instance to refuse every other.
`moq_origin_request` resolves one publisher instance: it retries as the routes covering the path change, and fails as unroutable only once discovery has synced with no covering route. `moq_origin_follow` hands out each instance that serves the path in turn.

### A client asks only about what it watches (#6165)

On moq-lite, a client session asks its relay for announcements only under paths something watches, through `moq_origin_announced` or `moq_origin_announced_broadcast`, instead of under its whole scope at connect.
`moq_origin_request` watches nothing, so on a client it fails with a negative code for a path nothing watches, even when the relay announces it.
Resolve the path with `moq_origin_announced_broadcast`, or hold `moq_origin_announced` over its prefix while requesting.
On moq-lite, a client session asks its relay for announcements only under paths something watches, through `moq_origin_announced`, `moq_origin_request`, or `moq_origin_follow`, instead of under its whole scope at connect.
`moq_origin_request` owns the discovery of its path, so it finds a broadcast the relay serves with nothing else watching first; no announcement stream is needed beside it.
moq-transport and moq-lite-03/04 sessions are unchanged.

### `MOQ_CONTAINER_FORMAT_FMP4` unwraps to Legacy (#6250)
Expand Down Expand Up @@ -151,7 +156,7 @@ if (consumer > 0) {
}
```

### `moq_origin_announced_broadcast` delivers every publisher instance (#5700)
### `moq_origin_follow` delivers every publisher instance (#5700)

Its callback gets a new broadcast handle each time another instance takes over the path or the broadcast returns, and its terminal `0` only on cancel.
Free each handle with `moq_consume_close` once its successor arrives.
Expand Down
13 changes: 9 additions & 4 deletions dart/moq/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,16 @@ Publish the track with a `refresh` ratio so a joiner gets the value restated in
`TrackInfo.priority` defaulted to 127 and now defaults to 0.
To keep a value's moq-lite byte, subtract 128 from it: 255 becomes 127, 128 becomes 0, and 0 becomes -128.

### `request` and `follow` name the two resolutions ([#7193](https://github.com/moq-dev/moq/pull/7193), [#7489](https://github.com/moq-dev/moq/pull/7489))

Rename `requestBroadcast` to `request`, `announcedBroadcast` to `follow`, and `AnnouncedBroadcast` to `Following`.
On `Moq` both take a positional path and a named `instance:`; on `OriginConsumer` they take `path:` and `instance:`. Pass an instance to refuse every other publisher instance.
`request` resolves one publisher instance: it retries as the routes covering the path change, and fails with an unroutable error only once discovery has synced with no covering route. `follow` hands out each instance that serves the path in turn.

### A client asks only about what it watches (#6165)

On moq-lite, a client session asks its relay for announcements only under paths something watches, through `announced()` or `announcedBroadcast()`, instead of under its whole scope at connect.
`requestBroadcast()` watches nothing, so on a client it fails with an unroutable error for a path nothing watches, even when the relay announces it.
Resolve the path with `announcedBroadcast()`, or hold `announced()` over its prefix while requesting.
On moq-lite, a client session asks its relay for announcements only under paths something watches, through `announced()`, `request()`, or `follow()`, instead of under its whole scope at connect.
`request()` owns the discovery of its path, so it finds a broadcast the relay serves with nothing else watching first; no announcement stream is needed beside it.
moq-transport and moq-lite-03/04 sessions are unchanged.

### `ContainerFormat.fmp4` unwraps to Legacy (#6250)
Expand Down Expand Up @@ -197,7 +202,7 @@ The connection stats no longer carry a receive estimate.
Hold the consumer `Session.recvBandwidth` returns to request PROBE, read it with `rate()` or wait with `rateChanged()`, and `cancel()` it to stop.
Replace `stats().estimatedRecvRateBps` with `recvBandwidth()?.rate()`.

### `AnnouncedBroadcast.available()` waits for the next publisher instance (#5700)
### `Following.available()` waits for the next publisher instance (#5700)

The first call returns the broadcast serving the path, as before.
Each later call waits for the next instance to take over the path, instead of returning whatever serves it now.
Expand Down
13 changes: 9 additions & 4 deletions go/wrapper/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,16 @@ Publish the track with a `Refresh` ratio so a joiner gets the value restated in
Higher is first and the zero value is the unset midpoint, so a `TrackInfo` that leaves `Priority` zero now gets the default rather than the least urgent priority; drop any `Priority: 127` that asked for the midpoint.
To keep a value's moq-lite byte, subtract 128 from it: 255 becomes 127, 128 becomes 0, and 0 becomes -128.

### `Request` and `Follow` name the two resolutions ([#7193](https://github.com/moq-dev/moq/pull/7193), [#7489](https://github.com/moq-dev/moq/pull/7489))

On `OriginConsumer` and `Client`, `RequestBroadcast(ctx, path)` is `Request(ctx, path, nil)`, `AnnouncedBroadcast(path)` is `Follow(path, nil)`, and `*moq.AnnouncedBroadcast` is `*moq.Following`.
Pass `&instance` instead of `nil` to refuse every other publisher instance.
`Request` resolves one publisher instance: it retries as the routes covering the path change, and fails with an unroutable error only once discovery has synced with no covering route. `Follow` hands out each instance that serves the path in turn.

### A client asks only about what it watches (#6165)

On moq-lite, a client session asks its relay for announcements only under paths something watches, through `Announced()` or `AnnouncedBroadcast()`, instead of under its whole scope at connect.
`OriginConsumer.RequestBroadcast()` watches nothing, so on a client it fails with an unroutable error for a path nothing watches, even when the relay announces it.
Resolve the path with `AnnouncedBroadcast()`, or hold `Announced()` over its prefix while requesting.
On moq-lite, a client session asks its relay for announcements only under paths something watches, through `Announced()`, `Request()`, or `Follow()`, instead of under its whole scope at connect.
`OriginConsumer.Request()` owns the discovery of its path, so it finds a broadcast the relay serves with nothing else watching first; no announcement stream is needed beside it.
moq-transport and moq-lite-03/04 sessions are unchanged.

### `media.ContainerFormatFmp4` unwraps to Legacy (#6250)
Expand Down Expand Up @@ -196,7 +201,7 @@ The connection stats no longer carry a receive estimate.
Hold the consumer `Session.RecvBandwidth` returns to request PROBE, read it with `Rate()` or wait with `RateChanged(ctx)`, and `Close()` it to stop.
It returns `nil` when the version has no PROBE.

### `AnnouncedBroadcast.Available` waits for the next publisher instance (#5700)
### `Following.Available` waits for the next publisher instance (#5700)

The first call returns the broadcast serving the path, as before.
Each later call waits for the next instance to take over the path, instead of returning whatever serves it now.
Expand Down
15 changes: 9 additions & 6 deletions js/net/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,12 @@ const sub = track.subscribe({ maxDelay: Milli(1000) });
`Time.Nano`, `Time.Micro`, `Time.Milli`, and `Time.Second` are gone.
Import them from `@moq/clock`, which throws on negative or non-finite values.

### Announced requests follow restarts, and `broadcasts()` is gone
### `follow(path)` replaces `request(path, { announced: true })`, and `broadcasts()` is gone ([#7173](https://github.com/moq-dev/moq/pull/7173), [#7476](https://github.com/moq-dev/moq/pull/7476))

An unpinned `request(path, { announced: true })` stays open across publisher instances: its `active` moves to each new instance's broadcast and clears between them, instead of ending with `Unroutable`.
Read `active` reactively and close the request when done, or pass `instance` to keep the old single-instance behavior.
`RequestOptions.announced` is removed: replace `request(path, { announced: true })` with `follow(path)`, which returns an `Origin.Following`.
An unpinned `follow(path)` stays open across publisher instances: its `active` moves to each new instance's broadcast and clears between them, instead of ending with `Unroutable`.
Read `active` reactively and close the follower when done, or use `request(path)` to stay on one instance.
A follower needs discovery: a session without it never serves one.
`Origin.Producer` and `Origin.Consumer` drop `broadcasts(scope)`; iterate `announced(scope)` instead.

```ts
Expand All @@ -218,8 +220,9 @@ for await (const event of origin.announced(scope)) {

### Discovery follows what something watches, and `discovery` is gone

A `consume` origin stays empty until a reader watches it with `announced(scope)` or `request(path, { announced: true })`; the session then asks the relay about those prefixes only.
Code that called `request(path)` expecting a route without watching should hold an `announced(scope)` stream.
A `consume` origin stays empty until a reader watches it with `announced(scope)`, `request(path)`, or `follow(path)`; the session then asks the relay about those prefixes only.
`request(path)` owns the discovery of its path until closed, so it finds a broadcast the relay serves with nothing else watching first, and retries as the routes covering the path change.
It fails `Unroutable` once at least one session is attached and every session's discovery has synced without a route for it; with no session attached, such as between reconnects, it waits. Drop any `announced(scope)` stream held only so a request could resolve.
The `discovery` option on `connect`, `accept`, and `Connection`, and `Established.discovery`, are removed; passing the option throws a `TypeError`.
Drop the option.

Expand All @@ -234,7 +237,7 @@ A `"restart"` means another publisher instance now serves the prefix: request th

Every route carries an `Instance`: non-empty text naming one continuous run of group numbers at its path. Every broadcast mints a random one and keeps it across re-announcing, so most publishers set nothing.
A publisher that continues its group sequences across restarts may name a stable one with `announce({ instance, epoch })`, raising `epoch` on each run.
Read `Route.instance` and `Broadcast.Consumer.instance`; pin a request or follow to one with `request(path, { instance })`.
Read `Route.instance` and `Broadcast.Consumer.instance`; pin a request or follower to one with `request(path, { instance })` or `follow(path, { instance })`.

### Publishing never invents a timestamp (#5070)

Expand Down
32 changes: 32 additions & 0 deletions js/net/src/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2520,6 +2520,38 @@ for (const alpn of [Lite.ALPN_06, Lite.ALPN_07_WIP]) {
}
}

// As Rust's lazy discovery tests: a request owns its discovery, so nothing watches first.
test.each([Lite.ALPN_05, Lite.ALPN_06, Lite.ALPN_07_WIP])(
"%s: a request on an unwatched path resolves it, or fails Unroutable once the peer syncs",
async (alpn) => {
const pair = createMockTransportPair(alpn);
const serverOrigin = new OriginProducer();
const clientOrigin = new OriginProducer();
const [client, server] = await Promise.all([
connect(url, { transport: pair.client, consume: clientOrigin }),
accept(pair.server, url, { publish: serverOrigin.consume() }),
]);
const broadcast = publish(serverOrigin, Path.from("room/cam"));

const reader = clientOrigin.consume();
const found = reader.request(Path.from("room/cam"));
const missing = reader.request(Path.from("room/missing"));
await until(() => found.active.peek() !== undefined && missing.closed.peek() !== undefined);
expect(found.closed.peek()).toBeUndefined();
const err = missing.closed.peek();
expect(err).toBeInstanceOf(StreamError);
expect((err as StreamError).code).toBe(StreamCode.Unroutable);

found.close();
missing.close();
broadcast.close();
client.abort();
server.abort();
serverOrigin.close();
clientOrigin.close();
},
);

test.each([Ietf.ALPN.DRAFT_18])(
"%s: closing an announce consumer before the namespace answer ends the peer's stream",
async (alpn) => {
Expand Down
26 changes: 26 additions & 0 deletions js/net/src/origin-request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,32 @@ test("a pending request fails Unroutable once its discovery syncs without a rout
origin.close();
});

// Unlike a Rust origin, which answers for its own table at once, a JS origin usually fronts a
// reconnecting connection: no session yet means nothing has synced.
test("a pending request waits for a session before concluding absence", async () => {
const origin = new Producer();
const wire = wireOf(origin);
const request = origin.request(Path.from("room/missing"));
await settle();
expect(request.closed.peek()).toBeUndefined();

let synced: (() => void) | undefined;
const stop = wire.interests((prefix, wanted) => {
if (wanted) synced = wire.snapshot(prefix);
});
const detach = wire.attach(true);
await settle();
expect(request.closed.peek()).toBeUndefined();
synced?.();
await settle();
expect((request.closed.peek() as StreamError).code).toBe(StreamCode.Unroutable);

request.close();
stop();
detach();
origin.close();
});

test("a follower retains a selected handler's explicit unroutable refusal", async () => {
const origin = new Producer();
const path = Path.from("room/audio");
Expand Down
5 changes: 3 additions & 2 deletions js/net/src/origin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1943,8 +1943,9 @@ export class Consumer implements Reader {
* Resolve one publisher instance serving `path`, pinned to `instance` when given.
*
* The request owns discovery of its path until closed and retries route churn while
* pending. It fails `Unroutable` once every session's discovery has synced without a
* route for it, and can use a session without discovery instead. Once resolved it keeps
* pending. It fails `Unroutable` once at least one session is attached and every
* session's discovery has synced without a route for it, and can use a session without
* discovery instead. With no session attached, such as between reconnects, it waits. Once resolved it keeps
* that instance, ending when the instance stops serving. Use {@link follow} to move on
* to the next one.
*/
Expand Down
12 changes: 7 additions & 5 deletions js/watch/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ How to update your code for each breaking change, newest first.
Property and built-in UI changes now reflect into attributes. Invalid rendering/catalog modes, URLs, numbers, durations, and version lists throw instead of selecting defaults; remove an attribute to use its default.
Catch those property setter errors. A browser reports malformed markup through its normal `error` event, and the element suspends media until those invalid attributes are corrected or removed. A valid property assignment also corrects that attribute. An empty, duplicate, or unsupported `versions` list now throws from the setter instead of failing on `el.connection.error`; check a list up front with `Net.Connection.checkVersions`.
`broadcast`, `video`, `audio`, `renderer`, and `sync` are TypeScript `readonly` fields. Configure the existing components through their inputs and `controls` instead of replacing them; use a headless `Player` for a different pipeline.
`announced=false` reflects as `announced="false"`; `captions` and `catalog-format` now reflect too.
`follow=false` reflects as `follow="false"`; `captions` and `catalog-format` now reflect too.

### Muting preserves the selected volume

Expand Down Expand Up @@ -44,7 +44,7 @@ Read `Sync.out.delay` instead of `Sync.out.jitter`, and the element's `sync.out.
Stop passing `probe` to `new Sync(...)`; it was never read.
`Sync.now()` returns `Milli | undefined`.
`received`, `wait`, and `register` are internal to the built-in decoders, and `epoch` and `skipped` are gone: `wait` now resolves `true` to present the frame or `false` to drop it.
`<moq-watch>` no longer observes `reload`, `latency`, `latency-min`, or `jitter`, nor has the `latency`, `latencyMin`, `latencyMax`, or `reload` properties; use `announced`, `delay`, and `buffer` (see 0.5 -> 0.6).
`<moq-watch>` no longer observes `reload`, `latency`, `latency-min`, or `jitter`, nor has the `latency`, `latencyMin`, `latencyMax`, or `reload` properties; use `follow`, `delay`, and `buffer` (see 0.5 -> 0.6, where `follow` is still `announced`).

### `Video.Source.out.error` is an `Error`

Expand Down Expand Up @@ -98,10 +98,12 @@ Rename `Sync.out.maxAge` to `Sync.out.maxDelay`.
A rendition the catalog marks `enabled: false` is skipped, even when named.
With no video rendition selectable, the picture clears to black.

### `announced` off stays on one publisher
### `announced` is `follow`, and off stays on one publisher ([#7189](https://github.com/moq-dev/moq/pull/7189))

With `announced` off, the player no longer moves to a later publisher at the same path.
Turn `announced` on to follow restarts.
Rename `announced` to `follow` on `new Watch.Broadcast({...})`, `new Watch.Player({...})`, `broadcast.in`, `player.in`, and `<moq-watch>` (`<moq-watch follow="false">`, `el.follow = false`); its default is unchanged.
Passing `announced` throws, and an `announced` attribute suspends the element until it is removed.
With `follow` off, the player no longer moves to a later publisher at the same path.
Turn `follow` on to follow restarts.

## 0.5 -> 0.6

Expand Down
Loading
Loading