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
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ per-frame CPU growth since #5926.
- [Interop coverage](/quest/m1/interop-coverage/README.md) - the riskiest moq-transport features moq-net exposes get cross-implementation tests over drafts 18 and 22
- [Calibrate the paired nightly benchmarks](/quest/m1/bench-ci.md) - A/A and deliberately slowed Nightly runs set the paired comparison's threshold, so its regression alerts can be trusted
- [The shared pacer holds its rate under 2 Mbit/s](/quest/m1/pacer-low-rate.md) - a rate-paced controller stops sending up to twice its pacing rate at low rates, landed with a BBR3 retune that keeps the probe budgets
- [A reconfigure keeps the published jitter and delay floor](/quest/m1/catalog-jitter-floor.md) - `Rendition::set` floors unsupplied jitter and delay at the catalog's values, so a same-codec reconfigure after a jitter rise no longer aborts TS import
- [HLS and DASH segment conformance](/quest/m1/hls-conformance.md) - nightly ffprobe checks that advertised timing, sync flags, and bytes match the media served
- [Unbounded groups](/quest/m1/unbounded-groups/README.md) - groups and frames lose their size caps; a group keeps a 32 MB tail, and readers behind it replay through paced flights or refresh
- [A follower is told when the serving epochless route leaves](/quest/m1/epochless-leave-restart.md) - wire-level tests pin the restart a follower gets when the serving epochless route is withdrawn or dies while another remains
Expand Down
44 changes: 0 additions & 44 deletions quest/m1/catalog-jitter-floor.md

This file was deleted.

1 change: 0 additions & 1 deletion quest/m1/hls-conformance.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ own quest below.
## Required

- [HLS export follows a resolution change](/quest/m1/hls-reinit-same-codec.md) - the conformance test's same-codec switch fails until it lands
- [A reconfigure keeps the published jitter and delay floor](/quest/m1/catalog-jitter-floor.md) - the conformance test's TS import aborts with `JitterDecreased` at its reconfigure until it lands

## Related

