Skip to main content

PolicyDecoder

Struct PolicyDecoder 

Source
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>

Source

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.

Source

pub fn with_policy_set(self, preset: PolicySet) -> Self

👎Deprecated:

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.

Source

pub fn report(&self) -> &OperationReport

Bounded decision history; also readable after terminal failure.

Source

pub const fn is_failed(&self) -> bool

Whether this operation can no longer execute native work.

Source§

impl<D: VideoDecoder, R: OperationPolicy> PolicyDecoder<D, R>

Source

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>

Source§

type Error = Error

The implementation’s error.
Source§

fn configure( &mut self, config: &CodecConfig, pulse: Option<&dyn Pulse>, ) -> Result<(), SessionError<Error>>

Start a configuration epoch. Called before the first 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>>

Offer one packet. 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>>

One frame at a time, in presentation order.
Source§

fn end_input(&mut self) -> Result<(), SessionError<Error>>

Declare end of input; idempotent. Then receive until EndOfStream.
Source§

fn reset(&mut self) -> Result<(), SessionError<Error>>

Discard queued input, output and references; keep configuration. Frames already returned stay valid.
Source§

fn stream_info(&self) -> Option<&VideoStreamInfo>

Facts about the stream seen so far.

Auto Trait Implementations§

§

impl<D, R> Freeze for PolicyDecoder<D, R>
where R: Freeze, D: Freeze,

§

impl<D, R> RefUnwindSafe for PolicyDecoder<D, R>

§

impl<D, R> Send for PolicyDecoder<D, R>
where R: Send, D: Send,

§

impl<D, R> Sync for PolicyDecoder<D, R>
where R: Sync, D: Sync,

§

impl<D, R> Unpin for PolicyDecoder<D, R>
where R: Unpin, D: Unpin,

§

impl<D, R> UnsafeUnpin for PolicyDecoder<D, R>
where R: UnsafeUnpin, D: UnsafeUnpin,

§

impl<D, R> UnwindSafe for PolicyDecoder<D, R>
where R: UnwindSafe, D: UnwindSafe,

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.