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
30 changes: 0 additions & 30 deletions quest/m1/export-evicts-every-group.md

This file was deleted.

2 changes: 1 addition & 1 deletion rs/moq-mux/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
27 changes: 21 additions & 6 deletions rs/moq-webrtc/src/egress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<moq_net::track::Subscriber> {
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,
Expand Down