MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / getHardwareDecoderCodec

Function getHardwareDecoderCodec

src/misc.ts:542–548  ·  view source on GitHub ↗
(codecId: AVCodecID)

Source from the content-addressed store, hash-verified

540
541const hardwareDecoderCodecCache = new Map<AVCodecID, Codec | null>();
542export const getHardwareDecoderCodec = (codecId: AVCodecID): Codec | null => {
543 if (!hardwareDecoderCodecCache.has(codecId)) {
544 const hw = getHardwareContext();
545 hardwareDecoderCodecCache.set(codecId, hw?.getDecoderCodec(codecId) ?? null);
546 }
547 return hardwareDecoderCodecCache.get(codecId)!;
548};
549
550export const clamp = (value: number, min: number, max: number) => {
551 return Math.max(min, Math.min(max, value));

Callers 1

createCodecContextMethod · 0.85

Calls 1

getHardwareContextFunction · 0.85

Tested by

no test coverage detected