UNPKG

@observertc/samples-decoder

Version:

ObserveRTC Library for Decoding Samples

25 lines (24 loc) 896 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DefaultClientMetaDataDecoder = void 0; const utils_1 = require("./utils"); const Logger_1 = require("./Logger"); class DefaultClientMetaDataDecoder { reset() { // no-op } decode(input) { if (!input.type) { Logger_1.logger.warn("Invalid client metadata sample: missing type"); return undefined; } return { type: input.type, payload: input.payload, peerConnectionId: input.peerConnectionId ? (0, utils_1.bytesArrayToString)(input.peerConnectionId) : undefined, trackId: input.trackId ? (0, utils_1.bytesArrayToString)(input.trackId) : undefined, ssrc: input.ssrc ? Number(input.ssrc) : undefined, }; } } exports.DefaultClientMetaDataDecoder = DefaultClientMetaDataDecoder;