pub struct PolicyDecoder<D, R> { /* private fields */ }Expand description
A native decoder with one shared application resolver before every output presentation. No native frame is published on refusal, cancellation or an invalid/stale choice. The original frame is returned unchanged on success.
The resolver runs for every presentation, even within the same epoch: policy may inspect timing, and equal epochs do not prove equal interpretation. Reports keep the most recent decisions in a fixed bound.
All failures and caught unwinds are terminal and drop the native decoder,
including its queued frames/references. reset is available only while the
operation remains healthy; after failure construct a fresh operation. Frames
previously returned remain valid through their own native owners.
Implementations§
Source§impl<D, R> PolicyDecoder<D, R>
impl<D, R> PolicyDecoder<D, R>
Sourcepub fn new(decoder: D, resolver: R) -> Self
pub fn new(decoder: D, resolver: R) -> Self
Wrap a native decoder and a built-in policy, application object or closure.
Construction performs no decoding or policy decision. Native construction
already happened; use Self::try_new to admit it before the factory runs.
Sourcepub fn with_policy_set(self, preset: PolicySet) -> Self
👎Deprecated: Pass PolicySet or BoundPolicy as the operation policy argument
pub fn with_policy_set(self, preset: PolicySet) -> Self
Pass PolicySet or BoundPolicy as the operation policy argument
The built-in policy used when this resolver returns UsePreset.
During migration, these requirements and the policy argument
both apply. A bound policy supplies preferences in place of these.
Sourcepub fn report(&self) -> &OperationReport
pub fn report(&self) -> &OperationReport
Bounded decision history; also readable after terminal failure.
Source§impl<D: VideoDecoder, R: OperationPolicy> PolicyDecoder<D, R>
impl<D: VideoDecoder, R: OperationPolicy> PolicyDecoder<D, R>
Sourcepub fn try_new<E: StdError + Send + Sync + 'static>(
factory: impl FnOnce() -> Result<D, E>,
resolver: R,
pulse: Option<&dyn Pulse>,
) -> Result<Self, Error>
pub fn try_new<E: StdError + Send + Sync + 'static>( factory: impl FnOnce() -> Result<D, E>, resolver: R, pulse: Option<&dyn Pulse>, ) -> Result<Self, Error>
Check mandatory workspace requirements before constructing the native decoder.
The factory is called once on admission, never on prior refusal/cancellation. Cancellation is checked again after successful construction; a cancelled decoder is dropped before it can be returned. The factory must poll during lengthy work itself; this boundary cannot preempt a synchronous constructor. This generic adapter has no qualified workspace bound, so any explicit workspace limit refuses even if large. Default policies permit construction. The factory must include native preparation; constructing a decoder first and moving it into this closure cannot put those earlier effects under admission. Frame interpretation and metadata decisions still happen at publication.
Trait Implementations§
Source§impl<D: VideoDecoder, R: OperationPolicy> VideoDecoder for PolicyDecoder<D, R>
impl<D: VideoDecoder, R: OperationPolicy> VideoDecoder for PolicyDecoder<D, R>
Source§fn configure(
&mut self,
config: &CodecConfig,
pulse: Option<&dyn Pulse>,
) -> Result<(), SessionError<Error>>
fn configure( &mut self, config: &CodecConfig, pulse: Option<&dyn Pulse>, ) -> Result<(), SessionError<Error>>
send and on
every epoch change (new sequence header, new stsd entry).Source§fn send(
&mut self,
packet: &mut Packet,
pulse: Option<&dyn Pulse>,
) -> Result<SendStatus, SessionError<Error>>
fn send( &mut self, packet: &mut Packet, pulse: Option<&dyn Pulse>, ) -> Result<SendStatus, SessionError<Error>>
Accepted takes its payload; ReceivePending
leaves it intact for retry after receive.Source§fn receive(
&mut self,
pulse: Option<&dyn Pulse>,
) -> Result<Receive<Frame>, SessionError<Error>>
fn receive( &mut self, pulse: Option<&dyn Pulse>, ) -> Result<Receive<Frame>, SessionError<Error>>
Source§fn end_input(&mut self) -> Result<(), SessionError<Error>>
fn end_input(&mut self) -> Result<(), SessionError<Error>>
receive until EndOfStream.