Expand description
Deterministic timeline primitives.
Structs§
- Audio
Frame Grid - Frame start samples of an audio stream, every
periodsamples fromanchor, inferred from its first packet timestamps (audio_frame_grid). - Frame
Rate - A positive rational frame rate in reduced form, at most one frame per tick (120 000 fps).
- Media
Time - A signed position or duration in timeline ticks (120 000 per second).
- Time
Range - A half-open timeline interval
[start, end).
Enums§
- Frame
Rate Error - Invalid rational frame rate.
- Time
Range Error - Invalid time range.
Constants§
- MAX_
SERIALIZED_ TICKS - Largest magnitude of a serialized time: 2^53 - 1 ticks (about 2,378 years), the largest integer a JavaScript number holds exactly, so every host reads JSON times the same.
- PRESENTATION_
SLACK presentation_slackfor an unknown time base: 0.5 ms plus one tick (61 ticks), as for milliseconds. Also the cap for streams whose timestamps show no rounding.- ROUNDING_
SCAN_ BYTES - Byte cap on the leading packets read for
rounding_quantum. A native decoder holds the packets it read until it decodes them, so this keeps a 4K stream to about a second. - ROUNDING_
SCAN_ FRAMES - Most leading packets whose timestamps feed
rounding_quantum, also capped byROUNDING_SCAN_BYTES. - TICKS_
PER_ SECOND - Fixed alpha2 timeline ticks per second.
Functions§
- audio_
frame_ grid - The frame grid shown by an audio stream’s first packet timestamps (any order, in
num / densecond units) atsample_rate, orNone. - presentation_
slack - How much later than source time
ta decoded frame’s timestamp may be and still be the frame shown att, for anum / dentime base rounded toquantumunits (rounding_quantum, 0 for none). - rounding_
quantum - The unit a stream’s timestamps are rounded to, in time-base units, or 0 when none shows.