Address a bunch of TODOs and add parameter validation everywhere

This commit is contained in:
Vanilagy
2024-11-24 21:17:00 +01:00
parent 29749451bb
commit b51b2b1b45
14 changed files with 1846 additions and 1059 deletions
+5
View File
@@ -73,4 +73,9 @@ export const MATRIX_COEFFICIENTS_MAP: Record<VideoMatrixCoefficients, number> =
export const colorSpaceIsComplete = (colorSpace: VideoColorSpaceInit | undefined) => {
return !!colorSpace && !!colorSpace.primaries && !!colorSpace.transfer && !!colorSpace.matrix && colorSpace.fullRange !== undefined;
};
export const isAllowSharedBufferSource = (x: unknown) => {
// Quite a mouthful:
return x instanceof ArrayBuffer || (typeof SharedArrayBuffer !== 'undefined' && x instanceof SharedArrayBuffer) || (ArrayBuffer.isView(x) && !(x instanceof DataView));
};