Skip to content

Add moq_media_sender_cfg_t.initial_group_id so a restarted publisher can resume above its Groups - #65

Merged
rwl4 merged 2 commits into
openmoq:mainfrom
mondain:feat/media-sender-initial-group
Nov 15, 2026
Merged

rwl4 merged 2 commits into
openmoq:mainfrom
mondain:feat/media-sender-initial-group

Conversation

@mondain

@mondain mondain commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The media sender numbers Group IDs itself and gives the application no way to choose the first one. The legacy companion (drafts 16 and 18) always starts every track at Group 0. The draft-22 companion starts at the wallclock in milliseconds, which its comment already calls best effort.

A publisher that restarts a Track must not reuse the Locations of Objects it already published (draft-ietf-moq-transport-22 section 2.5, MSF-01 section 6.1). moqxr hit this: when a live publish fails and is retried in the same process, it carries the next Group IDs forward on its own native backend, but on this backend a retry restarts at Group 0, and it has to refuse a non-zero --initial-group-id for the same reason.

Change

moq_media_sender_cfg_t gets an optional pair at the end of the struct, initial_group_id and has_initial_group_id. When has_initial_group_id is true:

  • it is the first Group ID of every track, the generated timeline and the catalog, replacing the companion's default base, and the clock is not read;
  • an AUTO sender keeps it when it resolves to the legacy companion, which would otherwise move its Groups down to 0;
  • a value above MOQ_QUIC_VARINT_MAX fails creation with MOQ_ERR_LIMIT before any allocation, as an unreadable or out-of-range clock does. A value of exactly MOQ_QUIC_VARINT_MAX is valid.

A config whose struct_size is too short to hold the pair behaves as before, and it is only read from a sized initializer like the other appended fields. The default behaviour of both companions is unchanged.

The ABI pins in tests/unit/test_abi_layout_d22.c and service/tests/test_sender_companion.c are updated.

Testing

Built with -DMOQ_BUILD_TESTS=ON -DMOQ_BUILD_SIM=ON -DMOQ_BUILD_MSF=ON -DMOQ_BUILD_MEDIA_OBJECT=ON -DMOQ_BUILD_SERVICE=ON -DMOQ_WARNINGS_AS_ERRORS=ON on x86-64 Linux: 491/491 tests pass.

New rows in test_sender_companion cover the legacy and draft-22 companions with a configured base (the draft-22 case fails the clock to show it is not read), a config too short for the field, an AUTO sender resolving to legacy, and the MOQ_QUIC_VARINT_MAX limit and its refusal. They fail when the field is ignored.

Not verified

  • The ARM (8-byte uint64_t alignment) and Windows pins are computed by hand. The i386 pins compile cleanly with gcc -m32, and a deliberately wrong i386 size fails.
  • The Rust (bindings/rust) and Python bindings and the generated bindings.rs snapshot are not updated, and I did not run the Rust or the other CI jobs.
  • Not run against a relay.

This change is Reviewable

The legacy companion numbers every track's Groups from 0, so a publisher that
restarts a Track on drafts 16 and 18, for example when it reconnects after a
failed session, reuses Locations of Objects it already published
(draft-ietf-moq-transport-22 2.5; MSF-01 6.1). The draft-22 companion starts at
the wallclock milliseconds, which is only best effort, and an application
cannot choose a base for either.

Add an optional initial_group_id / has_initial_group_id pair at the end of the
sender config. When set, it is the first Group ID of every track, the generated
timeline and the catalog, replacing the companion's default base, and the clock
is not read. An AUTO sender keeps it when it resolves to the legacy companion
instead of moving its Groups down to 0. A value above MOQ_QUIC_VARINT_MAX fails
creation with MOQ_ERR_LIMIT. A config too short to hold the pair behaves as
before.

The ABI pins for the config are updated for LP64, ILP32 with 4-byte uint64_t
alignment and ILP32 with 8-byte alignment.
@rwl4
rwl4 merged commit 982558f into openmoq:main Nov 15, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants