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 @@ -147,7 +147,6 @@ removed).
- [moq-quic's API improves on quinn's](/quest/m1/quic-api/README.md) - moq-quic and both QUIC drivers ship one mirrored API: `send::`/`recv::` namespaces, one error per direction, consuming terminal operations, plain configs, no quinn baggage
- [On-demand JavaScript FETCH](/quest/m1/js-fetch-on-demand.md) - browser publishers answer IETF FETCH for evicted or uncached groups through the JS ranges request surface
- [Rust cancels an unclaimed fill head when a subscription ends](/quest/m1/ietf-fill-end-cancel.md) - SUBSCRIPTION_ENDED cancels, not finishes, a fill no group was sent for, as in JS
- [A resumed untimed copy keeps DYNAMIC_GROUPS](/quest/m1/ietf-dynamic-groups-resume.md) - opting out of properties on a draft-22 resume no longer forgets DYNAMIC_GROUPS
- [Rust marks a lost listed group unknown](/quest/m1/ietf-publisher-unknown-range.md) - the Rust IETF publisher sends End of Unknown Range for a listed group it can't serve, after the publisher's open quests land
- [Native rung disable](/quest/m1/simulcast-rung-disable.md) - OBS stops sending the top renditions its grant cannot fund, as the Rust/FFI publishers do, and a shaped uplink through moq-ffi proves the resume
- [Audio jitter target](/quest/m1/audio-jitter-target/README.md) - the playout target is default in both languages; a manual browser proof and a native trace replay remain
Expand Down
14 changes: 0 additions & 14 deletions quest/m1/ietf-dynamic-groups-resume.md

This file was deleted.

43 changes: 25 additions & 18 deletions rs/moq-net/src/ietf/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,9 @@ struct Idle {
/// Serves its cache misses with a group FETCH, subscribed or not.
dynamic: track::Requests,
demand: track::Demand,
timescale: Option<Timescale>,
/// The Track Properties the publisher declared for the copy. A resumed SUBSCRIBE that
/// opts out of them is answered without them, so the copy keeps these.
properties: ietf::Properties,
/// The publisher ended the track, so a returning subscriber reads the copy as it is.
finished: bool,
}
Expand Down Expand Up @@ -3144,6 +3146,11 @@ impl Subscriber {
let order = aggregate.map(|s| s.order).unwrap_or_default();
// Without an Established subscription, a relay includes the request it holds.
let new_group = target.new_group();
// A timed copy asks for the units that opt its objects into timestamps.
let properties_wanted = match &target {
Target::Request(_) => true,
Target::Resume(idle) => idle.properties.timescale.is_some(),
};
// Buffered only: the wait for the answer flushes it, so the local terminals still end a
// request the peer's send window holds back.
let written = match &held {
Expand Down Expand Up @@ -3174,13 +3181,7 @@ impl Subscriber {
group_order: order.into(),
filter: join.filter,
fill: join.fill,
// A resumed copy already knows the track, from the answer that accepted
// it, but only a TIMESCALE in this answer opts its objects into the
// timestamps a timed copy reads.
properties_wanted: match &target {
Target::Request(_) => true,
Target::Resume(idle) => idle.timescale.is_some(),
},
properties_wanted,
forward: true,
rendezvous: false,
range_filters: false,
Expand Down Expand Up @@ -3406,8 +3407,15 @@ impl Subscriber {
properties,
largest,
} = accepted;
// The objects are stamped in the units the answer declares. A timed copy asked for
// them; an untimed one that opted out has none to keep.
// A resumed SUBSCRIBE opts out of the properties from draft-22, so its answer carries
// none and the copy keeps the ones it learned. Before that the answer declares them
// again. A pause holds these too, so a later resume still knows DYNAMIC_GROUPS.
let properties = match &resumed {
Some(idle) if held.is_none() && !properties_wanted && ietf::Filter::is_draft20(self.version) => {
idle.properties.clone()
}
_ => properties,
};
let timescale = properties.timescale;
let info = accepted_info(&properties, self.version);
// The copy already holds the track: it is current again up to the answer's Largest
Expand Down Expand Up @@ -3941,8 +3949,7 @@ impl Subscriber {
messages,
request_id,
alias,
// What a pause holds again: the properties the track was listed with.
properties,
properties: properties.clone(),
owed: unanswered.load(Ordering::Relaxed),
copy: Some(track.clone()),
};
Expand All @@ -3951,7 +3958,7 @@ impl Subscriber {
demand: track.demand(),
track,
dynamic,
timescale,
properties,
finished: false,
});
}
Expand All @@ -3974,7 +3981,7 @@ impl Subscriber {
demand: track.demand(),
track,
dynamic,
timescale,
properties,
finished: true,
});
}
Expand Down Expand Up @@ -4002,7 +4009,7 @@ impl Subscriber {
demand: track.demand(),
track,
dynamic,
timescale,
properties,
finished: false,
})
}
Expand Down Expand Up @@ -4081,7 +4088,7 @@ impl Subscriber {
broadcast_path.clone(),
track_name.to_owned(),
fill,
Later::Known(idle.timescale),
Later::Known(idle.properties.timescale),
);
group_fetches.push(fetch);
}
Expand Down Expand Up @@ -4388,7 +4395,7 @@ impl Subscriber {
.await;
match learned {
Ok(idle) => {
timescale.resolve(Ok(idle.timescale));
timescale.resolve(Ok(idle.properties.timescale));
Some(idle)
}
Err(err) => {
Expand Down Expand Up @@ -4548,7 +4555,7 @@ impl Subscriber {
demand: track.demand(),
track,
dynamic,
timescale: ok.properties.timescale,
properties: ok.properties,
finished: false,
})
}
Expand Down
106 changes: 106 additions & 0 deletions rs/moq-net/src/ietf/subscriber/tracks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1766,6 +1766,112 @@ mod tests {
}
}

