From 16af9410ae80ad74b87524b2cdde3801f601daa8 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 1 Sep 2026 10:42:30 -0700 Subject: [PATCH] fix(rs): repair the test call sites the main merge missed The main-into-dev merge (3227c195e) left three tests behind, and the first two stopped the workspace compiling, so `just check` and `just test` failed for every branch based on dev. `moq-video` called `catalog.track_info()` in a test while dev's `moq-mux` signature takes a priority; the production call site in the same file was already updated. `moq-rtc` built its origins with `moq_net::Origin::random()` and announced through `create_broadcast(path, Route)`, both replaced on dev by `origin::Info` plus a separate `announce(prefix, Route)`. `moq-video`'s idle-capture test then compiled and failed. The discontinuity marker is still published; the test read the finished track through the default `Duration::ZERO` budget, which sheds the empty group as soon as the resumed group stamps its reach. A live consumer takes that marker as the live edge, so the fix is a subscription with a replay window, matching the other tests that walk a finished multi-group track. Co-Authored-By: Claude Opus 5 --- rs/moq-rtc/src/lib.rs | 19 ++++++++++++------- rs/moq-video/src/encode/producer.rs | 10 ++++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/rs/moq-rtc/src/lib.rs b/rs/moq-rtc/src/lib.rs index b75c0e394e9..73ac20d6b6e 100644 --- a/rs/moq-rtc/src/lib.rs +++ b/rs/moq-rtc/src/lib.rs @@ -85,11 +85,11 @@ mod tests { #[tokio::test] async fn whip_and_whep_round_trip_opus() { - let source_origin = moq_net::Origin::random().produce(); + let source_origin = moq_tokio::origin::spawn(moq_net::Hop::random()); let source_consumer = source_origin.consume(); let mut announcements = source_consumer.announced(); let mut source = source_origin - .create_broadcast("source", moq_net::broadcast::Route::new().with_announce(true)) + .create_broadcast("source") .expect("create source broadcast"); let catalog = moq_mux::catalog::Producer::new(&mut source).expect("create source catalog"); let mut opus = crate::codec::opus::Bridge::new(source, catalog, 48_000, 2).expect("create Opus bridge"); @@ -101,15 +101,20 @@ mod tests { }, ) .expect("publish source packet"); + + // Create, populate, announce: the route goes out once the tracks exist. + let _source_route = source_origin + .announce("source", moq_net::origin::Route::default()) + .expect("announce source"); let announcement = tokio::time::timeout(TIMEOUT, announcements.next()) .await .expect("source announcement timed out") .expect("source origin closed"); - assert_eq!(announcement.path.as_str(), "source"); - assert!(announcement.broadcast.is_some(), "source was unannounced"); + assert_eq!(announcement.prefix.as_path().as_str(), "source"); + assert!(announcement.active, "source was unannounced"); drop(announcements); - let server_origin = moq_net::Origin::random().produce(); + let server_origin = moq_tokio::origin::spawn(moq_net::Hop::random()); let server = Server::new( server::Config::default(), server_origin.clone(), @@ -131,9 +136,9 @@ mod tests { .expect("WHIP negotiation timed out") .expect("WHIP negotiation failed"); - let output_origin = moq_net::Origin::random().produce(); + let output_origin = moq_tokio::origin::spawn(moq_net::Hop::random()); let output = output_origin - .create_broadcast("output", moq_net::broadcast::Route::new().with_announce(true)) + .create_broadcast("output") .expect("create output broadcast"); let output_consumer = output.consume(); let whep = format!("http://{address}/whep/ingested").parse().expect("WHEP URL"); diff --git a/rs/moq-video/src/encode/producer.rs b/rs/moq-video/src/encode/producer.rs index 0c17a7d2df4..6beb237c1c2 100644 --- a/rs/moq-video/src/encode/producer.rs +++ b/rs/moq-video/src/encode/producer.rs @@ -593,8 +593,14 @@ mod tests { async fn idle_capture_publishes_a_discontinuity_before_resume() { let mut broadcast = moq_net::broadcast::Info::new().produce(); let catalog = moq_mux::catalog::Producer::new(&mut broadcast).unwrap(); - let track = broadcast.create_track("video", catalog.track_info()).unwrap(); - let consumer = track.subscribe(None); + let track = broadcast + .create_track("video", catalog.track_info(hang::catalog::PRIORITY.video)) + .unwrap(); + // The test walks the finished track after the fact, so it needs a subscriber that tolerates + // a backlog. The default budget is `Duration::ZERO`, which sheds the empty marker the moment + // the resumed group stamps its reach; a live consumer takes it as the edge instead. + let subscription = moq_net::track::Subscription::default().with_max_age(std::time::Duration::from_secs(60)); + let consumer = track.subscribe(subscription); let mut config = Config::new(320, 240, 30); config.kind = encoder::Kind::Software;