Selkies

lib/chunk-stamp

The timestamps a decoder's chunks carry.

WebCodecs keeps a chunk's timestamp in whole microseconds and hands it back on the frame decoded from it, which is how a frame is matched to its chunk (the decode time and arrival the stats report). The page clock in microseconds is fractional wherever performance.now() is not a whole number of them, and WebKit's worker clock reads whole milliseconds, so a burst of chunks arriving within one would share a timestamp, which WebKit answers with frames timed otherwise (repeated values, stepping by a frame's duration in nanoseconds). Each stamp is the clock's whole microseconds, past the last one given.

Functions

createChunkStamp()

function createChunkStamp(clock?): () => number;

Defined in: lib/chunk-stamp.js:30

Self-contained by design: the video worker embeds this factory by toString(), so a reference to anything in module scope would arrive there minified and unbound.

Parameters

ParameterTypeDescription
clock?() => numberMillisecond clock; defaults to performance.now.

Returns

Gives the next chunk's timestamp.

() => number