mediasoup
Version:
Cutting Edge WebRTC Video Conferencing
186 lines (185 loc) • 8.53 kB
JavaScript
"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.DumpResponseT = exports.DumpResponse = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = require("flatbuffers");
const type_1 = require("../../fbs/data-producer/type");
const sctp_stream_parameters_1 = require("../../fbs/sctp-parameters/sctp-stream-parameters");
class DumpResponse {
bb = null;
bb_pos = 0;
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsDumpResponse(bb, obj) {
return (obj || new DumpResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsDumpResponse(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new DumpResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
dataProducerId(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
type() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readUint8(this.bb_pos + offset) : type_1.Type.SCTP;
}
sctpStreamParameters(obj) {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? (obj || new sctp_stream_parameters_1.SctpStreamParameters()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
label(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
protocol(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
bufferedAmountLowThreshold() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
}
paused() {
const offset = this.bb.__offset(this.bb_pos, 18);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
dataProducerPaused() {
const offset = this.bb.__offset(this.bb_pos, 20);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
subchannels(index) {
const offset = this.bb.__offset(this.bb_pos, 22);
return offset ? this.bb.readUint16(this.bb.__vector(this.bb_pos + offset) + index * 2) : 0;
}
subchannelsLength() {
const offset = this.bb.__offset(this.bb_pos, 22);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
subchannelsArray() {
const offset = this.bb.__offset(this.bb_pos, 22);
return offset ? new Uint16Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
}
static startDumpResponse(builder) {
builder.startObject(10);
}
static addId(builder, idOffset) {
builder.addFieldOffset(0, idOffset, 0);
}
static addDataProducerId(builder, dataProducerIdOffset) {
builder.addFieldOffset(1, dataProducerIdOffset, 0);
}
static addType(builder, type) {
builder.addFieldInt8(2, type, type_1.Type.SCTP);
}
static addSctpStreamParameters(builder, sctpStreamParametersOffset) {
builder.addFieldOffset(3, sctpStreamParametersOffset, 0);
}
static addLabel(builder, labelOffset) {
builder.addFieldOffset(4, labelOffset, 0);
}
static addProtocol(builder, protocolOffset) {
builder.addFieldOffset(5, protocolOffset, 0);
}
static addBufferedAmountLowThreshold(builder, bufferedAmountLowThreshold) {
builder.addFieldInt32(6, bufferedAmountLowThreshold, 0);
}
static addPaused(builder, paused) {
builder.addFieldInt8(7, +paused, +false);
}
static addDataProducerPaused(builder, dataProducerPaused) {
builder.addFieldInt8(8, +dataProducerPaused, +false);
}
static addSubchannels(builder, subchannelsOffset) {
builder.addFieldOffset(9, subchannelsOffset, 0);
}
static createSubchannelsVector(builder, data) {
builder.startVector(2, data.length, 2);
for (let i = data.length - 1; i >= 0; i--) {
builder.addInt16(data[i]);
}
return builder.endVector();
}
static startSubchannelsVector(builder, numElems) {
builder.startVector(2, numElems, 2);
}
static endDumpResponse(builder) {
const offset = builder.endObject();
builder.requiredField(offset, 4); // id
builder.requiredField(offset, 6); // data_producer_id
builder.requiredField(offset, 12); // label
builder.requiredField(offset, 14); // protocol
builder.requiredField(offset, 22); // subchannels
return offset;
}
unpack() {
return new DumpResponseT(this.id(), this.dataProducerId(), this.type(), (this.sctpStreamParameters() !== null ? this.sctpStreamParameters().unpack() : null), this.label(), this.protocol(), this.bufferedAmountLowThreshold(), this.paused(), this.dataProducerPaused(), this.bb.createScalarList(this.subchannels.bind(this), this.subchannelsLength()));
}
unpackTo(_o) {
_o.id = this.id();
_o.dataProducerId = this.dataProducerId();
_o.type = this.type();
_o.sctpStreamParameters = (this.sctpStreamParameters() !== null ? this.sctpStreamParameters().unpack() : null);
_o.label = this.label();
_o.protocol = this.protocol();
_o.bufferedAmountLowThreshold = this.bufferedAmountLowThreshold();
_o.paused = this.paused();
_o.dataProducerPaused = this.dataProducerPaused();
_o.subchannels = this.bb.createScalarList(this.subchannels.bind(this), this.subchannelsLength());
}
}
exports.DumpResponse = DumpResponse;
class DumpResponseT {
id;
dataProducerId;
type;
sctpStreamParameters;
label;
protocol;
bufferedAmountLowThreshold;
paused;
dataProducerPaused;
subchannels;
constructor(id = null, dataProducerId = null, type = type_1.Type.SCTP, sctpStreamParameters = null, label = null, protocol = null, bufferedAmountLowThreshold = 0, paused = false, dataProducerPaused = false, subchannels = []) {
this.id = id;
this.dataProducerId = dataProducerId;
this.type = type;
this.sctpStreamParameters = sctpStreamParameters;
this.label = label;
this.protocol = protocol;
this.bufferedAmountLowThreshold = bufferedAmountLowThreshold;
this.paused = paused;
this.dataProducerPaused = dataProducerPaused;
this.subchannels = subchannels;
}
pack(builder) {
const id = (this.id !== null ? builder.createString(this.id) : 0);
const dataProducerId = (this.dataProducerId !== null ? builder.createString(this.dataProducerId) : 0);
const sctpStreamParameters = (this.sctpStreamParameters !== null ? this.sctpStreamParameters.pack(builder) : 0);
const label = (this.label !== null ? builder.createString(this.label) : 0);
const protocol = (this.protocol !== null ? builder.createString(this.protocol) : 0);
const subchannels = DumpResponse.createSubchannelsVector(builder, this.subchannels);
DumpResponse.startDumpResponse(builder);
DumpResponse.addId(builder, id);
DumpResponse.addDataProducerId(builder, dataProducerId);
DumpResponse.addType(builder, this.type);
DumpResponse.addSctpStreamParameters(builder, sctpStreamParameters);
DumpResponse.addLabel(builder, label);
DumpResponse.addProtocol(builder, protocol);
DumpResponse.addBufferedAmountLowThreshold(builder, this.bufferedAmountLowThreshold);
DumpResponse.addPaused(builder, this.paused);
DumpResponse.addDataProducerPaused(builder, this.dataProducerPaused);
DumpResponse.addSubchannels(builder, subchannels);
return DumpResponse.endDumpResponse(builder);
}
}
exports.DumpResponseT = DumpResponseT;