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
plain Frames 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 async fn read(&mut self) -> Result<Option<Frame>, Error>
pub async fn read(&mut self) -> Result<Option<Frame>, Error>
Read the next decoded frame, or None after the track ends and the
decoder’s buffered tail has been drained.
This inherits Sink’s cancellation contract. If a queued codec
operation is cancelled, the next read returns a codec error: a cancelled
mid-stream decode poisons the sink so every later read keeps returning
that error, while a cancelled tail flush reports the error once and then
None. Drop the consumer instead of continuing to read it.