/// A copy that learned DYNAMIC_GROUPS keeps it through a draft-22 resume that opts out of
/// the properties, so once that subscription pauses as the listing's entry, the
/// REQUEST_UPDATE resuming it still carries the group a join asked for.
#[kio::test]
async fn a_paused_resume_that_opted_out_keeps_dynamic_groups() {
let version = Version::Draft22;
let mut h = harness(version);
let mut listing = h.establish().await;
let accept = |peer: memory::Session| async move {
let mut stream = kio::clock::timeout(TIMEOUT, Stream::accept(&mut Transport::new(peer), version))
.await
.expect("no SUBSCRIBE")
.unwrap();
let (id, body) = read(&mut stream).await;
assert_eq!(id, ietf::Subscribe::ID);
let msg: ietf::Subscribe = body.message(version).unwrap();
(stream, msg.properties_wanted, msg.new_group)
};
let subscribe_ok = |dynamic_groups| ietf::SubscribeOk {
track_alias: 3,
largest: Some(ietf::Location { group: 5, object: 0 }),
properties: ietf::Properties {
dynamic_groups,
..Default::default()
},
};
let answer = ietf::RequestOk {
active: None,
largest: None,
};

// The first answer declares DYNAMIC_GROUPS, and group 5 lands with a delta.
let (track, first, _serving) = h.read_track("video").await;
let (mut stream, wanted, _) = accept(h.peer.clone()).await;
assert!(wanted);
write(&mut stream, ietf::SubscribeOk::ID, &subscribe_ok(true)).await;
let first = kio::clock::timeout(TIMEOUT, first)
.await
.expect("never accepted")
.unwrap();
let copy = h
.subscriber
.state
.lock()
.subscribes
.values()
.next()
.unwrap()
.producer
.clone()
.unwrap();
let mut group = copy.create_group(crate::model::group::Info { sequence: 5 }).unwrap();
group.write_frame(None, b"key".as_slice()).unwrap();
group.write_frame(None, b"delta".as_slice()).unwrap();

// A join past the ratio asks for group 6, which stays outstanding.
let join = track.subscribe(None).await.unwrap();
settle().await;
let (id, body) = read(&mut stream).await;
assert_eq!(id, ietf::SubscribeUpdate::ID);
assert_eq!(
body.message::<ietf::SubscribeUpdate>(version).unwrap().new_group,
Some(6)
);
write(&mut stream, ietf::RequestOk::ID, &answer).await;

// Everyone leaves, and the copy lingers.
drop((first, join));
settle().await;

// A returning reader resumes it, opting out of the properties: the answer has none.
let reader = track.subscribe(None);
let (mut stream, wanted, new_group) = accept(h.peer.clone()).await;
assert!(!wanted, "the resume opts out");
assert_eq!(new_group, Some(6));
write(&mut stream, ietf::SubscribeOk::ID, &subscribe_ok(false)).await;
let reader = kio::clock::timeout(TIMEOUT, reader)
.await
.expect("never accepted")
.unwrap();

// Skipped in the listing, so this subscription becomes the entry and pauses.
let skipped = ietf::PublishSkipped {
suffix: Path::from_static(""),
track_name: "video".into(),
};
write(&mut listing, ietf::PublishSkipped::ID, &skipped).await;
assert_eq!(event(&mut h.tracks).as_deref(), Some("+video"));
drop(reader);
let (id, body) = read(&mut stream).await;
assert_eq!(id, ietf::SubscribeUpdate::ID, "not paused");
assert_eq!(
body.message::<ietf::SubscribeUpdate>(version).unwrap().forward,
Some(false)
);
write(&mut stream, ietf::RequestOk::ID, &answer).await;

// The resume still asks for group 6, since the track declared DYNAMIC_GROUPS.
let _reader = track.subscribe(None);
let (id, body) = read(&mut stream).await;
assert_eq!(id, ietf::SubscribeUpdate::ID, "not resumed");
let resume: ietf::SubscribeUpdate = body.message(version).unwrap();
assert_eq!(resume.forward, Some(true));
assert_eq!(resume.new_group, Some(6), "the pause forgot DYNAMIC_GROUPS");
}

/// A listed track that finishes before its resume is answered goes back to lingering, and
/// its waiting reader SUBSCRIBEs: the idle copy cannot place the end, which the SUBSCRIBE
/// learns, rather than abort a clean finish.
Expand Down