Skip to main content

constrain_frames

Function constrain_frames 

Source
pub fn constrain_frames(
    requested_frames: usize,
    start_frame: u64,
    resource_len_frames: usize,
) -> Option<(usize, usize)>
Expand description

A helper to constrain the requested number of frames to the available frames in the sample resource.

Returns Some((available_frames, start_frame as usize)) if the range is all or partly contained in the resource, or None if the range is fully outside the resource (available_frames == 0).