Expand Down
89 changes: 71 additions & 18 deletions rs/moq-mux/src/catalog/tracks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,20 @@ impl<E: CatalogExt, C: RenditionConfig<E>> Rendition<E, C> {
/// the rendition existed (a dirty start or a B-frame reorder). Only the authoritative ones reach
/// the MSF catalog. A caller who wants to pre-empt detection sets the field on the config, or (for
/// a config an importer builds out of the bitstream) hands the importer a hint like [`VideoHint`].
/// Unset jitter and delay keep the published floor across reconfiguration.
pub(crate) fn set(&mut self, mut config: C) -> crate::Result<()> {
let supplied = config.estimate();
let resolved = Self::resolved(&supplied, &self.detected);
self.check_decrease(&resolved)?;
let mut resolved = Self::resolved(&supplied, &self.detected);
if self.present {
let published = self.config()?.estimate();
if supplied.jitter.is_none() {
resolved.jitter = resolved.jitter.max(published.jitter);
}
if supplied.delay.is_none() {
resolved.delay = resolved.delay.max(published.delay);
}
Self::check_decrease(&published, &resolved)?;
}
config.set_estimate(resolved.clone());
{
let mut guard = self.catalog.modify()?;
Expand Down Expand Up @@ -758,11 +768,7 @@ impl<E: CatalogExt, C: RenditionConfig<E>> Rendition<E, C> {
}

/// Refuse a config that lowers the jitter or delay already advertised to subscribers.
fn check_decrease(&self, next: &Estimate) -> crate::Result<()> {
if !self.present {
return Ok(());
}
let previous = self.config()?.estimate();
fn check_decrease(previous: &Estimate, next: &Estimate) -> crate::Result<()> {
if next.jitter < previous.jitter {
return Err(crate::Error::JitterDecreased);
}
Expand Down Expand Up @@ -808,7 +814,7 @@ impl<E: CatalogExt, C: RenditionConfig<E>> Rendition<E, C> {
if !self.present {
return Err(crate::Error::NotPublished);
}
self.check_decrease(&config.estimate())?;
Self::check_decrease(&self.config()?.estimate(), &config.estimate())?;
let mut guard = self.catalog.modify()?;
let mut next = (*guard).clone();
config.insert(&mut next, &self.name);
Expand Down Expand Up @@ -1008,6 +1014,53 @@ mod tests {
);
}

#[test]
fn reconfigure_floors_only_unsupplied_fields() {
let ms = Duration::from_millis;
for supplied_jitter in [false, true] {
for supplied_delay in [false, true] {
let (_broadcast, catalog, mut rendition) = video_track();
rendition.set(config(None, None)).unwrap();
rendition
.estimate(Estimate::default().with_jitter(ms(100)).with_delay(ms(200)))
.unwrap();
// The most recent reading can be below what was already advertised.
rendition
.estimate(Estimate::default().with_jitter(ms(50)).with_delay(ms(100)))
.unwrap();
let mut next = config(Some(500_000), supplied_jitter.then_some(ms(150)));
next.delay = supplied_delay.then_some(ms(250));
next.coded_width = Some(1920);
next.coded_height = Some(1080);
next.framerate = Some(30.0);
rendition.set(next.clone()).unwrap();
let expected_jitter = Some(ms(if supplied_jitter { 150 } else { 100 }));
let expected_delay = Some(ms(if supplied_delay { 250 } else { 200 }));
next.jitter = expected_jitter;
next.delay = expected_delay;
assert_eq!(catalog.snapshot().video.renditions["v"], next);

// A floor does not turn an unsupplied field into a supplied hint.
rendition
.estimate(Estimate::default().with_jitter(ms(300)).with_delay(ms(400)))
.unwrap();
let current = rendition.config().unwrap();
assert_eq!(
current.jitter,
if supplied_jitter {
expected_jitter
} else {
Some(ms(300))
}
);
assert_eq!(
current.delay,
if supplied_delay { expected_delay } else { Some(ms(400)) }
);
}
}
}

#[test]
fn published_delay_never_decreases() {
let (_broadcast, catalog, mut rendition) = video_track();
Expand All @@ -1017,16 +1070,17 @@ mod tests {
config
};
rendition.set(delayed(Some(Duration::from_millis(200)))).unwrap();
assert!(matches!(
rendition.set(delayed(Some(Duration::from_millis(100)))),
Err(crate::Error::DelayDecreased)
));
for smaller in [Some(Duration::from_millis(100)), None] {
assert!(matches!(
rendition.set(delayed(smaller)),
Err(crate::Error::DelayDecreased)
));
assert!(matches!(
rendition.replace(delayed(smaller)),
Err(crate::Error::DelayDecreased)
));
}
rendition.set(delayed(None)).unwrap();
assert_eq!(
catalog.snapshot().video.renditions["v"].delay,
Some(Duration::from_millis(200))
Expand Down Expand Up @@ -1088,12 +1142,11 @@ mod tests {
config
};
rendition.set(text(Some(Duration::from_millis(100)))).unwrap();
for smaller in [Some(Duration::from_millis(50)), None] {
assert!(matches!(
rendition.set(text(smaller)),
Err(crate::Error::JitterDecreased)
));
}
assert!(matches!(
rendition.set(text(Some(Duration::from_millis(50)))),
Err(crate::Error::JitterDecreased)
));
rendition.set(text(None)).unwrap();
assert_eq!(
catalog.snapshot().text.renditions["t"].jitter,
Some(Duration::from_millis(100))
Expand Down
57 changes: 57 additions & 0 deletions rs/moq-mux/src/container/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ where
}

/// Publish or replace this track's catalog config.
///
/// Unset jitter and delay keep their published floor; explicitly lowering either is refused.
pub fn set(&mut self, config: R) -> crate::Result<()> {
self.rendition.as_mut().ok_or(crate::Error::NotPublished)?.set(config)
}
Expand Down Expand Up @@ -1081,6 +1083,61 @@ mod tests {
assert_eq!(renditions["slow"].jitter, None, "a constant trail is not jitter");
}

#[test]
fn reconfigure_keeps_floors_until_the_track_identity_changes() {
let ms = std::time::Duration::from_millis;
for codec in ["avc3.42c01e", "hev1.1.6.L93.B0"] {
let (_broadcast, catalog, mut tracks) = renditions(&["fast", "slow"]);
let slow = &mut tracks[1];
// Start a new identity, as an importer does when it resolves its codec.
let mut config = hang::catalog::VideoConfig::new(codec.parse::<hang::catalog::VideoCodec>().unwrap());
config.coded_width = Some(640);
config.coded_height = Some(360);
slow.reconfigure(config.clone()).unwrap();
let name = slow.name().to_string();
tracks[0].write(frame(240_000, true)).unwrap();
tracks[1].reorder(Timestamp::from_millis(100).unwrap());
tracks[1].write(frame(40_000, true)).unwrap();
tracks[1].cut(None).unwrap();
let measured = catalog.snapshot().video.renditions[&name].clone();
assert_eq!((measured.jitter, measured.delay), (Some(ms(100)), Some(ms(200))));

// Match an external catalog edit, such as the HLS conformance fixture's raise.
let mut edit = tracks[1].modify().unwrap();
edit.jitter = Some(ms(300));
edit.delay = Some(ms(400));
edit.commit().unwrap();
config.coded_width = Some(1280);
config.coded_height = Some(720);
tracks[1].reconfigure(config.clone()).unwrap();
assert_eq!(tracks[1].name(), name);
let current = catalog.snapshot().video.renditions[&name].clone();
assert_eq!((current.coded_width, current.coded_height), (Some(1280), Some(720)));
assert_eq!((current.jitter, current.delay), (Some(ms(300)), Some(ms(400))));

for (jitter, delay) in [(Some(ms(250)), None), (None, Some(ms(350)))] {
let mut lower = config.clone();
lower.jitter = jitter;
lower.delay = delay;
let err = tracks[1].reconfigure(lower).unwrap_err();
assert!(matches!(
(jitter, err),
(Some(_), crate::Error::JitterDecreased) | (None, crate::Error::DelayDecreased)
));
assert_eq!(catalog.snapshot().video.renditions[&name], current);
}

// A new identity owns a new floor, even when it supplies lower values.
config.codec = hang::catalog::VideoCodec::VP8;
config.jitter = Some(ms(20));
config.delay = Some(ms(30));
tracks[1].reconfigure(config).unwrap();
assert_ne!(tracks[1].name(), name);
let current = catalog.snapshot().video.renditions[tracks[1].name()].clone();
assert_eq!((current.jitter, current.delay), (Some(ms(20)), Some(ms(30))));
}
}

/// History caught up behind the live edge is not a late write: only what follows it measures delay.
#[test]
fn history_measures_no_delay() {
Expand Down