Skip to content

@moq/publish: release groupDuration (#4910) — one group per Opus frame silences viewers on Cloudflare's relay #7267

Closed

Description

@espaciofuturoio

Summary

groupDuration for Audio.Encoder (#4910, merged 2026-10-07) is not in any npm release: @moq/publish 0.5.3, the latest, still writes one group per Opus frame. On Cloudflare's hosted relay that is not a scaling issue but a silent audio track. The relay ends a track's whole subscription when a newer group starts while an earlier one is still arriving (cloudflare/moq-rs#238), and at 50 groups/s that happens within seconds. Could a release ship groupDuration?

Measured (2026-10-29, Chrome, @moq/publish 0.5.3, @moq/watch 0.6.6, @moq/net 0.4.7, Cloudflare draft-16 hosted relay)

  • Default audio: every viewer's audio subscription ends with PUBLISH_DONE reason=closed 1.5–3 s after subscribing, in every run. The publisher gets UNSUBSCRIBE and its encoder stops. Video plays.
  • Same pages on cdn.moq.dev/anon: audio plays.
  • Backporting feat(audio): pack several frames per group with a minimum group duration #4910's behaviour (any frame opens a new group once groupDuration has passed) onto 0.5.3 as a local patch: 20 ms died in every run, 100 ms died in 1 of 2 runs, 250/500/1000 ms played. With 1000 ms, 4 × 60 s had audio every second.

Related, smaller: @moq/watch 0.6.6 re-subscribes audio once per join

The first catalog the publisher writes has no Opus description, and the encoder adds it after its first frame. The watch's audio decoder config includes description, so the change closes the subscription and opens a new one (subscribe close id=4 → subscribe start id=8) and rebuilds the AudioContext. Harmless on moq-relay; on a relay with #238 it is one more chance to lose the track. Either the publisher could hold the audio rendition until description is known, or the watch could keep the subscription when only description changes for Opus (it only feeds pre-skip).

Activity

  1. kixelated commented on Oct 29, 2026

    @kixelated
    Collaborator

    Wow that's terrible. That Cloudflare bug invalidates MoQ as a protocol.

    I can backport something, but I'd highly recommend using moq.pro instead. You'll still run into the bug even with groupDuration if there's any congestion near group boundaries.

    We send every audio frame as a group so they can be reordered and dropped independently. groupDuration will reduce audio quality by a small amount too.

    And thanks for the re-subscribing to audio bug. It's kiiind of on purpose to start subscriptions sooner but obviously that's not working if it triggers a new subscription (and it should).

  2. added
    questBeing tracked/planned in a quest. See `quest/`
    on Oct 29, 2026
  3. kixelated commented on Oct 29, 2026

    @kixelated
    Collaborator

    Planned in moq-dev/moq#7268:

    • groupDuration: we'll backport moq-dev/moq#4910 to the release line and publish it as @moq/publish 0.5.4. The default stays 0 (one group per frame, the same as main), because independent per-frame groups are the better default on a relay that handles them. On Cloudflare's relay, set groupDuration explicitly. Your measurements suggest 250–1000 ms.
    • Audio re-subscribe on join: already fixed on main. The publisher now probes the Opus description before advertising the rendition, so the first catalog includes it. That fix ships in the next major release and won't be backported.

    (Written by Claude Opus 5.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questBeing tracked/planned in a quest. See `quest/`

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions