media-encoder-host-worker
Version:
The worker which is used by the media-encoder-host package.
14 lines (10 loc) • 470 B
text/typescript
import type { TEncoderInstancesRegistryEntry } from '../types';
export const createGetEncoderInstance = (encoderInstancesRegistry: Map<number, TEncoderInstancesRegistryEntry>) => {
return (encoderInstanceId: number) => {
const entry = encoderInstancesRegistry.get(encoderInstanceId);
if (entry === undefined) {
throw new Error('There was no instance of an encoder stored with the given id.');
}
return entry;
};
};