pub struct AllocationRequest { /* private fields */ }Expand description
What the SDK needs memory for: one frame it is about to receive.
Planar audio is laid out as a picture is, one channel to a line: its
width is the number of samples per channel, its
height the number of channels, and its
stride_bytes the distance between channels in bytes.
Implementations§
Source§impl AllocationRequest
impl AllocationRequest
Sourcepub fn capacity_limit(self) -> usize
pub fn capacity_limit(self) -> usize
The largest buffer, in bytes, a policy may return for this request:
AllocatorLimits::max_allocation_bytes, or what is left of
AllocatorLimits::max_bytes when that is less.
Sourcepub fn minimum_bytes(self) -> usize
pub fn minimum_bytes(self) -> usize
The smallest buffer, in bytes, that holds the frame at this request’s stride.
Sourcepub fn stride_bytes(self) -> usize
pub fn stride_bytes(self) -> usize
Bytes per video line or per audio channel. For a compressed frame, which has no stride, this is its size.
Sourcepub fn format(self) -> AllocationFormat
pub fn format(self) -> AllocationFormat
The kind of frame.
Sourcepub fn with_stride_bytes(self, stride: usize) -> Result<Self>
pub fn with_stride_bytes(self, stride: usize) -> Result<Self>
The same request with the chosen line or channel stride, for buffers that need padding or alignment. The minimum size changes to match.
A new choice replaces an earlier stride. It may be narrower when the frame layout allows it; the SDK’s original request uses the packed minimum.
§Errors
Error::InvalidInput when the stride is
not one the frame’s layout allows (video follows the
video stride rules; an audio
stride is a multiple of four bytes),
a compressed frame is given a stride other than its size, or the buffer would exceed
the capacity_limit.