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 @@ -168,7 +168,6 @@ removed).
- [Segment cuts hold bounded state](/quest/m1/segmenter-cuts.md) - the HLS segmenter keeps one pending cut, so `styp` input without sync samples cannot grow it
- [Next Object on a cold Rust copy](/quest/m1/next-object-cold-copy.md) - a join after an upstream group report starts at the first frame received, never skipping
- [Container consumers buffer by backpressure](/quest/m1/container-backpressure.md) - Rust and JS container consumers decode ahead only a byte budget, so a hostile publisher cannot grow them
- [Settled copies versus whole groups](/quest/m1/settled-copies.md) - every model check of whether a group is done means either a settled copy or the whole group, as it needs
- [An HLS viewer starts capture](/quest/m1/hls-record-demand.md) - a record-track subscriber counts as demand for its rendition's media
- [One moq-ffi build definition](/quest/m1/ffi-build-flags.md) - every binding takes moq-ffi's default features from one place
- [moq-clock moves into kio::clock](/quest/m1/kio-clock.md) - moq-clock and its test macro become `kio::clock` and `#[kio::test]` before the cut publishes them
Expand Down
26 changes: 0 additions & 26 deletions quest/m1/settled-copies.md

This file was deleted.

8 changes: 4 additions & 4 deletions rs/moq-net/src/model/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,8 @@ pub(super) struct Track {
#[derive(Default)]
struct Largest {
position: Option<Position>,
// The largest group's content may still grow: no copy of it finished, and it is not a
// datagram. An aborted one stays open, since it can be recreated or fetched.
// The largest group's content may still grow: no copy of the whole group finished, and it
// is not a datagram. An aborted one stays open, since it can be recreated or fetched.
open: bool,
// The track ended, so no newer position can follow.
ended: bool,
Expand All @@ -738,8 +738,8 @@ impl Track {
}
}

/// Group `sequence` holds every frame it will have: a copy finished, or it is a datagram.
/// A group name fixes its content, so no legal write raises the largest past it.
/// Group `sequence` holds every frame it will have: a whole copy finished, or it is a
/// datagram. A group name fixes its content, so no legal write raises the largest past it.
pub(super) fn finish_largest(&self, sequence: u64) {
let mut largest = self.largest.lock();
if largest.position.is_some_and(|position| position.group == sequence) {
Expand Down
5 changes: 4 additions & 1 deletion rs/moq-net/src/model/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,10 @@ impl Producer {
// An empty group counts as content once it ends.
self.handle.start(None);
// A finished group can no longer raise the track's largest, which may end its stream.
self.handle.cache.finish_largest(self.sequence);
// A copy a transport bound cut short finished only its own range.
if original_fin.is_some() {
self.handle.cache.finish_largest(self.sequence);
}
Ok(())
}

Expand Down
40 changes: 40 additions & 0 deletions rs/moq-net/src/model/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,9 @@ impl TrackState {
.chain(self.detached.drain(..).filter_map(|copy| copy.writing()))
.collect();
let dropped = StreamError::from(&err);
// A slot survives only on a copy holding the whole group. A finished bounded copy
// serves no group reader, so it leaves the cache like an open one; a reader already
// holding it keeps it, since its writer settled and it is not aborted above.
let open: Vec<_> = self
.lookup
.iter()
Expand Down Expand Up @@ -8488,6 +8491,43 @@ mod test {
assert_eq!(reader.poll_largest(&noop), Poll::Ready(None));
}

/// A copy a transport bound cut short finishes only its own range, so the largest group
/// may still grow and the stream stays open past the end.
#[moq_clock::test]
#[cfg(feature = "async")]
async fn a_finished_bounded_copy_keeps_the_largest_open() {
let mut producer = track_producer("test", Info::timed());
let dynamic = producer.requests();
let noop = kio::Waiter::noop();
let mut first = producer.create_group(group::Info { sequence: 0 }).unwrap();
first.write_frame(Timestamp::ZERO, &b"a"[..]).unwrap();
first.abort(Error::Cancel).unwrap();
producer.finish_at(Position::group(1)).unwrap();

let mut reader = producer.consume();
assert_eq!(reader.poll_largest(&noop), Poll::Ready(Some(Position::group(0))));
let fetch = reader.fetch_range(
0,
FetchOptions {
options: group::Fetch::default(),
end: Some(1),
},
);
let mut bounded = dynamic
.requested_fill_group()
.await
.unwrap()
.accept(Info::timed())
.unwrap();
bounded.write_frame(Timestamp::ZERO, &b"a"[..]).unwrap();
bounded.finish().unwrap();
fetch.await.unwrap();
assert!(
reader.poll_largest(&noop).is_pending(),
"the bounded copy does not hold the whole group"
);
}

/// A datagram raises the largest like a group, at its only object.
#[test]
fn a_datagram_raises_the_largest() {
Expand Down
Loading