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
4 changes: 4 additions & 0 deletions c/moq/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ How to update your code for each breaking change, newest first.

## Unreleased

### Separate datagram tracks

Create a separate producer with `moq_publish_datagrams` and `moq_datagram_info`; replace `moq_publish_track_datagram` with `moq_publish_datagrams_append` on that handle, or `moq_publish_datagrams_insert` for an explicit sequence. `moq_consume_datagrams` now takes a subscriber priority before its callback and never subscribes to a stream track. Use `moq_publish_datagrams_demand` and `moq_datagram_demand_priority` for aggregate priority, and `moq_publish_datagrams_requests` / `moq_datagram_request_accept` for on-demand publishing. Finish or abort datagram producers separately. A zeroed datagram info is untimed, unlike the microsecond default of stream-track info.

### Viewer targets are bounded ([#7090](https://github.com/moq-dev/moq/pull/7090))

Viewer ceilings and PROBE target overrides are refused with the new `MOQ_ERROR_OUT_OF_RANGE` once they would sum above 2^53 - 1 bps, the most a PROBE target carries; nothing changes on a refusal. `moq_viewers_watch`, `moq_viewers_set_target`, and `moq_viewer_update` return it. Handle the new variant wherever you match the error exhaustively. Regenerate bindings and rebuild the matching native library together.
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

### 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.

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

An unset `moq::TrackInfo::max_age`, and a `std::nullopt` info, now advertise a zero max age, serving only the live edge, instead of no publisher limit. Set the new `max_age_unlimited`, which ignores `max_age`, where you relied on `std::nullopt` meaning no limit. A received track's `info()` sets it when its publisher advertised no limit.
Expand Down
26 changes: 26 additions & 0 deletions cpp/moq/test/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,31 @@ bool same_time(const moq::Timestamp &a, const moq::Timestamp &b)
return a.value * b.scale == b.value * a.scale;
}

// A datagram-only request reaches its own handler and demand.
void datagram_tracks()
{
auto broadcast = ok(moq::BroadcastProducer::init(), "datagram broadcast");
auto stream = ok(broadcast->publish_track("events", std::nullopt), "stream");
auto requests = ok(broadcast->requests(), "requests");
auto datagrams = ok(requests->datagrams(), "datagram requests");
auto source = ok(broadcast->consume(), "broadcast consumer");
auto consumer = ok(source->datagrams("events"), "datagram consumer");
ok(consumer->set_priority(12), "priority update");
auto request = ok(datagrams->requested().get(), "datagram request");
CHECK(ok(request->name(), "request name") == "events");
auto producer = ok(request->accept(std::nullopt), "accept datagrams");
CHECK(ok(producer->priority(), "aggregate priority") == 12);
CHECK(!ok(stream->demand(), "stream demand")->wanted());
ok(producer->insert({7, std::nullopt, bytes("seven")}), "insert datagram");
auto received = ok(consumer->recv().get(), "receive datagram");
CHECK(received && received->sequence == 7 && received->payload == bytes("seven"));
consumer->cancel();
CHECK(!ok(producer->priority_changed(12).get(), "released demand"));
ok(producer->finish(), "finish datagrams");
datagrams->cancel();
ok(broadcast->close(), "close datagram broadcast");
}

