Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
65b12b0
chore(quest): claim quest/m1/api-audit/route/events.md
kixelated Nov 3, 2026
51095dd
wip(net)!: announce listing, hidden routes(), and Following's end
kixelated Nov 3, 2026
5179221
wip: migrate callers to the listing and Following's end
kixelated Nov 3, 2026
814a111
wip(js)!: announce listing and internal routes()
kixelated Nov 3, 2026
d79d568
wip: bindings, docs and migration notes for the announce listing
kixelated Nov 3, 2026
256e421
wip: move relay-level tests to routes()
kixelated Nov 3, 2026
8e410e8
wip(cpp): announce listing in the interop client and OBS test
kixelated Nov 3, 2026
8370587
Merge origin/main; moq-ffi and C follow report the path going offline
kixelated Nov 3, 2026
f402aae
feat(bindings)!: follow reports the path going offline
kixelated Nov 3, 2026
73bac21
fix(room): keep a participant listed after its follower fails
kixelated Nov 3, 2026
92ec3cf
fix(test): wait for the present announcement in max-age
pullfrog[bot] Nov 3, 2026
201c8a6
feat(c)!: moq_origin_follow reports an explicit follow event
kixelated Nov 3, 2026
14be5d0
Merge remote-tracking branch 'origin/main' into quest/m1/api-audit/ro…
kixelated Nov 3, 2026
6f3ad66
chore(c): allow the C name on moq_follow_callback
kixelated Nov 3, 2026
0d3e373
fix(cli): fail the archive export when a listed path is refused
kixelated Nov 3, 2026
5154cc5
fix: follow past a refusal, check named sibling instances, reset clus…
kixelated Nov 3, 2026
76d20d5
fix(net): a refusal does not leave the follower retrying a moved broa…
kixelated Nov 3, 2026
00dacb3
Merge remote-tracking branch 'origin/main' into quest/m1/api-audit/ro…
kixelated Nov 3, 2026
d02957c
test: guard the owed end after a refusal; check the pinned C follow d…
kixelated Nov 3, 2026
4fba2ec
fix(quest): drop links to the implemented listing quest
pullfrog[bot] Nov 3, 2026
3582fd9
Merge remote-tracking branch 'origin/main' into quest/m1/api-audit/ro…
kixelated Nov 3, 2026
d2b04d0
Merge remote-tracking branch 'origin/main' into quest/m1/api-audit/ro…
kixelated Nov 3, 2026
7c2246a
Merge origin/main into quest/m1/api-audit/route/events
kixelated Nov 5, 2026
25c2526
fix: align the merged refusal retry with the listing; format
kixelated Nov 5, 2026
9c8adbe
fix: keep the moq-boy and echo followers past a refusal
kixelated Nov 5, 2026
9c8e500
Merge origin/main into quest/m1/api-audit/route/events
kixelated Nov 5, 2026
f5c5ee3
fix(carla): read driver control with the self-subscribing snapshot co…
kixelated Nov 5, 2026
cfed1ec
Merge origin/main into quest/m1/api-audit/route/events
kixelated Nov 5, 2026
a18da85
fix(bench): the fan-out session harness reads the optional follow result
kixelated Nov 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion bench/fanout/session/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ fn main() {
.unwrap()
.available()
.await
.expect("broadcast resolves");
.expect("broadcast resolves")
.expect("the room is online");
let subscriber = remote.track("chat").unwrap().subscribe(None).await.expect("subscribe");
audience.push((sessions, local, subscriber));
}
Expand Down
8 changes: 8 additions & 0 deletions c/moq/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Audio and video subscribe setup now reports `MOQ_ERROR_UNSUPPORTED_CONFIG` when

The hand-written crate never published as moq-c: a libmoq 0.6 user applies these entries before moving to the generated API.

### Announcements are a listing ([#7678](https://github.com/moq-dev/moq/pull/7678))

`moq_announce_kind` is `MOQ_ANNOUNCE_KIND_PRESENT` (0) or `MOQ_ANNOUNCE_KIND_ABSENT` (1), and `moq_announce_event` loses `predecessor` and `predecessor_len`, changing the C ABI.
Another instance taking a path over keeps it present, and a route's cost changing is not reported.
Map `_START` to `_PRESENT` and `_END` to `_ABSENT`, and drop `_UPDATE` handling. Where you requested the path again on `_RESTART` or `_TAKEOVER`, call `moq_origin_follow`, whose callback delivers a broadcast handle for each new instance.

`moq_origin_follow` takes a `moq_follow_callback`, `(void *user_data, moq_follow_event event, int32_t code)`, instead of a `moq_status_callback`. `MOQ_FOLLOW_EVENT_ONLINE` carries each broadcast handle (where a positive code did), `MOQ_FOLLOW_EVENT_OFFLINE` reports the path going offline (or, for a follow pinned to an instance, another instance taking it over) with code `0`, and `MOQ_FOLLOW_EVENT_END` is the terminal callback, with `0` or a negative error that `moq_error()` explains (where a code `<= 0` was). Release `user_data` on `MOQ_FOLLOW_EVENT_END`.

### Authored tracks default to a zero max age ([#7729](https://github.com/moq-dev/moq/pull/7729))

A NULL or zeroed `moq_track_info` now advertises a zero max age, serving only the live edge, instead of no publisher limit. `max_age_present` is gone and `max_age_us` always applies; set the new `max_age_unlimited`, which ignores `max_age_us`, where you relied on `max_age_present` false meaning no limit. Zero-initialize the struct (`moq_track_info info = {0};`) or assign every member. In the generated API, an unset `moq_track_info.max_age` is likewise zero, and `max_age_unlimited` sets no limit.
Expand Down
4 changes: 4 additions & 0 deletions cpp/moq/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### `Following::available()` reports the path going offline ([#7678](https://github.com/moq-dev/moq/pull/7678))

`moq::Following::available()` resolves to a null `std::shared_ptr<moq::BroadcastConsumer>` once the path goes offline (or, for a follow pinned to an instance, once another instance takes it over), then the next broadcast when something serves the path again. The first call is never null. Check for null before using a later result, and treat it like the previous instance ending.

### Separate datagram tracks

Replace stream-track datagram methods with `BroadcastProducer::create_datagrams(name, info)` and `BroadcastConsumer::datagrams(name)`. The generated `DatagramProducer` exposes `append(timestamp, payload)` and `insert(Datagram)`; `DatagramConsumer::recv()` returns an optional datagram through a future. `DatagramInfo` has only priority and optional timescale. Demand is aggregate subscriber `priority()` / `priority_changed(last)`; on-demand datagram requests come from `BroadcastRequests::datagrams()` / `DatagramRequests::requested()`. Stream tracks of the same name are independent.
Expand Down
2 changes: 2 additions & 0 deletions cpp/moq/test/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ int main()

// Subscriber: resolve the announced broadcast and subscribe to its track.
auto announced = ok(session->consume()->follow("probe", std::nullopt), "follow");
// The first available() is never offline.
auto remote = ok(announced->available().get(), "available");
CHECK(remote);
auto consumer = ok(remote->subscribe_track("data", std::nullopt).get(), "subscribe_track");

// Cancel a read that has nothing to deliver yet.
Expand Down
11 changes: 10 additions & 1 deletion cpp/obs/src/moq-source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ static void moq_source_on_connect(struct moq_source *ctx, const std::shared_ptr<
moq_source_next_broadcast(ctx, conn);
}

