pub struct Consumer { /* private fields */ }Expand description
Subscribe to a moq-mux video track and emit decoded frames.
The codec/backend are fixed at construction; read returns
Read events carrying pictures in the representation
Config::output asked for. The direct mirror of
moq_audio::decode::Consumer.
Implementations§
Source§impl Consumer
impl Consumer
Sourcepub async fn new(
broadcast: &Consumer,
catalog: &VideoConfig,
name: impl Into<String>,
options: Options,
) -> Result<Self, Error>
pub async fn new( broadcast: &Consumer, catalog: &VideoConfig, name: impl Into<String>, options: Options, ) -> Result<Self, Error>
Subscribe to name in broadcast, decoding it per the catalog entry.
Errors if the rendition’s codec is not supported by a native backend.
Sourcepub fn options(&self) -> &Options
pub fn options(&self) -> &Options
The options this consumer was built with, with any set_max_delay
applied.
Sourcepub fn max_delay(&self) -> Duration
pub fn max_delay(&self) -> Duration
How far a group may fall behind the live edge before it is skipped: Delay::max,
clamped to the track’s max age.
Sourcepub fn set_max_delay(&mut self, max: Duration)
pub fn set_max_delay(&mut self, max: Duration)
Move Delay::max mid-stream, updating the subscription in place.
A player whose playout delay moves calls this to keep the subscription reaching as far behind it. A read cancelled mid-decode picks it up before it next waits on the track.
A history subscription, Start::Oldest with no Delay::max, reads every group in
order and ignores it: the transport delivers nothing past a missing group, so there is no
budget to skip at.
Sourcepub fn set_priority(&mut self, priority: i8)
pub fn set_priority(&mut self, priority: i8)
Move the subscription priority mid-stream, updating the subscription in place rather than resubscribing, so nothing already fetched is dropped or fetched again.
A read in flight is unaffected; an ended track ignores it.
Sourcepub fn arrival(&self) -> Option<Instant>
pub fn arrival(&self) -> Option<Instant>
When the access unit behind the latest picture read returned
landed in this node’s cache (moq_mux::container::Consumer::arrival).
Pair it with when the picture was read to tell network delay from decode
delay: it excludes the time the decoder held or reordered the picture.
A gap or an end leaves it unchanged, as moq_audio::decode::Consumer::arrival
does. None before the first picture, and for a picture that no access unit,
or more than one, matches by timestamp: one a backend returned at a timestamp
it was never handed, or a stream that repeats a timestamp while the decoder
holds both.
Sourcepub async fn read(&mut self) -> Result<Option<Read>, Error>
pub async fn read(&mut self) -> Result<Option<Read>, Error>
Read the next decoded picture or boundary, or None after the track ends and
the decoder’s buffered tail has been drained.
Join and delivery-gap recovery trim leading pictures whose previous GOP is absent.
Cancel-safe: a decode in flight when the read is dropped is kept and finished by the next read. A codec error fails the read.