// Timestamps are exact records: a 90 kHz tick and a present zero read back as written, an
// untimed frame reads back untimed, and a record past the bounds is refused.
void timestamp_roundtrip()
Expand Down Expand Up @@ -236,6 +261,7 @@ void audio_roundtrip()
int main()
{
timestamp_roundtrip();
datagram_tracks();
subscription_defaults();
audio_roundtrip();
auto timebase_owner = ok(moq::BroadcastProducer::init(), "timebase owner");
Expand Down
4 changes: 4 additions & 0 deletions dart/moq/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ How to update your code for each breaking change, newest first.

## Unreleased

### Separate datagram tracks

Use `BroadcastProducer.createDatagrams(name: ..., info: ...)` and `BroadcastConsumer.datagrams(name: ...)` instead of stream-track datagram methods. `DatagramProducer.append(timestamp: ..., payload: ...)` assigns a sequence and `insert(datagram: ...)` preserves one; `DatagramConsumer.recv()` reads its own live cursor. `DatagramInfo` contains priority and optional timescale. Watch `priority()` / `priorityChanged(last: ...)` and serve on-demand tracks through `BroadcastRequests.datagrams()` / `DatagramRequests.requested()`.

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

A null `TrackInfo.maxAge`, the default, and a null info now advertise a zero max age, serving only the live edge, instead of no publisher limit. Pass `maxAgeUnlimited: true`, which ignores `maxAge`, where you relied on null meaning no limit. A received track's `info()` sets it when its publisher advertised no limit.
Expand Down
17 changes: 16 additions & 1 deletion dart/moq/lib/src/aliases.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ typedef GroupProducer = MoqGroupProducer;
/// The read side of a single group: yields timestamped raw frames.
typedef GroupConsumer = MoqGroupConsumer;

/// A datagram-delivered frame, tagged with a per-track sequence number.
/// A datagram payload with its own sequence and optional timestamp.
typedef Datagram = MoqDatagram;

/// A payload plus the timestamp it should be presented at.
Expand Down Expand Up @@ -240,3 +240,18 @@ typedef ProtocolKind = MoqProtocolKind;

/// A protocol failure: scope, verbatim wire code, kind, and a diagnostic message.
typedef ProtocolException = MoqProtocolException;

/// Writes live datagrams with an independent sequence counter and no cache.
typedef DatagramProducer = MoqDatagramProducer;

/// Reads a live datagram track in arrival order from its own cursor.
typedef DatagramConsumer = MoqDatagramConsumer;

/// A requested datagram track awaiting acceptance or rejection.
typedef DatagramRequest = MoqDatagramRequest;

/// Serves on-demand datagram tracks through their own request queue.
typedef DatagramRequests = MoqDatagramRequests;

/// Publisher priority and optional timestamp scale fixed for a datagram track.
typedef DatagramInfo = MoqDatagramInfo;
25 changes: 25 additions & 0 deletions dart/moq/test/moq_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,31 @@ Future<AnnounceEvent> nextRoute(AnnounceConsumer announced) async {
}

void main() {
test('datagram-only requests have independent priority demand', () async {
final broadcast = BroadcastProducer();
final stream = broadcast.publishTrack(name: 'events', info: null);
final requests = broadcast.requests().datagrams();
final consumer = broadcast.consume().datagrams(name: 'events');
consumer.setPriority(priority: 12);
final request = await requests.requested().timeout(timeout);
expect(request.name(), 'events');
expect(request.priority(), 12);
final producer = request.accept(info: null);
expect(producer.priority(), 12);
expect(stream.demand().wanted(), isNull);
producer.insert(
datagram: Datagram(sequence: 7, payload: utf8.encode('seven')),
);
final datagram = await consumer.recv().timeout(timeout);
expect(datagram?.sequence, 7);
expect(datagram?.payload, utf8.encode('seven'));
consumer.cancel();
expect(await producer.priorityChanged(last: 12).timeout(timeout), isNull);
producer.finish();
requests.cancel();
broadcast.close();
});

test('container timebase belongs to one broadcast', () {
final owner = BroadcastProducer();
final other = BroadcastProducer();
Expand Down
4 changes: 4 additions & 0 deletions dart/moq_ffi/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Separate datagram tracks

Generated bindings now expose separate `MoqDatagramProducer`, `MoqDatagramConsumer`, `MoqDatagramInfo`, `MoqDatagramRequest`, and `MoqDatagramRequests` types. Create or subscribe through the broadcast's datagram methods, write with `append` / `insert`, and read with `recv`; stream-track datagram methods are removed. Demand is aggregate subscriber priority, and the broadcast request handler has a separate `datagrams` queue. Regenerate and rebuild native bindings together with your wrapper.

### Viewer targets are bounded ([#7090](https://github.com/moq-dev/moq/pull/7090))

Viewer ceilings and PROBE target overrides are refused with the new `OutOfRangeMoqException` once they would sum above 2^53 - 1 bps, the most a PROBE target carries; nothing changes on a refusal. `MoqViewers.watch` and `setTarget` and `MoqViewer.update` throw it. Handle the new variant wherever you match the error exhaustively. Regenerate bindings and rebuild the matching native library together.
Expand Down
Loading
Loading