diff --git a/quest/m1/export-evicts-every-group.md b/quest/m1/export-evicts-every-group.md deleted file mode 100644 index 7415614c30..0000000000 --- a/quest/m1/export-evicts-every-group.md +++ /dev/null @@ -1,30 +0,0 @@ -# [M] A live export reads each group to its end instead of evicting it - -## Goal - -A container export following a steady live broadcast reads every group to its -clean end: it logs no `current group evicted` and counts no loss while nothing -is lost. Each group's tail frames reach the export. - -## Plan - -Seen 2026-11-17 while validating -[moq-dev/moq#9049](https://github.com/moq-dev/moq/pull/9049) on `main`: a -local `moq-relay`, ffmpeg pushing 30 fps H.264 with a 1 s GOP over RTMP into -`moq import rtmp`, and `moq export webrtc --listen` from the relay (both on -moq-lite-06, WebTransport). The export logged `current group evicted; skipping -to next buffered group ... error=Moq(Stream(Old))` from -`rs/moq-mux/src/container/consumer.rs` once per group (33 in 33 s), while -Chrome still decoded about 30 fps. Every evicted group calls `lose()`, so the -export's loss accounting reports a loss per group. - -Reproduce first, then find which side ends a finished group as `Old`: the -relay hop, `moq-rtmp`'s group writes, or the consumer reading a group whose -successor started. Recent candidates touching this path: -[#8910](https://github.com/moq-dev/moq/pull/8910) (an ordered track reports -the groups it gives up on) and -[#8961](https://github.com/moq-dev/moq/pull/8961) (a group's end in one word). - -## Related - -- [Export order](/quest/m3/export-order.md) - the same warning after an outage, where the eviction is real diff --git a/rs/moq-mux/src/source.rs b/rs/moq-mux/src/source.rs index 8d79e9d6a7..4d359ee196 100644 --- a/rs/moq-mux/src/source.rs +++ b/rs/moq-mux/src/source.rs @@ -372,7 +372,7 @@ impl Source { /// [`Error::EscapingBroadcast`](crate::Error::EscapingBroadcast). /// /// This is the async counterpart to the poll-driven container exporters: consumers - /// that wrap a raw [`moq_net::track::Subscriber`] themselves (e.g. the WebRTC egress) + /// that wrap a raw [`moq_net::track::Subscriber`] themselves /// use it to honor cross-broadcast renditions without reimplementing the path math. #[cfg(feature = "async")] pub async fn subscribe_track( diff --git a/rs/moq-webrtc/src/egress.rs b/rs/moq-webrtc/src/egress.rs index cc5de8c3b3..93bd50ea5d 100644 --- a/rs/moq-webrtc/src/egress.rs +++ b/rs/moq-webrtc/src/egress.rs @@ -324,21 +324,36 @@ impl Rendition { match &self { Self::Audio(name, config) => { - let track = source - .subscribe_track(config.broadcast(), config.instance(), config.track(name)) - .await?; + let track = subscribe_live(&source, config.broadcast(), config.instance(), config.track(name)).await?; codec::Track::opus(track, config) } Self::Video(name, config) => { - let track = source - .subscribe_track(config.broadcast(), config.instance(), config.track(name)) - .await?; + let track = subscribe_live(&source, config.broadcast(), config.instance(), config.track(name)).await?; codec::Track::video(track, config) } } } } +/// How long a group may trail its successor before the publisher gives up on it. A live group +/// finishes the instant the next starts, so a zero budget would reset each one just after its +/// last frame went out and the transport would drop that unread tail. +const MAX_DELAY: Duration = Duration::from_millis(100); + +/// Subscribe to a rendition's track with the [`MAX_DELAY`] budget, resolving its +/// cross-broadcast reference (the catalog `broadcast` field) and `instance`. +async fn subscribe_live( + source: &moq_mux::Source, + rel: Option<&moq_net::path::Relative>, + instance: Option<&moq_net::Instance>, + name: &str, +) -> Result { + let broadcast = source.resolve(rel, instance).await?; + let delay = moq_net::track::Delay::default().with_min(None).with_max(MAX_DELAY); + let subscription = moq_net::track::Subscription::default().with_delay(delay); + Ok(broadcast.track(name)?.subscribe(subscription).await?) +} + /// The best [enabled](hang::catalog::Audio::enabled) Opus rendition that `source` can reach. fn pick_audio<'a>( source: &moq_mux::Source,