Skip to main content

Consumer

Struct Consumer 

Source
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

Source

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.

Source

pub fn name(&self) -> &str

The decoder backend name in use, e.g. "videotoolbox" or "openh264".

Source

pub fn options(&self) -> &Options

The options this consumer was built with, with any set_max_delay applied.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more