Skip to main content

VideoFramePool

Struct VideoFramePool 

Source
pub struct VideoFramePool { /* private fields */ }
Expand description

Thread-safe (native) or single-threaded (wasm32) bounded reusable CPU RGBA8 video frame pool.

Implementations§

Source§

impl VideoFramePool

Bounded zero-allocation steady-state buffer acquisition and recycling for VideoFramePool.

Source

pub fn with_capacity(capacity: usize) -> Self

Creates a bounded CPU video frame pool allowing at most capacity simultaneous buffers.

§Arguments
  • usize - Maximum number of buffers (>= 1).
§Returns
  • Self - Bounded VideoFramePool.
Source

pub fn acquire(&self, width: u32, height: u32) -> Option<PooledVideoFrame>

Acquires a reusable RGBA8 frame buffer sized for width x height, returning None when bounded capacity is exhausted.

§Arguments
  • &Self - Pool reference.
  • u32 - Frame width in pixels.
  • u32 - Frame height in pixels.
§Returns
  • Option<PooledVideoFrame> - Reusable frame buffer or None under bounded backpressure.
Source

pub fn recycle(&self, frame: PooledVideoFrame)

Returns a checked-out CPU video frame buffer back into the bounded pool for zero-allocation reuse.

§Arguments
  • &Self - Pool reference.
  • PooledVideoFrame - Frame buffer to recycle.
Source

pub fn recycle_decoded_frame(&self, frame: DecodedVideoFrame)

Recycles the CPU pixel buffer inside a DecodedVideoFrame when backed by VideoFrameBacking::CpuPooled.

§Arguments
  • &Self - Pool reference.
  • DecodedVideoFrame - Frame whose backing should be reclaimed if CPU-pooled.
Source

pub fn stats(&self) -> VideoFramePoolStats

Returns a point-in-time telemetry snapshot of pool capacity, reuse hits, and allocations.

§Arguments
  • &Self - Pool reference.
§Returns
  • VideoFramePoolStats - Pool usage and allocation telemetry.

Trait Implementations§

Source§

impl Clone for VideoFramePool

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VideoFramePool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the struct fields as a debug struct, skipping excluded fields.

§Arguments
  • &mut ::std::fmt::Formatter<'_> - The formatter to write the representation into.
§Returns
  • ::std::fmt::Result - Success or failure of the formatting operation.
Source§

impl Default for VideoFramePool

Default bounded CPU frame pool constructor.

Source§

fn default() -> Self

Creates a bounded VideoFramePool using VIDEO_DEFAULT_POOL_CAPACITY.

§Returns
  • Self - Initialized pool.

Auto Trait Implementations§

§

impl Forget for VideoFramePool

§

impl Freeze for VideoFramePool
where *const ArcInner<Mutex<VideoFramePoolState>> is !null: Freeze, PhantomData<ArcInner<Mutex<VideoFramePoolState>>>: Freeze,

§

impl Move for VideoFramePool

§

impl RefUnwindSafe for VideoFramePool
where Atomic<usize>: RefUnwindSafe, Mutex<VideoFramePoolState>: RefUnwindSafe,

§

impl Send for VideoFramePool
where Arc<Mutex<VideoFramePoolState>>: Send,

§

impl Sync for VideoFramePool
where Arc<Mutex<VideoFramePoolState>>: Sync,

§

impl Unpin for VideoFramePool
where Arc<Mutex<VideoFramePoolState>>: Unpin,

§

impl UnsafeUnpin for VideoFramePool
where *const ArcInner<Mutex<VideoFramePoolState>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<VideoFramePoolState>>>: UnsafeUnpin,

§

impl UnwindSafe for VideoFramePool
where Arc<Mutex<VideoFramePoolState>>: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.