#[non_exhaustive]pub struct Subscription {
pub priority: u8,
pub ordered: bool,
pub latency_max: Duration,
pub group_start: Option<u64>,
pub group_end: Option<u64>,
}Expand description
Subscriber-side preferences for receiving a track.
Each subscriber holds its own Subscription; the publisher observes an
aggregate across all live subscribers via crate::track::Producer::subscription.
A subscriber can change its preferences after the fact with
crate::track::Subscriber::update.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.priority: u8Delivery priority. Higher values preempt lower ones when bandwidth is constrained.
ordered: boolWhether groups are prioritized in sequence order. Groups may always arrive
out-of-order (or not at all) over the network. Defaults to false; the
aggregate is ordered only when every live subscriber asks for it.
latency_max: DurationThe maximum age of a non-latest group before it is skipped. Duration::ZERO
skips immediately (e.g. group 8 arriving means group 7 is skipped); a larger
value tolerates that much reordering before giving up on the older group.
This is the Subscriber Max Latency on the wire, enforced by the publisher’s
cache. Receivers that buffer (e.g. a jitter buffer) enforce the same budget
locally, and a group is skipped once either measure exceeds it.
group_start: Option<u64>First group the publisher should deliver, or None to start at the latest group.
A request, aggregated across every live subscriber (the earliest explicit start
wins), so it says what the publisher sends, not what any one subscriber sees.
crate::track::Subscriber::start_at is the local read cursor; setting one does
not imply the other. See Local cursor vs wire
preference.
group_end: Option<u64>Last group the publisher should deliver (inclusive), or None for no end.
A request, aggregated across every live subscriber (any unbounded subscriber makes
the aggregate unbounded). crate::track::Subscriber::end_at is the local read
cursor; setting one does not imply the other. See Local cursor vs wire
preference.
Implementations§
Source§impl Subscription
impl Subscription
Sourcepub fn with_priority(self, priority: u8) -> Self
pub fn with_priority(self, priority: u8) -> Self
Set the delivery priority, returning self for chaining.
Sourcepub fn with_ordered(self, ordered: bool) -> Self
pub fn with_ordered(self, ordered: bool) -> Self
Set whether groups are prioritized in sequence order, returning self for
chaining. Groups may always arrive out-of-order (or not at all) over the network.
Sourcepub fn with_latency_max(self, latency_max: Duration) -> Self
pub fn with_latency_max(self, latency_max: Duration) -> Self
Set the maximum age of a non-latest group before it is skipped, returning
self for chaining.
Sourcepub fn with_group_start(self, group_start: impl Into<Option<u64>>) -> Self
pub fn with_group_start(self, group_start: impl Into<Option<u64>>) -> Self
Set the first group to deliver, returning self for chaining.
Sourcepub fn with_group_end(self, group_end: impl Into<Option<u64>>) -> Self
pub fn with_group_end(self, group_end: impl Into<Option<u64>>) -> Self
Set the last group to deliver (inclusive), returning self for chaining.
Trait Implementations§
Source§impl Clone for Subscription
impl Clone for Subscription
Source§fn clone(&self) -> Subscription
fn clone(&self) -> Subscription
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more