MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / selectUsableGpuEncoder

Function selectUsableGpuEncoder

packages/engine/src/utils/gpuEncoder.ts:40–60  ·  view source on GitHub ↗
(
  candidates: readonly ConcreteGpuEncoder[],
  isUsable: (encoder: ConcreteGpuEncoder) => Promise<boolean>,
)

Source from the content-addressed store, hash-verified

38}
39
40export async function selectUsableGpuEncoder(
41 candidates: readonly ConcreteGpuEncoder[],
42 isUsable: (encoder: ConcreteGpuEncoder) => Promise<boolean>,
43): Promise<GpuEncoder> {
44 const results = await Promise.all(
45 candidates.map(async (encoder) => {
46 try {
47 return { encoder, usable: await isUsable(encoder) };
48 } catch {
49 return { encoder, usable: false };
50 }
51 }),
52 );
53
54 for (const result of results) {
55 if (result.usable) {
56 return result.encoder;
57 }
58 }
59 return null;
60}
61
62export async function detectGpuEncoder(): Promise<GpuEncoder> {
63 return new Promise((resolve) => {

Callers 2

gpuEncoder.test.tsFile · 0.85
detectGpuEncoderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected