Selkies

lib/fit-frame

A decoded picture cut to the size its stream was configured for.

A hardware encoder may code a larger picture than the stream's (VA-API on AMD before VCN 5 pads AV1: 1920x1080 to 1920x1082, 1366x768 to 1408x768) and name the stream's size in the AV1 render size, which Chromium's decoders do not apply, so the canvas would take the padded size and show the desktop squeezed or stretched at its edges.

Functions

createFrameFit()

function createFrameFit(drawsCrop?): (arg0, arg1, arg2) => VideoFrame;

Defined in: lib/fit-frame.js:36

Makes the cut. A frame whose visible picture is larger than the stream's size is cut to that size at the same origin and displayed at it, whatever display size the decoder gave it; any other frame passes through. A visibleRect crop copies no pixels, but WebKit draws a frame whole whatever its visible rectangle or the source rectangle of the draw, so where a first crop does not draw cut (probed once, on the first frame that needs one) the frame is drawn at its full size onto a canvas of the stream's size instead, which leaves the padding outside. A frame the engine cannot cut passes through.

Self-contained by design: the video worker embeds it by toString().

Parameters

ParameterTypeDescription
drawsCrop?booleanWhether drawing honors a visibleRect crop; probed when not given.

Returns

Takes a frame and the stream's width and height; closes the frame when another replaces it.

(arg0, arg1, arg2) => VideoFrame