#[non_exhaustive]pub struct Info {
pub timescale: Option<Timescale>,
pub max_age: Option<Duration>,
pub priority: i8,
pub compression: Compression,
pub refresh: Refresh,
/* private fields */
}Expand description
Publisher-side properties of a track.
These are fixed by the publisher when the track is created and don’t change
while the track is alive. A subscriber learns them via
broadcast::Consumer::track,
which returns the publisher’s Info once the subscription is accepted.
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.timescale: Option<Timescale>Units per second for per-frame timestamps on this track, or None for an untimed
track.
A track is all timed or all untimed: every frame on a timed track
carries a timestamp, none on an untimed one does, and a write that doesn’t match
is refused with Error::TimestampMismatch. Defaults to None (untimed). On
Lite05+ it is reported in TRACK_INFO and the publisher zigzag-delta encodes
per-frame timestamps at this scale on the wire; on moq-transport it is the
TIMESCALE Track Property. A track received without one (pre-Lite05 moq-lite, or
moq-transport without TIMESCALE) is untimed.
max_age: Option<Duration>How long a superseded group stays fresh. The newest group is never stale.
A group is stale once either clock reaches the budget: the wall-clock time since
its successor arrived at this hop, or how far its successor’s first timestamp
trails the live edge (see Start::Live). An untimed track is judged
by the wall clock alone, and a peer whose timestamps stop advancing cannot pin a
superseded group.
A freshness bound on what may still be served, the inverse of an HTTP
Cache-Control: max-age. A live join’s max is clamped to this, since a
group can’t be waited for once it is stale. Reported in TRACK_INFO so
relays re-serve with the same bound.
An authored track defaults to Some(Duration::ZERO): a superseded group is stale at once,
so only the live edge is served, and a publisher that wants a reader to reach history sets a
longer age, or None, explicitly. None sets no publisher limit: requested with
with_max_age(None), and kept by a track received without one (an older moq-lite, or
moq-transport without MAX_CACHE_DURATION). A hop’s cache still bounds what it keeps with
its own pool and ceiling. Stale groups are skipped by readers; reclaiming their bytes is
the cache pool’s expiry window.
This is the Publisher Max Age on the wire, the publisher-side half of the
budget a live join’s max sets for a subscriber (see Start::Live).
Encoded as milliseconds in a QUIC varint, so a duration of 2^62 milliseconds
or more cannot be put on lite-07 wires. moq-transport egress never sends it, since
its MAX_CACHE_DURATION would also expire the newest group; a received one still sets it. Lite05/06 map values at or above
2^53 - 1 milliseconds to no limit for older JavaScript readers. Sub-millisecond precision is truncated
(Duration::as_millis) at encode time.
priority: i8The publisher’s priority for this track, higher first, defaulting to 0.
It breaks ties between subscriptions of equal subscriber priority. Reported in TRACK_INFO (Lite05+).
compression: CompressionHow frames are compressed per group, so later frames compress against earlier ones in
the same group. Defaults to Compression::None.
Writers and readers see plain frames either way: the producer compresses each frame as it is written and the cache stores the compressed form. A moq-lite-07 peer or a moq-transport peer negotiating the Flate extension receives the compressed bytes and the codec. Other sessions receive one shared inflated copy per group, unless a sealed compression declaration makes that fallback unsupported. Worth it for small, repetitive payloads like JSON; wasted on media.
refresh: RefreshWhen a reader asks for a new group: on a live join, on a Subscriber::refresh, or
both. Defaults to never. See Refresh.
On moq-transport, a track that refreshes at all is advertised as DYNAMIC_GROUPS, which
arrives as a Refresh::ratio of Some(0).
Implementations§
Source§impl Info
impl Info
Sourcepub fn with_timescale(self, timescale: impl Into<Option<Timescale>>) -> Self
pub fn with_timescale(self, timescale: impl Into<Option<Timescale>>) -> Self
Set the per-frame timestamp scale, or None for an untimed track, returning self
for chaining.
Defaults to None (untimed). On Lite05+ this scale is reported in TRACK_INFO
and used to encode per-frame timestamps on the wire.
Sourcepub fn with_max_age(self, max_age: impl Into<Option<Duration>>) -> Self
pub fn with_max_age(self, max_age: impl Into<Option<Duration>>) -> Self
Set how long a superseded group stays fresh, or None for no publisher limit,
returning self for chaining. See max_age.
Sourcepub fn with_priority(self, priority: i8) -> Self
pub fn with_priority(self, priority: i8) -> Self
Set the publisher’s priority, returning self for chaining.
Sourcepub fn with_compression(self, compression: Compression) -> Self
pub fn with_compression(self, compression: Compression) -> Self
Set how frames are compressed per group, returning self for chaining.
Sourcepub fn with_refresh(self, refresh: Refresh) -> Self
pub fn with_refresh(self, refresh: Refresh) -> Self
Set when a reader asks for a new group, returning self for chaining.
Sourcepub fn rescale(&self, timestamp: Timestamp) -> Result<Timestamp>
pub fn rescale(&self, timestamp: Timestamp) -> Result<Timestamp>
timestamp at this track’s timescale.
A track is all timed or all scale-less, so a frame must match it: a scaled timestamp
on a scale-less track, or an unscaled one on a timed track, is
Error::TimestampMismatch, as is a timestamp the track’s scale can’t hold. A writer
that changes state before its frame reaches the track, such as signing or encrypting
it, rescales first so a refused timestamp changes nothing.
Sourcepub fn rescale_in(&self, timestamp: Timestamp, key: u64) -> Result<Timestamp>
pub fn rescale_in(&self, timestamp: Timestamp, key: u64) -> Result<Timestamp>
Self::rescale for a frame of group key: a scale-less track’s frame carries its
group’s key, so any other is Error::TimestampMismatch. A writer that changes state
before its frame reaches the group checks this first, as with Self::rescale.
Trait Implementations§
Source§impl Default for Info
An authored track’s defaults: untimed, a zero max_age (the live edge only),
priority 0, uncompressed, never asking for a refresh.
impl Default for Info
An authored track’s defaults: untimed, a zero max_age (the live edge only),
priority 0, uncompressed, never asking for a refresh.
impl Eq for Info
impl StructuralPartialEq for Info
Auto Trait Implementations§
impl Freeze for Info
impl RefUnwindSafe for Info
impl Send for Info
impl Sync for Info
impl Unpin for Info
impl UnsafeUnpin for Info
impl UnwindSafe for Info
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.