// Waits for the next publisher instance: the first one announced, then each that takes over.
// Waits for the next publisher instance: the first one announced, then each that takes over
// or returns after the broadcast went offline.
static void moq_source_next_broadcast(struct moq_source *ctx, const std::shared_ptr<Connection> &conn)
{
conn->available_call = conn->announced->available().then(
Expand All @@ -466,6 +467,14 @@ static void moq_source_on_broadcast(struct moq_source *ctx, const std::shared_pt
return;
}

// The offline instance's tracks end on their own once its route dies, holding the last
// frame, so only wait for whatever serves the path next.
if (!*result) {
LOG_INFO("Broadcast went offline: %s", conn->broadcast.c_str());
moq_source_next_broadcast(ctx, conn);
return;
}

// Another instance took over, or the broadcast came back. The previous one's active tracks
// keep playing until the new catalog's renditions commit, or until they end once its
// route dies, holding the last frame.
Expand Down
6 changes: 3 additions & 3 deletions cpp/obs/test/moq-output-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,10 @@ struct MoQOutputStatsTest {
auto event = TestOk(next.get(), "announcement");
if (!event)
return std::nullopt;
const auto *start = std::get_if<moq::AnnounceEvent::kStart>(&event->get_variant());
if (!start)
const auto *present = std::get_if<moq::AnnounceEvent::kPresent>(&event->get_variant());
if (!present)
return std::nullopt;
return start->announce.route.instance;
return present->announce.route.instance;
}

static std::shared_ptr<moq::Session> Session(MoQOutput &output)
Expand Down
22 changes: 22 additions & 0 deletions dart/moq/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ How to update your code for each breaking change, newest first.

## Unreleased

### `Following.available()` returns null once the path goes offline

`await following.available()` returns `BroadcastConsumer?`.
After the first call, it returns null once the followed path goes offline, or, for a `follow(path, instance: ...)` pinned to an instance, once another instance takes it over; the next call returns whatever serves the path next. The first call never returns null.
Drop what you read from the previous broadcast either way. A caller that only waits for the first broadcast can take it with `!`.

### Announcements are a listing

`announced(...).updates()` yields `AnnounceEventPresent` when a path becomes present and `AnnounceEventAbsent` when it goes, each carrying an `Announce`.
`AnnounceEventStart` is `AnnounceEventPresent` and `AnnounceEventEnd` is `AnnounceEventAbsent`.
`AnnounceEventUpdate`, `AnnounceEventRestart`, and `AnnounceEventTakeover` are gone: a path whose route or publisher instance changes stays present and is not reported again.
Where you requested the path again on a restart, hold `follow(path)` instead; each `available()` returns the next instance's broadcast.

```dart
final following = moq.follow('live/camera');
while (true) {
final broadcast = await following.available();
if (broadcast == null) continue; // offline until the next instance
play(broadcast);
}
```

### Catalog renditions carry their warmup ([#7864](https://github.com/moq-dev/moq/pull/7864))

`Video` and `Audio` gain `warmup`, the catalog's decoder warmup; it defaults to `null`, so existing constructors still compile. `TrackConsumer` and the audio and video consumers read it from the rendition and start that much earlier.
Expand Down
11 changes: 5 additions & 6 deletions dart/moq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ final announced = connection.announced(
options: const AnnounceOptions(prefix: 'live/', filter: '*/camera'),
);
await for (final event in announced.updates()) {
// A restart is a new publisher run at the same path: request it again. A takeover
// continues what an earlier route served, like a start.
// The listing reports each path once while it stays present, even as its
// publisher restarts; `connection.follow(path)` hands out each new run, or
// null once it goes offline.
switch (event) {
case AnnounceEventStart(:final announce) ||
AnnounceEventRestart(:final announce) ||
AnnounceEventTakeover(:final announce):
case AnnounceEventPresent(:final announce):
// Prefix stays origin-relative; captures reports wildcard matches.
print(announce.prefix);
print(announce.captures);
default:
case AnnounceEventAbsent():
}
}
```
Expand Down
27 changes: 9 additions & 18 deletions dart/moq/lib/src/aliases.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,18 @@ typedef AnnounceRoute = MoqAnnounceRoute;
/// A route over a prefix: its origin-relative path, required wildcard captures (empty without wildcards), and route metadata.
typedef Announce = MoqAnnounce;

/// What an [AnnounceConsumer] yields: [AnnounceEventStart],
/// [AnnounceEventUpdate], [AnnounceEventEnd], [AnnounceEventRestart], or
/// [AnnounceEventTakeover].
/// What an [AnnounceConsumer] yields: [AnnounceEventPresent] or
/// [AnnounceEventAbsent].
///
/// Another publisher instance taking a path over keeps it present: hold a
/// [Following] to see the broadcast change.
typedef AnnounceEvent = MoqAnnounceEvent;

/// A route now covers the prefix; the stream had none there.
typedef AnnounceEventStart = StartMoqAnnounceEvent;

/// The route covering the prefix changed hops or cost.
typedef AnnounceEventUpdate = UpdateMoqAnnounceEvent;

/// No route covers the prefix any more; carries its last route.
typedef AnnounceEventEnd = EndMoqAnnounceEvent;

/// Another publisher instance now serves the prefix: drop what was resolved
/// under it and request afresh.
typedef AnnounceEventRestart = RestartMoqAnnounceEvent;
/// A route now covers the path, which was absent.
typedef AnnounceEventPresent = PresentMoqAnnounceEvent;

/// A route now covers the prefix and continues what the route at `predecessor`
/// served beneath it: keep what was resolved through that one.
typedef AnnounceEventTakeover = TakeoverMoqAnnounceEvent;
/// No route covers the path any more; carries its last route.
typedef AnnounceEventAbsent = AbsentMoqAnnounceEvent;

/// The write side of a broadcast: publish tracks into it.
typedef BroadcastProducer = MoqBroadcastProducer;
Expand Down
11 changes: 7 additions & 4 deletions dart/moq/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,20 @@ final class Moq {
Publication createBroadcast(String path) =>
session.publish().createBroadcast(path: path);

/// Discover routes matching [options]; prefixes stay relative to the origin.
/// List the paths matching [options] as each becomes present or absent;
/// prefixes stay relative to the origin.
///
/// Listen to `announced(...).updates()` for a [Stream] of [AnnounceEvent]
/// that releases the cursor when the subscription ends.
/// that releases the cursor when the subscription ends. A new publisher
/// instance keeps its path present, so use [follow] to see it.
AnnounceConsumer announced({
AnnounceOptions options = const AnnounceOptions(),
}) => session.consume().announced(config: options._ffi);

/// Follow the broadcast at exactly [path]: each `available()` resolves the
/// next instance serving it, such as a restarted publisher. Pass an
/// [instance] to follow only that stream.
/// next instance serving it, such as a restarted publisher, or null once the
/// path goes offline. Pass an [instance] to follow only that stream; another
/// one taking over also resolves null.
Following follow(String path, {String? instance}) =>
session.consume().follow(path: path, instance: instance);

Expand Down
64 changes: 47 additions & 17 deletions dart/moq/test/moq_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void main() {
viewer.dispose();

final announcement = client.announced().updates().firstWhere(
(event) => event is AnnounceEventStart,
(event) => event is AnnounceEventPresent,
);
final publication = relay.createBroadcast(path: 'live');
final track = publication.broadcast().publishTrack(
Expand All @@ -288,7 +288,7 @@ void main() {
);
publication.announce(route: AnnounceRoute());
final announced =
(await announcement.timeout(timeout) as AnnounceEventStart).announce;
(await announcement.timeout(timeout) as AnnounceEventPresent).announce;
expect(announced.prefix, 'live');

final requested = await client.request(announced.prefix).timeout(timeout);
Expand Down Expand Up @@ -368,14 +368,14 @@ void main() {
final serverSession = await accepted;

final announcement = client.announced().updates().firstWhere(
(event) => event is AnnounceEventStart,
(event) => event is AnnounceEventPresent,
);
final publication = server.createBroadcast('live');
final broadcast = publication.broadcast();
final track = broadcast.publishTrack(name: 'events', info: null);
publication.announce(route: AnnounceRoute());
final announced =
(await announcement.timeout(timeout) as AnnounceEventStart).announce;
(await announcement.timeout(timeout) as AnnounceEventPresent).announce;
expect(announced.prefix, 'live');

await client.close();
Expand Down Expand Up @@ -538,27 +538,27 @@ void main() {
publication.announce(route: AnnounceRoute());
final announced = consumer.announced(config: MoqAnnounceConfig());
final first = await nextRoute(announced);
expect(first, isA<AnnounceEventStart>());
expect((first as AnnounceEventStart).announce.prefix, 'live');
expect(first, isA<AnnounceEventPresent>());
expect((first as AnnounceEventPresent).announce.prefix, 'live');

publication.unannounce();
final retracted = await nextRoute(announced);
expect(retracted, isA<AnnounceEventEnd>());
expect((retracted as AnnounceEventEnd).announce.prefix, 'live');
expect(retracted, isA<AnnounceEventAbsent>());
expect((retracted as AnnounceEventAbsent).announce.prefix, 'live');
await expectLater(
consumer.request(path: 'live').timeout(timeout),
throwsA(anything),
);

publication.announce(route: AnnounceRoute());
expect(await nextRoute(announced), isA<AnnounceEventStart>());
expect(await nextRoute(announced), isA<AnnounceEventPresent>());
await consumer.request(path: 'live').timeout(timeout);

// Disposing the publication keeps the route; closing the broadcast ends it.
publication.dispose();
await consumer.request(path: 'live').timeout(timeout);
broadcast.close();
expect(await nextRoute(announced), isA<AnnounceEventEnd>());
expect(await nextRoute(announced), isA<AnnounceEventAbsent>());
announced.cancel();
announced.dispose();
});
Expand All @@ -580,27 +580,57 @@ void main() {
replacement.broadcast().close();
});

test('a new instance restarts announce consumers', () async {
test('a new instance restarts followers but stays listed', () async {
final origin = MoqOriginProducer(config: MoqOriginConfig());
final announced = origin.consume().announced(config: MoqAnnounceConfig());
final consumer = origin.consume();
final announced = consumer.announced(config: MoqAnnounceConfig());
final following = consumer.follow(path: 'instance');
final publication = origin.createBroadcast(path: 'instance');

publication.announce(route: AnnounceRoute());
final start = await nextRoute(announced) as AnnounceEventStart;
expect(start.announce.route.instance, isNotEmpty);
final present = await nextRoute(announced) as AnnounceEventPresent;
expect(present.announce.route.instance, isNotEmpty);
(await following.available().timeout(timeout))!.dispose();

publication.announce(route: AnnounceRoute(instance: 'camera', epoch: 1));
final restart = await nextRoute(announced) as AnnounceEventRestart;
expect(restart.announce.route.instance, 'camera');
(await following.available().timeout(timeout))!.dispose();

// The takeover was not listed, so the next event is the path going absent.
publication.unannounce();
final absent = await nextRoute(announced) as AnnounceEventAbsent;
expect(absent.announce.route.instance, 'camera');

expect(
() => publication.announce(route: AnnounceRoute(instance: '')),
throwsA(isA<InvalidInstanceMoqException>()),
);
following.cancel();
following.dispose();
announced.cancel();
announced.dispose();
});

test(
'a follower reports the path going offline and the next broadcast',
() async {
final origin = MoqOriginProducer(config: MoqOriginConfig());
final following = origin.consume().follow(path: 'offline');
final publication = origin.createBroadcast(path: 'offline');

publication.announce(route: AnnounceRoute());
(await following.available().timeout(timeout))!.dispose();

publication.unannounce();
expect(await following.available().timeout(timeout), isNull);

publication.announce(route: AnnounceRoute());
(await following.available().timeout(timeout))!.dispose();

following.cancel();
following.dispose();
},
);

test('announced pattern reports captures', () async {
final origin = MoqOriginProducer(config: MoqOriginConfig());
final announced = origin.consume().announced(
Expand All @@ -609,7 +639,7 @@ void main() {
final publication = origin.createBroadcast(path: 'room/alice/chat');
publication.announce(route: AnnounceRoute());

final update = await nextRoute(announced) as AnnounceEventStart;
final update = await nextRoute(announced) as AnnounceEventPresent;
expect(update.announce.prefix, 'room/alice/chat');
expect(update.announce.captures, ['alice']);
});
Expand Down
Loading
Loading