pub struct AudioFrameGrid {
pub anchor: i64,
pub period: i64,
pub start_tolerance: i64,
pub trimmed_tolerance: i64,
}Expand description
Frame start samples of an audio stream, every period samples from anchor, inferred from
its first packet timestamps (audio_frame_grid).
Containers that round timestamps (Matroska and WebM to the millisecond) place a frame up to
half a unit (24 samples at 48 kHz) off its true start, and a seek and a straight decode are off
by different amounts. For fixed-length frames (AAC’s 1024 samples, Opus’s 20 ms) the first
timestamps together locate the grid far more precisely, so snapping to it makes a seek give
the same samples as a straight decode.
Fields§
§anchor: i64A source sample at which a frame starts.
period: i64Samples per frame.
start_tolerance: i64Farthest a frame timestamp, in samples, can be from its true start: half the rounding unit plus half a sample, rounded.
trimmed_tolerance: i64Farthest the end of a trimmed frame (shorter than period, as after Opus pre-skip) can
be from the grid. The trim is rounded again, so this is a full unit plus a sample.