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
32 changes: 28 additions & 4 deletions rs/moq-net/src/model/broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,29 @@ impl Producer {
}
}

/// Remove the spliced track `producer` from under `name`, unless it has a reader.
///
/// Returns false only when a reader holds it: lookups hand out readers under the
/// same lock, so one arriving after the caller decided is never cut off. Anything
/// else (removed, or already replaced under the name) is gone as far as the caller
/// is concerned.
pub(crate) fn forget_spliced(&self, name: &str, producer: &super::resume::Producer) -> bool {
let mut state = self.state.lock();
let Some(spliced) = state.spliced.as_mut() else {
return true;
};
match spliced.tracks.get(name) {
Some(current) if current.is_clone(producer) => {
if current.is_used() {
return false;
}
spliced.tracks.remove(name);
true
}
_ => true,
}
}

/// Create a consumer of this one publisher's broadcast.
///
/// A view of this broadcast object, not of its path: a new publisher at the same
Expand Down Expand Up @@ -814,11 +837,12 @@ impl Consumer {
// the time, not a property of the name: a publisher that had not yet
// created the track may have it now. Drop it so this request reaches a
// source again, exactly as the plain lookup below reclaims a closed
// entry. A *finished* one stays, since its cache is still readable.
// entry. A *finished* one stays, since its cache is still readable,
// until the front forgets it after going unread for its linger.
//
// So a name, once finished, never comes back here: a publisher that
// finishes a track and publishes it again is serving new content, not
// resuming this one, and a subscriber has to re-read the catalog and
// So a name, once finished, is never spliced onto again: a publisher
// that finishes a track and publishes it again is serving new content,
// not resuming this one, and a subscriber has to re-read the catalog and
// re-initialize rather than be spliced onto it. Resuming the same
// content across routes is the transparent case, and that is what
// `resume::Producer` already does. Publish new content under a new
Expand Down
Loading
Loading