@stinkycomputing/sesame-api-client 1.4.1-alpha.9 → 1.4.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -137
- package/dist/index.browser.mjs +706 -274
- package/dist/index.browser.mjs.map +4 -4
- package/dist/index.cjs +710 -276
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +706 -274
- package/dist/index.mjs.map +4 -4
- package/dist/proto/api.d.ts +305 -0
- package/dist/proto/api.js +922 -0
- package/dist/rpc-client.d.ts.map +1 -1
- package/dist/sesame-api-client.d.ts +5 -6
- package/dist/sesame-api-client.d.ts.map +1 -1
- package/dist/sesame-connection.d.ts +11 -2
- package/dist/sesame-connection.d.ts.map +1 -1
- package/dist/sesame-wire-protocol.d.ts +29 -0
- package/dist/sesame-wire-protocol.d.ts.map +1 -0
- package/dist/status-api.d.ts +0 -1
- package/dist/status-api.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -21054,6 +21054,602 @@ var sesame = $root.sesame = (() => {
|
|
|
21054
21054
|
}();
|
|
21055
21055
|
return rpc;
|
|
21056
21056
|
}();
|
|
21057
|
+
v1.wire = function() {
|
|
21058
|
+
const wire = {};
|
|
21059
|
+
wire.FrameType = function() {
|
|
21060
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
21061
|
+
values[valuesById[0] = "FRAME_TYPE_UNSPECIFIED"] = 0;
|
|
21062
|
+
values[valuesById[1] = "FRAME_TYPE_RPC"] = 1;
|
|
21063
|
+
values[valuesById[2] = "FRAME_TYPE_VIDEO"] = 2;
|
|
21064
|
+
values[valuesById[3] = "FRAME_TYPE_AUDIO"] = 3;
|
|
21065
|
+
values[valuesById[4] = "FRAME_TYPE_MUXED"] = 4;
|
|
21066
|
+
values[valuesById[5] = "FRAME_TYPE_DECODER_DATA"] = 5;
|
|
21067
|
+
return values;
|
|
21068
|
+
}();
|
|
21069
|
+
wire.CodecType = function() {
|
|
21070
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
21071
|
+
values[valuesById[0] = "CODEC_TYPE_UNSPECIFIED"] = 0;
|
|
21072
|
+
values[valuesById[1] = "CODEC_TYPE_VIDEO_VP8"] = 1;
|
|
21073
|
+
values[valuesById[2] = "CODEC_TYPE_VIDEO_VP9"] = 2;
|
|
21074
|
+
values[valuesById[3] = "CODEC_TYPE_VIDEO_AVC"] = 3;
|
|
21075
|
+
values[valuesById[4] = "CODEC_TYPE_VIDEO_HEVC"] = 4;
|
|
21076
|
+
values[valuesById[5] = "CODEC_TYPE_VIDEO_AV1"] = 5;
|
|
21077
|
+
values[valuesById[64] = "CODEC_TYPE_AUDIO_OPUS"] = 64;
|
|
21078
|
+
values[valuesById[65] = "CODEC_TYPE_AUDIO_AAC"] = 65;
|
|
21079
|
+
values[valuesById[66] = "CODEC_TYPE_AUDIO_PCM"] = 66;
|
|
21080
|
+
return values;
|
|
21081
|
+
}();
|
|
21082
|
+
wire.MediaCodecData = function() {
|
|
21083
|
+
function MediaCodecData2(properties) {
|
|
21084
|
+
if (properties) {
|
|
21085
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
21086
|
+
if (properties[keys[i]] != null)
|
|
21087
|
+
this[keys[i]] = properties[keys[i]];
|
|
21088
|
+
}
|
|
21089
|
+
}
|
|
21090
|
+
MediaCodecData2.prototype.codecType = 0;
|
|
21091
|
+
MediaCodecData2.prototype.sampleRate = 0;
|
|
21092
|
+
MediaCodecData2.prototype.timebaseNum = 0;
|
|
21093
|
+
MediaCodecData2.prototype.timebaseDen = 0;
|
|
21094
|
+
MediaCodecData2.prototype.codecProfile = 0;
|
|
21095
|
+
MediaCodecData2.prototype.codecLevel = 0;
|
|
21096
|
+
MediaCodecData2.prototype.width = 0;
|
|
21097
|
+
MediaCodecData2.prototype.height = 0;
|
|
21098
|
+
MediaCodecData2.prototype.channels = 0;
|
|
21099
|
+
MediaCodecData2.prototype.bitDepth = 0;
|
|
21100
|
+
MediaCodecData2.create = function create(properties) {
|
|
21101
|
+
return new MediaCodecData2(properties);
|
|
21102
|
+
};
|
|
21103
|
+
MediaCodecData2.encode = function encode(message, writer) {
|
|
21104
|
+
if (!writer)
|
|
21105
|
+
writer = $Writer.create();
|
|
21106
|
+
if (message.codecType != null && Object.hasOwnProperty.call(message, "codecType"))
|
|
21107
|
+
writer.uint32(
|
|
21108
|
+
/* id 1, wireType 0 =*/
|
|
21109
|
+
8
|
|
21110
|
+
).int32(message.codecType);
|
|
21111
|
+
if (message.sampleRate != null && Object.hasOwnProperty.call(message, "sampleRate"))
|
|
21112
|
+
writer.uint32(
|
|
21113
|
+
/* id 2, wireType 0 =*/
|
|
21114
|
+
16
|
|
21115
|
+
).uint32(message.sampleRate);
|
|
21116
|
+
if (message.timebaseNum != null && Object.hasOwnProperty.call(message, "timebaseNum"))
|
|
21117
|
+
writer.uint32(
|
|
21118
|
+
/* id 3, wireType 0 =*/
|
|
21119
|
+
24
|
|
21120
|
+
).uint32(message.timebaseNum);
|
|
21121
|
+
if (message.timebaseDen != null && Object.hasOwnProperty.call(message, "timebaseDen"))
|
|
21122
|
+
writer.uint32(
|
|
21123
|
+
/* id 4, wireType 0 =*/
|
|
21124
|
+
32
|
|
21125
|
+
).uint32(message.timebaseDen);
|
|
21126
|
+
if (message.codecProfile != null && Object.hasOwnProperty.call(message, "codecProfile"))
|
|
21127
|
+
writer.uint32(
|
|
21128
|
+
/* id 5, wireType 0 =*/
|
|
21129
|
+
40
|
|
21130
|
+
).uint32(message.codecProfile);
|
|
21131
|
+
if (message.codecLevel != null && Object.hasOwnProperty.call(message, "codecLevel"))
|
|
21132
|
+
writer.uint32(
|
|
21133
|
+
/* id 6, wireType 0 =*/
|
|
21134
|
+
48
|
|
21135
|
+
).uint32(message.codecLevel);
|
|
21136
|
+
if (message.width != null && Object.hasOwnProperty.call(message, "width"))
|
|
21137
|
+
writer.uint32(
|
|
21138
|
+
/* id 7, wireType 0 =*/
|
|
21139
|
+
56
|
|
21140
|
+
).uint32(message.width);
|
|
21141
|
+
if (message.height != null && Object.hasOwnProperty.call(message, "height"))
|
|
21142
|
+
writer.uint32(
|
|
21143
|
+
/* id 8, wireType 0 =*/
|
|
21144
|
+
64
|
|
21145
|
+
).uint32(message.height);
|
|
21146
|
+
if (message.channels != null && Object.hasOwnProperty.call(message, "channels"))
|
|
21147
|
+
writer.uint32(
|
|
21148
|
+
/* id 9, wireType 0 =*/
|
|
21149
|
+
72
|
|
21150
|
+
).uint32(message.channels);
|
|
21151
|
+
if (message.bitDepth != null && Object.hasOwnProperty.call(message, "bitDepth"))
|
|
21152
|
+
writer.uint32(
|
|
21153
|
+
/* id 10, wireType 0 =*/
|
|
21154
|
+
80
|
|
21155
|
+
).uint32(message.bitDepth);
|
|
21156
|
+
return writer;
|
|
21157
|
+
};
|
|
21158
|
+
MediaCodecData2.encodeDelimited = function encodeDelimited(message, writer) {
|
|
21159
|
+
return this.encode(message, writer).ldelim();
|
|
21160
|
+
};
|
|
21161
|
+
MediaCodecData2.decode = function decode(reader, length, error) {
|
|
21162
|
+
if (!(reader instanceof $Reader))
|
|
21163
|
+
reader = $Reader.create(reader);
|
|
21164
|
+
let end = length === void 0 ? reader.len : reader.pos + length, message = new $root.sesame.v1.wire.MediaCodecData();
|
|
21165
|
+
while (reader.pos < end) {
|
|
21166
|
+
let tag = reader.uint32();
|
|
21167
|
+
if (tag === error)
|
|
21168
|
+
break;
|
|
21169
|
+
switch (tag >>> 3) {
|
|
21170
|
+
case 1: {
|
|
21171
|
+
message.codecType = reader.int32();
|
|
21172
|
+
break;
|
|
21173
|
+
}
|
|
21174
|
+
case 2: {
|
|
21175
|
+
message.sampleRate = reader.uint32();
|
|
21176
|
+
break;
|
|
21177
|
+
}
|
|
21178
|
+
case 3: {
|
|
21179
|
+
message.timebaseNum = reader.uint32();
|
|
21180
|
+
break;
|
|
21181
|
+
}
|
|
21182
|
+
case 4: {
|
|
21183
|
+
message.timebaseDen = reader.uint32();
|
|
21184
|
+
break;
|
|
21185
|
+
}
|
|
21186
|
+
case 5: {
|
|
21187
|
+
message.codecProfile = reader.uint32();
|
|
21188
|
+
break;
|
|
21189
|
+
}
|
|
21190
|
+
case 6: {
|
|
21191
|
+
message.codecLevel = reader.uint32();
|
|
21192
|
+
break;
|
|
21193
|
+
}
|
|
21194
|
+
case 7: {
|
|
21195
|
+
message.width = reader.uint32();
|
|
21196
|
+
break;
|
|
21197
|
+
}
|
|
21198
|
+
case 8: {
|
|
21199
|
+
message.height = reader.uint32();
|
|
21200
|
+
break;
|
|
21201
|
+
}
|
|
21202
|
+
case 9: {
|
|
21203
|
+
message.channels = reader.uint32();
|
|
21204
|
+
break;
|
|
21205
|
+
}
|
|
21206
|
+
case 10: {
|
|
21207
|
+
message.bitDepth = reader.uint32();
|
|
21208
|
+
break;
|
|
21209
|
+
}
|
|
21210
|
+
default:
|
|
21211
|
+
reader.skipType(tag & 7);
|
|
21212
|
+
break;
|
|
21213
|
+
}
|
|
21214
|
+
}
|
|
21215
|
+
return message;
|
|
21216
|
+
};
|
|
21217
|
+
MediaCodecData2.decodeDelimited = function decodeDelimited(reader) {
|
|
21218
|
+
if (!(reader instanceof $Reader))
|
|
21219
|
+
reader = new $Reader(reader);
|
|
21220
|
+
return this.decode(reader, reader.uint32());
|
|
21221
|
+
};
|
|
21222
|
+
MediaCodecData2.verify = function verify(message) {
|
|
21223
|
+
if (typeof message !== "object" || message === null)
|
|
21224
|
+
return "object expected";
|
|
21225
|
+
if (message.codecType != null && message.hasOwnProperty("codecType"))
|
|
21226
|
+
switch (message.codecType) {
|
|
21227
|
+
default:
|
|
21228
|
+
return "codecType: enum value expected";
|
|
21229
|
+
case 0:
|
|
21230
|
+
case 1:
|
|
21231
|
+
case 2:
|
|
21232
|
+
case 3:
|
|
21233
|
+
case 4:
|
|
21234
|
+
case 5:
|
|
21235
|
+
case 64:
|
|
21236
|
+
case 65:
|
|
21237
|
+
case 66:
|
|
21238
|
+
break;
|
|
21239
|
+
}
|
|
21240
|
+
if (message.sampleRate != null && message.hasOwnProperty("sampleRate")) {
|
|
21241
|
+
if (!$util.isInteger(message.sampleRate))
|
|
21242
|
+
return "sampleRate: integer expected";
|
|
21243
|
+
}
|
|
21244
|
+
if (message.timebaseNum != null && message.hasOwnProperty("timebaseNum")) {
|
|
21245
|
+
if (!$util.isInteger(message.timebaseNum))
|
|
21246
|
+
return "timebaseNum: integer expected";
|
|
21247
|
+
}
|
|
21248
|
+
if (message.timebaseDen != null && message.hasOwnProperty("timebaseDen")) {
|
|
21249
|
+
if (!$util.isInteger(message.timebaseDen))
|
|
21250
|
+
return "timebaseDen: integer expected";
|
|
21251
|
+
}
|
|
21252
|
+
if (message.codecProfile != null && message.hasOwnProperty("codecProfile")) {
|
|
21253
|
+
if (!$util.isInteger(message.codecProfile))
|
|
21254
|
+
return "codecProfile: integer expected";
|
|
21255
|
+
}
|
|
21256
|
+
if (message.codecLevel != null && message.hasOwnProperty("codecLevel")) {
|
|
21257
|
+
if (!$util.isInteger(message.codecLevel))
|
|
21258
|
+
return "codecLevel: integer expected";
|
|
21259
|
+
}
|
|
21260
|
+
if (message.width != null && message.hasOwnProperty("width")) {
|
|
21261
|
+
if (!$util.isInteger(message.width))
|
|
21262
|
+
return "width: integer expected";
|
|
21263
|
+
}
|
|
21264
|
+
if (message.height != null && message.hasOwnProperty("height")) {
|
|
21265
|
+
if (!$util.isInteger(message.height))
|
|
21266
|
+
return "height: integer expected";
|
|
21267
|
+
}
|
|
21268
|
+
if (message.channels != null && message.hasOwnProperty("channels")) {
|
|
21269
|
+
if (!$util.isInteger(message.channels))
|
|
21270
|
+
return "channels: integer expected";
|
|
21271
|
+
}
|
|
21272
|
+
if (message.bitDepth != null && message.hasOwnProperty("bitDepth")) {
|
|
21273
|
+
if (!$util.isInteger(message.bitDepth))
|
|
21274
|
+
return "bitDepth: integer expected";
|
|
21275
|
+
}
|
|
21276
|
+
return null;
|
|
21277
|
+
};
|
|
21278
|
+
MediaCodecData2.fromObject = function fromObject(object) {
|
|
21279
|
+
if (object instanceof $root.sesame.v1.wire.MediaCodecData)
|
|
21280
|
+
return object;
|
|
21281
|
+
let message = new $root.sesame.v1.wire.MediaCodecData();
|
|
21282
|
+
switch (object.codecType) {
|
|
21283
|
+
default:
|
|
21284
|
+
if (typeof object.codecType === "number") {
|
|
21285
|
+
message.codecType = object.codecType;
|
|
21286
|
+
break;
|
|
21287
|
+
}
|
|
21288
|
+
break;
|
|
21289
|
+
case "CODEC_TYPE_UNSPECIFIED":
|
|
21290
|
+
case 0:
|
|
21291
|
+
message.codecType = 0;
|
|
21292
|
+
break;
|
|
21293
|
+
case "CODEC_TYPE_VIDEO_VP8":
|
|
21294
|
+
case 1:
|
|
21295
|
+
message.codecType = 1;
|
|
21296
|
+
break;
|
|
21297
|
+
case "CODEC_TYPE_VIDEO_VP9":
|
|
21298
|
+
case 2:
|
|
21299
|
+
message.codecType = 2;
|
|
21300
|
+
break;
|
|
21301
|
+
case "CODEC_TYPE_VIDEO_AVC":
|
|
21302
|
+
case 3:
|
|
21303
|
+
message.codecType = 3;
|
|
21304
|
+
break;
|
|
21305
|
+
case "CODEC_TYPE_VIDEO_HEVC":
|
|
21306
|
+
case 4:
|
|
21307
|
+
message.codecType = 4;
|
|
21308
|
+
break;
|
|
21309
|
+
case "CODEC_TYPE_VIDEO_AV1":
|
|
21310
|
+
case 5:
|
|
21311
|
+
message.codecType = 5;
|
|
21312
|
+
break;
|
|
21313
|
+
case "CODEC_TYPE_AUDIO_OPUS":
|
|
21314
|
+
case 64:
|
|
21315
|
+
message.codecType = 64;
|
|
21316
|
+
break;
|
|
21317
|
+
case "CODEC_TYPE_AUDIO_AAC":
|
|
21318
|
+
case 65:
|
|
21319
|
+
message.codecType = 65;
|
|
21320
|
+
break;
|
|
21321
|
+
case "CODEC_TYPE_AUDIO_PCM":
|
|
21322
|
+
case 66:
|
|
21323
|
+
message.codecType = 66;
|
|
21324
|
+
break;
|
|
21325
|
+
}
|
|
21326
|
+
if (object.sampleRate != null)
|
|
21327
|
+
message.sampleRate = object.sampleRate >>> 0;
|
|
21328
|
+
if (object.timebaseNum != null)
|
|
21329
|
+
message.timebaseNum = object.timebaseNum >>> 0;
|
|
21330
|
+
if (object.timebaseDen != null)
|
|
21331
|
+
message.timebaseDen = object.timebaseDen >>> 0;
|
|
21332
|
+
if (object.codecProfile != null)
|
|
21333
|
+
message.codecProfile = object.codecProfile >>> 0;
|
|
21334
|
+
if (object.codecLevel != null)
|
|
21335
|
+
message.codecLevel = object.codecLevel >>> 0;
|
|
21336
|
+
if (object.width != null)
|
|
21337
|
+
message.width = object.width >>> 0;
|
|
21338
|
+
if (object.height != null)
|
|
21339
|
+
message.height = object.height >>> 0;
|
|
21340
|
+
if (object.channels != null)
|
|
21341
|
+
message.channels = object.channels >>> 0;
|
|
21342
|
+
if (object.bitDepth != null)
|
|
21343
|
+
message.bitDepth = object.bitDepth >>> 0;
|
|
21344
|
+
return message;
|
|
21345
|
+
};
|
|
21346
|
+
MediaCodecData2.toObject = function toObject(message, options) {
|
|
21347
|
+
if (!options)
|
|
21348
|
+
options = {};
|
|
21349
|
+
let object = {};
|
|
21350
|
+
if (options.defaults) {
|
|
21351
|
+
object.codecType = options.enums === String ? "CODEC_TYPE_UNSPECIFIED" : 0;
|
|
21352
|
+
object.sampleRate = 0;
|
|
21353
|
+
object.timebaseNum = 0;
|
|
21354
|
+
object.timebaseDen = 0;
|
|
21355
|
+
object.codecProfile = 0;
|
|
21356
|
+
object.codecLevel = 0;
|
|
21357
|
+
object.width = 0;
|
|
21358
|
+
object.height = 0;
|
|
21359
|
+
object.channels = 0;
|
|
21360
|
+
object.bitDepth = 0;
|
|
21361
|
+
}
|
|
21362
|
+
if (message.codecType != null && message.hasOwnProperty("codecType"))
|
|
21363
|
+
object.codecType = options.enums === String ? $root.sesame.v1.wire.CodecType[message.codecType] === void 0 ? message.codecType : $root.sesame.v1.wire.CodecType[message.codecType] : message.codecType;
|
|
21364
|
+
if (message.sampleRate != null && message.hasOwnProperty("sampleRate"))
|
|
21365
|
+
object.sampleRate = message.sampleRate;
|
|
21366
|
+
if (message.timebaseNum != null && message.hasOwnProperty("timebaseNum"))
|
|
21367
|
+
object.timebaseNum = message.timebaseNum;
|
|
21368
|
+
if (message.timebaseDen != null && message.hasOwnProperty("timebaseDen"))
|
|
21369
|
+
object.timebaseDen = message.timebaseDen;
|
|
21370
|
+
if (message.codecProfile != null && message.hasOwnProperty("codecProfile"))
|
|
21371
|
+
object.codecProfile = message.codecProfile;
|
|
21372
|
+
if (message.codecLevel != null && message.hasOwnProperty("codecLevel"))
|
|
21373
|
+
object.codecLevel = message.codecLevel;
|
|
21374
|
+
if (message.width != null && message.hasOwnProperty("width"))
|
|
21375
|
+
object.width = message.width;
|
|
21376
|
+
if (message.height != null && message.hasOwnProperty("height"))
|
|
21377
|
+
object.height = message.height;
|
|
21378
|
+
if (message.channels != null && message.hasOwnProperty("channels"))
|
|
21379
|
+
object.channels = message.channels;
|
|
21380
|
+
if (message.bitDepth != null && message.hasOwnProperty("bitDepth"))
|
|
21381
|
+
object.bitDepth = message.bitDepth;
|
|
21382
|
+
return object;
|
|
21383
|
+
};
|
|
21384
|
+
MediaCodecData2.prototype.toJSON = function toJSON() {
|
|
21385
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
21386
|
+
};
|
|
21387
|
+
MediaCodecData2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
21388
|
+
if (typeUrlPrefix === void 0) {
|
|
21389
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
21390
|
+
}
|
|
21391
|
+
return typeUrlPrefix + "/sesame.v1.wire.MediaCodecData";
|
|
21392
|
+
};
|
|
21393
|
+
return MediaCodecData2;
|
|
21394
|
+
}();
|
|
21395
|
+
wire.FrameHeader = function() {
|
|
21396
|
+
function FrameHeader2(properties) {
|
|
21397
|
+
if (properties) {
|
|
21398
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
21399
|
+
if (properties[keys[i]] != null)
|
|
21400
|
+
this[keys[i]] = properties[keys[i]];
|
|
21401
|
+
}
|
|
21402
|
+
}
|
|
21403
|
+
FrameHeader2.prototype.type = 0;
|
|
21404
|
+
FrameHeader2.prototype.pts = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
|
21405
|
+
FrameHeader2.prototype.id = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
|
21406
|
+
FrameHeader2.prototype.keyframe = false;
|
|
21407
|
+
FrameHeader2.prototype.codecData = null;
|
|
21408
|
+
FrameHeader2.prototype.routingMetadata = "";
|
|
21409
|
+
FrameHeader2.create = function create(properties) {
|
|
21410
|
+
return new FrameHeader2(properties);
|
|
21411
|
+
};
|
|
21412
|
+
FrameHeader2.encode = function encode(message, writer) {
|
|
21413
|
+
if (!writer)
|
|
21414
|
+
writer = $Writer.create();
|
|
21415
|
+
if (message.type != null && Object.hasOwnProperty.call(message, "type"))
|
|
21416
|
+
writer.uint32(
|
|
21417
|
+
/* id 1, wireType 0 =*/
|
|
21418
|
+
8
|
|
21419
|
+
).int32(message.type);
|
|
21420
|
+
if (message.pts != null && Object.hasOwnProperty.call(message, "pts"))
|
|
21421
|
+
writer.uint32(
|
|
21422
|
+
/* id 2, wireType 0 =*/
|
|
21423
|
+
16
|
|
21424
|
+
).uint64(message.pts);
|
|
21425
|
+
if (message.id != null && Object.hasOwnProperty.call(message, "id"))
|
|
21426
|
+
writer.uint32(
|
|
21427
|
+
/* id 3, wireType 0 =*/
|
|
21428
|
+
24
|
|
21429
|
+
).uint64(message.id);
|
|
21430
|
+
if (message.keyframe != null && Object.hasOwnProperty.call(message, "keyframe"))
|
|
21431
|
+
writer.uint32(
|
|
21432
|
+
/* id 4, wireType 0 =*/
|
|
21433
|
+
32
|
|
21434
|
+
).bool(message.keyframe);
|
|
21435
|
+
if (message.codecData != null && Object.hasOwnProperty.call(message, "codecData"))
|
|
21436
|
+
$root.sesame.v1.wire.MediaCodecData.encode(message.codecData, writer.uint32(
|
|
21437
|
+
/* id 5, wireType 2 =*/
|
|
21438
|
+
42
|
|
21439
|
+
).fork()).ldelim();
|
|
21440
|
+
if (message.routingMetadata != null && Object.hasOwnProperty.call(message, "routingMetadata"))
|
|
21441
|
+
writer.uint32(
|
|
21442
|
+
/* id 6, wireType 2 =*/
|
|
21443
|
+
50
|
|
21444
|
+
).string(message.routingMetadata);
|
|
21445
|
+
return writer;
|
|
21446
|
+
};
|
|
21447
|
+
FrameHeader2.encodeDelimited = function encodeDelimited(message, writer) {
|
|
21448
|
+
return this.encode(message, writer).ldelim();
|
|
21449
|
+
};
|
|
21450
|
+
FrameHeader2.decode = function decode(reader, length, error) {
|
|
21451
|
+
if (!(reader instanceof $Reader))
|
|
21452
|
+
reader = $Reader.create(reader);
|
|
21453
|
+
let end = length === void 0 ? reader.len : reader.pos + length, message = new $root.sesame.v1.wire.FrameHeader();
|
|
21454
|
+
while (reader.pos < end) {
|
|
21455
|
+
let tag = reader.uint32();
|
|
21456
|
+
if (tag === error)
|
|
21457
|
+
break;
|
|
21458
|
+
switch (tag >>> 3) {
|
|
21459
|
+
case 1: {
|
|
21460
|
+
message.type = reader.int32();
|
|
21461
|
+
break;
|
|
21462
|
+
}
|
|
21463
|
+
case 2: {
|
|
21464
|
+
message.pts = reader.uint64();
|
|
21465
|
+
break;
|
|
21466
|
+
}
|
|
21467
|
+
case 3: {
|
|
21468
|
+
message.id = reader.uint64();
|
|
21469
|
+
break;
|
|
21470
|
+
}
|
|
21471
|
+
case 4: {
|
|
21472
|
+
message.keyframe = reader.bool();
|
|
21473
|
+
break;
|
|
21474
|
+
}
|
|
21475
|
+
case 5: {
|
|
21476
|
+
message.codecData = $root.sesame.v1.wire.MediaCodecData.decode(reader, reader.uint32());
|
|
21477
|
+
break;
|
|
21478
|
+
}
|
|
21479
|
+
case 6: {
|
|
21480
|
+
message.routingMetadata = reader.string();
|
|
21481
|
+
break;
|
|
21482
|
+
}
|
|
21483
|
+
default:
|
|
21484
|
+
reader.skipType(tag & 7);
|
|
21485
|
+
break;
|
|
21486
|
+
}
|
|
21487
|
+
}
|
|
21488
|
+
return message;
|
|
21489
|
+
};
|
|
21490
|
+
FrameHeader2.decodeDelimited = function decodeDelimited(reader) {
|
|
21491
|
+
if (!(reader instanceof $Reader))
|
|
21492
|
+
reader = new $Reader(reader);
|
|
21493
|
+
return this.decode(reader, reader.uint32());
|
|
21494
|
+
};
|
|
21495
|
+
FrameHeader2.verify = function verify(message) {
|
|
21496
|
+
if (typeof message !== "object" || message === null)
|
|
21497
|
+
return "object expected";
|
|
21498
|
+
if (message.type != null && message.hasOwnProperty("type"))
|
|
21499
|
+
switch (message.type) {
|
|
21500
|
+
default:
|
|
21501
|
+
return "type: enum value expected";
|
|
21502
|
+
case 0:
|
|
21503
|
+
case 1:
|
|
21504
|
+
case 2:
|
|
21505
|
+
case 3:
|
|
21506
|
+
case 4:
|
|
21507
|
+
case 5:
|
|
21508
|
+
break;
|
|
21509
|
+
}
|
|
21510
|
+
if (message.pts != null && message.hasOwnProperty("pts")) {
|
|
21511
|
+
if (!$util.isInteger(message.pts) && !(message.pts && $util.isInteger(message.pts.low) && $util.isInteger(message.pts.high)))
|
|
21512
|
+
return "pts: integer|Long expected";
|
|
21513
|
+
}
|
|
21514
|
+
if (message.id != null && message.hasOwnProperty("id")) {
|
|
21515
|
+
if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)))
|
|
21516
|
+
return "id: integer|Long expected";
|
|
21517
|
+
}
|
|
21518
|
+
if (message.keyframe != null && message.hasOwnProperty("keyframe")) {
|
|
21519
|
+
if (typeof message.keyframe !== "boolean")
|
|
21520
|
+
return "keyframe: boolean expected";
|
|
21521
|
+
}
|
|
21522
|
+
if (message.codecData != null && message.hasOwnProperty("codecData")) {
|
|
21523
|
+
let error = $root.sesame.v1.wire.MediaCodecData.verify(message.codecData);
|
|
21524
|
+
if (error)
|
|
21525
|
+
return "codecData." + error;
|
|
21526
|
+
}
|
|
21527
|
+
if (message.routingMetadata != null && message.hasOwnProperty("routingMetadata")) {
|
|
21528
|
+
if (!$util.isString(message.routingMetadata))
|
|
21529
|
+
return "routingMetadata: string expected";
|
|
21530
|
+
}
|
|
21531
|
+
return null;
|
|
21532
|
+
};
|
|
21533
|
+
FrameHeader2.fromObject = function fromObject(object) {
|
|
21534
|
+
if (object instanceof $root.sesame.v1.wire.FrameHeader)
|
|
21535
|
+
return object;
|
|
21536
|
+
let message = new $root.sesame.v1.wire.FrameHeader();
|
|
21537
|
+
switch (object.type) {
|
|
21538
|
+
default:
|
|
21539
|
+
if (typeof object.type === "number") {
|
|
21540
|
+
message.type = object.type;
|
|
21541
|
+
break;
|
|
21542
|
+
}
|
|
21543
|
+
break;
|
|
21544
|
+
case "FRAME_TYPE_UNSPECIFIED":
|
|
21545
|
+
case 0:
|
|
21546
|
+
message.type = 0;
|
|
21547
|
+
break;
|
|
21548
|
+
case "FRAME_TYPE_RPC":
|
|
21549
|
+
case 1:
|
|
21550
|
+
message.type = 1;
|
|
21551
|
+
break;
|
|
21552
|
+
case "FRAME_TYPE_VIDEO":
|
|
21553
|
+
case 2:
|
|
21554
|
+
message.type = 2;
|
|
21555
|
+
break;
|
|
21556
|
+
case "FRAME_TYPE_AUDIO":
|
|
21557
|
+
case 3:
|
|
21558
|
+
message.type = 3;
|
|
21559
|
+
break;
|
|
21560
|
+
case "FRAME_TYPE_MUXED":
|
|
21561
|
+
case 4:
|
|
21562
|
+
message.type = 4;
|
|
21563
|
+
break;
|
|
21564
|
+
case "FRAME_TYPE_DECODER_DATA":
|
|
21565
|
+
case 5:
|
|
21566
|
+
message.type = 5;
|
|
21567
|
+
break;
|
|
21568
|
+
}
|
|
21569
|
+
if (object.pts != null) {
|
|
21570
|
+
if ($util.Long)
|
|
21571
|
+
(message.pts = $util.Long.fromValue(object.pts)).unsigned = true;
|
|
21572
|
+
else if (typeof object.pts === "string")
|
|
21573
|
+
message.pts = parseInt(object.pts, 10);
|
|
21574
|
+
else if (typeof object.pts === "number")
|
|
21575
|
+
message.pts = object.pts;
|
|
21576
|
+
else if (typeof object.pts === "object")
|
|
21577
|
+
message.pts = new $util.LongBits(object.pts.low >>> 0, object.pts.high >>> 0).toNumber(true);
|
|
21578
|
+
}
|
|
21579
|
+
if (object.id != null) {
|
|
21580
|
+
if ($util.Long)
|
|
21581
|
+
(message.id = $util.Long.fromValue(object.id)).unsigned = true;
|
|
21582
|
+
else if (typeof object.id === "string")
|
|
21583
|
+
message.id = parseInt(object.id, 10);
|
|
21584
|
+
else if (typeof object.id === "number")
|
|
21585
|
+
message.id = object.id;
|
|
21586
|
+
else if (typeof object.id === "object")
|
|
21587
|
+
message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true);
|
|
21588
|
+
}
|
|
21589
|
+
if (object.keyframe != null)
|
|
21590
|
+
message.keyframe = Boolean(object.keyframe);
|
|
21591
|
+
if (object.codecData != null) {
|
|
21592
|
+
if (typeof object.codecData !== "object")
|
|
21593
|
+
throw TypeError(".sesame.v1.wire.FrameHeader.codecData: object expected");
|
|
21594
|
+
message.codecData = $root.sesame.v1.wire.MediaCodecData.fromObject(object.codecData);
|
|
21595
|
+
}
|
|
21596
|
+
if (object.routingMetadata != null)
|
|
21597
|
+
message.routingMetadata = String(object.routingMetadata);
|
|
21598
|
+
return message;
|
|
21599
|
+
};
|
|
21600
|
+
FrameHeader2.toObject = function toObject(message, options) {
|
|
21601
|
+
if (!options)
|
|
21602
|
+
options = {};
|
|
21603
|
+
let object = {};
|
|
21604
|
+
if (options.defaults) {
|
|
21605
|
+
object.type = options.enums === String ? "FRAME_TYPE_UNSPECIFIED" : 0;
|
|
21606
|
+
if ($util.Long) {
|
|
21607
|
+
let long = new $util.Long(0, 0, true);
|
|
21608
|
+
object.pts = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
|
21609
|
+
} else
|
|
21610
|
+
object.pts = options.longs === String ? "0" : 0;
|
|
21611
|
+
if ($util.Long) {
|
|
21612
|
+
let long = new $util.Long(0, 0, true);
|
|
21613
|
+
object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
|
21614
|
+
} else
|
|
21615
|
+
object.id = options.longs === String ? "0" : 0;
|
|
21616
|
+
object.keyframe = false;
|
|
21617
|
+
object.codecData = null;
|
|
21618
|
+
object.routingMetadata = "";
|
|
21619
|
+
}
|
|
21620
|
+
if (message.type != null && message.hasOwnProperty("type"))
|
|
21621
|
+
object.type = options.enums === String ? $root.sesame.v1.wire.FrameType[message.type] === void 0 ? message.type : $root.sesame.v1.wire.FrameType[message.type] : message.type;
|
|
21622
|
+
if (message.pts != null && message.hasOwnProperty("pts"))
|
|
21623
|
+
if (typeof message.pts === "number")
|
|
21624
|
+
object.pts = options.longs === String ? String(message.pts) : message.pts;
|
|
21625
|
+
else
|
|
21626
|
+
object.pts = options.longs === String ? $util.Long.prototype.toString.call(message.pts) : options.longs === Number ? new $util.LongBits(message.pts.low >>> 0, message.pts.high >>> 0).toNumber(true) : message.pts;
|
|
21627
|
+
if (message.id != null && message.hasOwnProperty("id"))
|
|
21628
|
+
if (typeof message.id === "number")
|
|
21629
|
+
object.id = options.longs === String ? String(message.id) : message.id;
|
|
21630
|
+
else
|
|
21631
|
+
object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) : message.id;
|
|
21632
|
+
if (message.keyframe != null && message.hasOwnProperty("keyframe"))
|
|
21633
|
+
object.keyframe = message.keyframe;
|
|
21634
|
+
if (message.codecData != null && message.hasOwnProperty("codecData"))
|
|
21635
|
+
object.codecData = $root.sesame.v1.wire.MediaCodecData.toObject(message.codecData, options);
|
|
21636
|
+
if (message.routingMetadata != null && message.hasOwnProperty("routingMetadata"))
|
|
21637
|
+
object.routingMetadata = message.routingMetadata;
|
|
21638
|
+
return object;
|
|
21639
|
+
};
|
|
21640
|
+
FrameHeader2.prototype.toJSON = function toJSON() {
|
|
21641
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
21642
|
+
};
|
|
21643
|
+
FrameHeader2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
21644
|
+
if (typeUrlPrefix === void 0) {
|
|
21645
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
21646
|
+
}
|
|
21647
|
+
return typeUrlPrefix + "/sesame.v1.wire.FrameHeader";
|
|
21648
|
+
};
|
|
21649
|
+
return FrameHeader2;
|
|
21650
|
+
}();
|
|
21651
|
+
return wire;
|
|
21652
|
+
}();
|
|
21057
21653
|
return v1;
|
|
21058
21654
|
}();
|
|
21059
21655
|
return sesame2;
|
|
@@ -21493,7 +22089,8 @@ var RPCClient = class extends EventEmitter {
|
|
|
21493
22089
|
eventHandler(event) {
|
|
21494
22090
|
const topic = event.topic ?? 0;
|
|
21495
22091
|
if (topic === sesame.v1.common.EventTopic.EVENT_TOPIC_UNSPECIFIED) {
|
|
21496
|
-
|
|
22092
|
+
log.warn(`Ignoring event with unspecified topic: ${event.topic}`);
|
|
22093
|
+
return;
|
|
21497
22094
|
}
|
|
21498
22095
|
const type = this.eventTypes[topic];
|
|
21499
22096
|
let payload;
|
|
@@ -21519,255 +22116,58 @@ var RPCClient = class extends EventEmitter {
|
|
|
21519
22116
|
// src/sesame-connection.ts
|
|
21520
22117
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
21521
22118
|
|
|
21522
|
-
// src/sesame-
|
|
21523
|
-
var
|
|
21524
|
-
var
|
|
21525
|
-
var
|
|
21526
|
-
var
|
|
21527
|
-
var
|
|
21528
|
-
var
|
|
21529
|
-
var FLAG_HAS_METADATA = 1 << 1;
|
|
21530
|
-
var FLAG_IS_KEYFRAME = 1 << 2;
|
|
21531
|
-
var PacketType = /* @__PURE__ */ ((PacketType2) => {
|
|
21532
|
-
PacketType2[PacketType2["VIDEO_FRAME"] = 1] = "VIDEO_FRAME";
|
|
21533
|
-
PacketType2[PacketType2["AUDIO_FRAME"] = 2] = "AUDIO_FRAME";
|
|
21534
|
-
PacketType2[PacketType2["RPC"] = 3] = "RPC";
|
|
21535
|
-
PacketType2[PacketType2["MUXED_DATA"] = 4] = "MUXED_DATA";
|
|
21536
|
-
PacketType2[PacketType2["DECODER_DATA"] = 5] = "DECODER_DATA";
|
|
21537
|
-
return PacketType2;
|
|
21538
|
-
})(PacketType || {});
|
|
21539
|
-
var CodecType = /* @__PURE__ */ ((CodecType2) => {
|
|
21540
|
-
CodecType2[CodecType2["VIDEO_VP8"] = 1] = "VIDEO_VP8";
|
|
21541
|
-
CodecType2[CodecType2["VIDEO_VP9"] = 2] = "VIDEO_VP9";
|
|
21542
|
-
CodecType2[CodecType2["VIDEO_AVC"] = 3] = "VIDEO_AVC";
|
|
21543
|
-
CodecType2[CodecType2["VIDEO_HEVC"] = 4] = "VIDEO_HEVC";
|
|
21544
|
-
CodecType2[CodecType2["VIDEO_AV1"] = 5] = "VIDEO_AV1";
|
|
21545
|
-
CodecType2[CodecType2["AUDIO_OPUS"] = 64] = "AUDIO_OPUS";
|
|
21546
|
-
CodecType2[CodecType2["AUDIO_AAC"] = 65] = "AUDIO_AAC";
|
|
21547
|
-
CodecType2[CodecType2["AUDIO_PCM"] = 66] = "AUDIO_PCM";
|
|
21548
|
-
return CodecType2;
|
|
21549
|
-
})(CodecType || {});
|
|
21550
|
-
var SesameBinaryProtocol = class {
|
|
21551
|
-
/**
|
|
21552
|
-
* Initialize a header data structure with proper defaults
|
|
21553
|
-
*/
|
|
21554
|
-
static initHeader(type, flags, pts, id) {
|
|
21555
|
-
return {
|
|
21556
|
-
magic: PROTOCOL_MAGIC,
|
|
21557
|
-
version: PROTOCOL_VERSION,
|
|
21558
|
-
header_size: this.calculateHeaderSize(flags),
|
|
21559
|
-
type,
|
|
21560
|
-
flags,
|
|
21561
|
-
pts,
|
|
21562
|
-
id,
|
|
21563
|
-
reserved: 0
|
|
21564
|
-
// Always zero reserved fields
|
|
21565
|
-
};
|
|
21566
|
-
}
|
|
21567
|
-
/**
|
|
21568
|
-
* Calculate the total header size based on flags
|
|
21569
|
-
*/
|
|
21570
|
-
static calculateHeaderSize(flags) {
|
|
21571
|
-
let size = HEADER_DATA_SIZE;
|
|
21572
|
-
if (flags & FLAG_HAS_METADATA) {
|
|
21573
|
-
size += HEADER_METADATA_SIZE;
|
|
21574
|
-
}
|
|
21575
|
-
if (flags & FLAG_HAS_CODEC_DATA) {
|
|
21576
|
-
size += HEADER_CODEC_DATA_SIZE;
|
|
21577
|
-
}
|
|
21578
|
-
return size;
|
|
21579
|
-
}
|
|
21580
|
-
/**
|
|
21581
|
-
* Validate a header structure
|
|
21582
|
-
*/
|
|
21583
|
-
static validateHeader(header, totalSize) {
|
|
21584
|
-
if (header.magic !== PROTOCOL_MAGIC) {
|
|
21585
|
-
return false;
|
|
21586
|
-
}
|
|
21587
|
-
if (header.version !== PROTOCOL_VERSION) {
|
|
21588
|
-
return false;
|
|
21589
|
-
}
|
|
21590
|
-
const expectedHeaderSize = this.calculateHeaderSize(header.flags);
|
|
21591
|
-
if (header.header_size !== expectedHeaderSize) {
|
|
21592
|
-
return false;
|
|
21593
|
-
}
|
|
21594
|
-
if (totalSize < header.header_size) {
|
|
21595
|
-
return false;
|
|
21596
|
-
}
|
|
21597
|
-
return true;
|
|
21598
|
-
}
|
|
22119
|
+
// src/sesame-wire-protocol.ts
|
|
22120
|
+
var FrameType = sesame.v1.wire.FrameType;
|
|
22121
|
+
var FrameHeader = sesame.v1.wire.FrameHeader;
|
|
22122
|
+
var MediaCodecData = sesame.v1.wire.MediaCodecData;
|
|
22123
|
+
var CodecType = sesame.v1.wire.CodecType;
|
|
22124
|
+
var PREFIX_SIZE = 4;
|
|
22125
|
+
var WireProtocol = class {
|
|
21599
22126
|
/**
|
|
21600
|
-
* Serialize
|
|
22127
|
+
* Serialize a wire frame: 4-byte LE header_size + protobuf FrameHeader + payload.
|
|
21601
22128
|
*/
|
|
21602
|
-
static serialize(header,
|
|
21603
|
-
const
|
|
21604
|
-
const
|
|
21605
|
-
|
|
21606
|
-
|
|
21607
|
-
|
|
21608
|
-
|
|
21609
|
-
|
|
21610
|
-
|
|
21611
|
-
|
|
21612
|
-
|
|
21613
|
-
view.setUint32(offset, header.magic, true);
|
|
21614
|
-
offset += 4;
|
|
21615
|
-
view.setUint32(offset, header.flags, true);
|
|
21616
|
-
offset += 4;
|
|
21617
|
-
view.setBigUint64(offset, header.pts, true);
|
|
21618
|
-
offset += 8;
|
|
21619
|
-
view.setBigUint64(offset, header.id, true);
|
|
21620
|
-
offset += 8;
|
|
21621
|
-
view.setUint16(offset, header.version, true);
|
|
21622
|
-
offset += 2;
|
|
21623
|
-
view.setUint16(offset, header.header_size, true);
|
|
21624
|
-
offset += 2;
|
|
21625
|
-
view.setUint16(offset, header.type, true);
|
|
21626
|
-
offset += 2;
|
|
21627
|
-
view.setUint16(offset, header.reserved, true);
|
|
21628
|
-
offset += 2;
|
|
21629
|
-
if (includeMetadata && metadata) {
|
|
21630
|
-
const metadataBytes = this.stringToFixedBytes(metadata.metadata, 64);
|
|
21631
|
-
new Uint8Array(buffer, offset, 64).set(metadataBytes);
|
|
21632
|
-
offset += 64;
|
|
22129
|
+
static serialize(header, payload) {
|
|
22130
|
+
const headerBytes = sesame.v1.wire.FrameHeader.encode(header).finish();
|
|
22131
|
+
const headerSize = headerBytes.length;
|
|
22132
|
+
const payloadSize = payload ? payload.length : 0;
|
|
22133
|
+
const total = PREFIX_SIZE + headerSize + payloadSize;
|
|
22134
|
+
const buffer = new Uint8Array(total);
|
|
22135
|
+
const view = new DataView(buffer.buffer);
|
|
22136
|
+
view.setUint32(0, headerSize, true);
|
|
22137
|
+
buffer.set(headerBytes, PREFIX_SIZE);
|
|
22138
|
+
if (payload && payloadSize > 0) {
|
|
22139
|
+
buffer.set(payload, PREFIX_SIZE + headerSize);
|
|
21633
22140
|
}
|
|
21634
|
-
|
|
21635
|
-
view.setUint32(offset, codecData.sample_rate, true);
|
|
21636
|
-
offset += 4;
|
|
21637
|
-
view.setUint32(offset, codecData.timebase_num, true);
|
|
21638
|
-
offset += 4;
|
|
21639
|
-
view.setUint32(offset, codecData.timebase_den, true);
|
|
21640
|
-
offset += 4;
|
|
21641
|
-
view.setUint16(offset, codecData.codec_profile, true);
|
|
21642
|
-
offset += 2;
|
|
21643
|
-
view.setUint16(offset, codecData.codec_level, true);
|
|
21644
|
-
offset += 2;
|
|
21645
|
-
view.setUint16(offset, codecData.width, true);
|
|
21646
|
-
offset += 2;
|
|
21647
|
-
view.setUint16(offset, codecData.height, true);
|
|
21648
|
-
offset += 2;
|
|
21649
|
-
view.setUint8(offset, codecData.codec_type);
|
|
21650
|
-
offset += 1;
|
|
21651
|
-
view.setUint8(offset, codecData.channels);
|
|
21652
|
-
offset += 1;
|
|
21653
|
-
view.setUint8(offset, codecData.bit_depth);
|
|
21654
|
-
offset += 1;
|
|
21655
|
-
view.setUint8(offset, codecData.reserved);
|
|
21656
|
-
offset += 1;
|
|
21657
|
-
}
|
|
21658
|
-
if (payload && payload.length > 0) {
|
|
21659
|
-
new Uint8Array(buffer, offset).set(payload);
|
|
21660
|
-
}
|
|
21661
|
-
return new Uint8Array(buffer);
|
|
22141
|
+
return buffer;
|
|
21662
22142
|
}
|
|
21663
22143
|
/**
|
|
21664
|
-
* Parse incoming
|
|
22144
|
+
* Parse an incoming wire frame.
|
|
21665
22145
|
*/
|
|
21666
|
-
static
|
|
21667
|
-
const result = {
|
|
21668
|
-
|
|
21669
|
-
|
|
21670
|
-
|
|
21671
|
-
|
|
21672
|
-
|
|
21673
|
-
|
|
21674
|
-
|
|
21675
|
-
|
|
21676
|
-
|
|
21677
|
-
}
|
|
21678
|
-
const view = new DataView(data.buffer, data.byteOffset);
|
|
21679
|
-
let offset = 0;
|
|
21680
|
-
const header = {
|
|
21681
|
-
magic: view.getUint32(offset, true),
|
|
21682
|
-
flags: view.getUint32(offset + 4, true),
|
|
21683
|
-
pts: view.getBigUint64(offset + 8, true),
|
|
21684
|
-
id: view.getBigUint64(offset + 16, true),
|
|
21685
|
-
version: view.getUint16(offset + 24, true),
|
|
21686
|
-
header_size: view.getUint16(offset + 26, true),
|
|
21687
|
-
type: view.getUint16(offset + 28, true),
|
|
21688
|
-
reserved: view.getUint16(offset + 30, true)
|
|
21689
|
-
};
|
|
21690
|
-
offset += HEADER_DATA_SIZE;
|
|
21691
|
-
if (!this.validateHeader(header, data.length)) {
|
|
21692
|
-
return result;
|
|
21693
|
-
}
|
|
21694
|
-
result.header = header;
|
|
21695
|
-
if (header.flags & FLAG_HAS_METADATA) {
|
|
21696
|
-
if (data.length < offset + HEADER_METADATA_SIZE) {
|
|
21697
|
-
return result;
|
|
21698
|
-
}
|
|
21699
|
-
const metadataBytes = data.slice(offset, offset + HEADER_METADATA_SIZE);
|
|
21700
|
-
const metadataStr = this.fixedBytesToString(metadataBytes);
|
|
21701
|
-
result.metadata = { metadata: metadataStr };
|
|
21702
|
-
offset += HEADER_METADATA_SIZE;
|
|
22146
|
+
static parse(data) {
|
|
22147
|
+
const result = { valid: false, header: null, payload: null };
|
|
22148
|
+
if (!data || data.length < PREFIX_SIZE) return result;
|
|
22149
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
22150
|
+
const headerSize = view.getUint32(0, true);
|
|
22151
|
+
if (data.length < PREFIX_SIZE + headerSize) return result;
|
|
22152
|
+
try {
|
|
22153
|
+
const headerBytes = data.subarray(PREFIX_SIZE, PREFIX_SIZE + headerSize);
|
|
22154
|
+
result.header = sesame.v1.wire.FrameHeader.decode(headerBytes);
|
|
22155
|
+
result.payload = data.subarray(PREFIX_SIZE + headerSize);
|
|
22156
|
+
result.valid = true;
|
|
22157
|
+
} catch {
|
|
21703
22158
|
}
|
|
21704
|
-
if (header.flags & FLAG_HAS_CODEC_DATA) {
|
|
21705
|
-
if (data.length < offset + HEADER_CODEC_DATA_SIZE) {
|
|
21706
|
-
return result;
|
|
21707
|
-
}
|
|
21708
|
-
result.codec_data = {
|
|
21709
|
-
sample_rate: view.getUint32(offset, true),
|
|
21710
|
-
timebase_num: view.getUint32(offset + 4, true),
|
|
21711
|
-
timebase_den: view.getUint32(offset + 8, true),
|
|
21712
|
-
codec_profile: view.getUint16(offset + 12, true),
|
|
21713
|
-
codec_level: view.getUint16(offset + 14, true),
|
|
21714
|
-
width: view.getUint16(offset + 16, true),
|
|
21715
|
-
height: view.getUint16(offset + 18, true),
|
|
21716
|
-
codec_type: view.getUint8(offset + 20),
|
|
21717
|
-
channels: view.getUint8(offset + 21),
|
|
21718
|
-
bit_depth: view.getUint8(offset + 22),
|
|
21719
|
-
reserved: view.getUint8(offset + 23)
|
|
21720
|
-
};
|
|
21721
|
-
offset += HEADER_CODEC_DATA_SIZE;
|
|
21722
|
-
}
|
|
21723
|
-
if (offset < data.length) {
|
|
21724
|
-
result.payload = data.slice(offset);
|
|
21725
|
-
result.payload_size = result.payload.length;
|
|
21726
|
-
} else {
|
|
21727
|
-
result.payload = new Uint8Array(0);
|
|
21728
|
-
result.payload_size = 0;
|
|
21729
|
-
}
|
|
21730
|
-
result.valid = true;
|
|
21731
22159
|
return result;
|
|
21732
22160
|
}
|
|
21733
|
-
/**
|
|
21734
|
-
* Helper: Convert string to fixed-size byte array (null-terminated)
|
|
21735
|
-
*/
|
|
21736
|
-
static stringToFixedBytes(str, size) {
|
|
21737
|
-
const bytes = new Uint8Array(size);
|
|
21738
|
-
let encoded;
|
|
21739
|
-
if (typeof TextEncoder !== "undefined") {
|
|
21740
|
-
const encoder = new TextEncoder();
|
|
21741
|
-
encoded = encoder.encode(str);
|
|
21742
|
-
} else {
|
|
21743
|
-
encoded = new Uint8Array(Buffer.from(str, "utf8"));
|
|
21744
|
-
}
|
|
21745
|
-
const copyLen = Math.min(encoded.length, size - 1);
|
|
21746
|
-
bytes.set(encoded.slice(0, copyLen));
|
|
21747
|
-
bytes[copyLen] = 0;
|
|
21748
|
-
return bytes;
|
|
21749
|
-
}
|
|
21750
|
-
/**
|
|
21751
|
-
* Helper: Convert fixed-size byte array to string (null-terminated)
|
|
21752
|
-
*/
|
|
21753
|
-
static fixedBytesToString(bytes) {
|
|
21754
|
-
let len = bytes.length;
|
|
21755
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
21756
|
-
if (bytes[i] === 0) {
|
|
21757
|
-
len = i;
|
|
21758
|
-
break;
|
|
21759
|
-
}
|
|
21760
|
-
}
|
|
21761
|
-
if (typeof TextDecoder !== "undefined") {
|
|
21762
|
-
const decoder = new TextDecoder();
|
|
21763
|
-
return decoder.decode(bytes.slice(0, len));
|
|
21764
|
-
} else {
|
|
21765
|
-
return Buffer.from(bytes.slice(0, len)).toString("utf8");
|
|
21766
|
-
}
|
|
21767
|
-
}
|
|
21768
22161
|
};
|
|
21769
22162
|
|
|
21770
22163
|
// src/sesame-connection.ts
|
|
22164
|
+
var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
|
|
22165
|
+
ConnectionState2["Disconnected"] = "disconnected";
|
|
22166
|
+
ConnectionState2["Connecting"] = "connecting";
|
|
22167
|
+
ConnectionState2["Connected"] = "connected";
|
|
22168
|
+
ConnectionState2["Reconnecting"] = "reconnecting";
|
|
22169
|
+
return ConnectionState2;
|
|
22170
|
+
})(ConnectionState || {});
|
|
21771
22171
|
function waitForEvent(emitter, eventName) {
|
|
21772
22172
|
return new Promise((resolve) => {
|
|
21773
22173
|
emitter.once(eventName, resolve);
|
|
@@ -21780,6 +22180,7 @@ var SesameConnection = class extends EventEmitter2 {
|
|
|
21780
22180
|
this.numRetries = 0;
|
|
21781
22181
|
this.url = "";
|
|
21782
22182
|
this.autoReconnect = true;
|
|
22183
|
+
this._state = "disconnected" /* Disconnected */;
|
|
21783
22184
|
/* Bound listeners so we can removeEventListener later */
|
|
21784
22185
|
this.boundMessageHandler = (event) => this.messageHandler(event);
|
|
21785
22186
|
this.boundOpenHandler = () => this.openHandler();
|
|
@@ -21787,38 +22188,68 @@ var SesameConnection = class extends EventEmitter2 {
|
|
|
21787
22188
|
this.boundErrorHandler = (event) => this.errorHandler(event);
|
|
21788
22189
|
this.openHandler = () => {
|
|
21789
22190
|
this.numRetries = 0;
|
|
22191
|
+
this.setState("connected" /* Connected */);
|
|
21790
22192
|
this.emit("open");
|
|
21791
22193
|
};
|
|
21792
22194
|
this.messageHandler = (event) => {
|
|
21793
22195
|
if (event.data instanceof ArrayBuffer) {
|
|
21794
|
-
const parsed =
|
|
21795
|
-
if (!parsed.valid)
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
}
|
|
21799
|
-
|
|
21800
|
-
|
|
22196
|
+
const parsed = WireProtocol.parse(new Uint8Array(event.data));
|
|
22197
|
+
if (!parsed.valid) {
|
|
22198
|
+
this.emit("error", new Error("Invalid packet received"));
|
|
22199
|
+
return;
|
|
22200
|
+
}
|
|
22201
|
+
const frameType = parsed.header?.type;
|
|
22202
|
+
if (frameType === FrameType.FRAME_TYPE_RPC) {
|
|
21801
22203
|
this.emit("rpc", parsed.payload);
|
|
22204
|
+
} else {
|
|
22205
|
+
this.emit("media-packet", parsed);
|
|
21802
22206
|
}
|
|
21803
22207
|
}
|
|
21804
22208
|
};
|
|
21805
22209
|
this.url = options.url;
|
|
21806
22210
|
this.autoReconnect = options.autoReconnect;
|
|
21807
|
-
if (options.autoConnect) this.connect().catch(() =>
|
|
22211
|
+
if (options.autoConnect) this.connect().catch(() => {
|
|
22212
|
+
});
|
|
22213
|
+
}
|
|
22214
|
+
get state() {
|
|
22215
|
+
return this._state;
|
|
22216
|
+
}
|
|
22217
|
+
setState(newState) {
|
|
22218
|
+
if (this._state === newState) return;
|
|
22219
|
+
const prev = this._state;
|
|
22220
|
+
this._state = newState;
|
|
22221
|
+
switch (newState) {
|
|
22222
|
+
case "connected" /* Connected */:
|
|
22223
|
+
log.info("Connected to Sesame");
|
|
22224
|
+
break;
|
|
22225
|
+
case "reconnecting" /* Reconnecting */:
|
|
22226
|
+
if (prev === "connected" /* Connected */) {
|
|
22227
|
+
log.warn("Lost connection to Sesame, will try reconnect..");
|
|
22228
|
+
} else {
|
|
22229
|
+
log.warn("Failed to connect to Sesame, will try reconnect..");
|
|
22230
|
+
}
|
|
22231
|
+
break;
|
|
22232
|
+
case "disconnected" /* Disconnected */:
|
|
22233
|
+
log.info("Disconnected from Sesame");
|
|
22234
|
+
break;
|
|
22235
|
+
}
|
|
22236
|
+
this.emit("state", newState, prev);
|
|
21808
22237
|
}
|
|
21809
22238
|
isConnected() {
|
|
21810
22239
|
return this.socket !== void 0 && this.socket.readyState === WebSocket.OPEN;
|
|
21811
22240
|
}
|
|
21812
22241
|
async send(data) {
|
|
21813
22242
|
if (!this.isConnected()) throw new Error("Not connected");
|
|
21814
|
-
const header =
|
|
21815
|
-
const
|
|
21816
|
-
|
|
21817
|
-
this.socket.send(data_to_send);
|
|
22243
|
+
const header = { type: sesame.v1.wire.FrameType.FRAME_TYPE_RPC };
|
|
22244
|
+
const frame = WireProtocol.serialize(header, data);
|
|
22245
|
+
this.socket.send(frame);
|
|
21818
22246
|
return Promise.resolve();
|
|
21819
22247
|
}
|
|
21820
22248
|
async connect() {
|
|
21821
22249
|
this.active = true;
|
|
22250
|
+
if (this._state === "disconnected" /* Disconnected */) {
|
|
22251
|
+
this.setState("connecting" /* Connecting */);
|
|
22252
|
+
}
|
|
21822
22253
|
this.socket = new WebSocket(this.url);
|
|
21823
22254
|
this.socket.addEventListener("message", this.boundMessageHandler);
|
|
21824
22255
|
this.socket.addEventListener("open", this.boundOpenHandler);
|
|
@@ -21841,6 +22272,7 @@ var SesameConnection = class extends EventEmitter2 {
|
|
|
21841
22272
|
async disconnect() {
|
|
21842
22273
|
this.active = false;
|
|
21843
22274
|
if (!this.socket) {
|
|
22275
|
+
this.setState("disconnected" /* Disconnected */);
|
|
21844
22276
|
return;
|
|
21845
22277
|
}
|
|
21846
22278
|
const sock = this.socket;
|
|
@@ -21858,7 +22290,8 @@ var SesameConnection = class extends EventEmitter2 {
|
|
|
21858
22290
|
}
|
|
21859
22291
|
retryHandler() {
|
|
21860
22292
|
if (this.active && this.autoReconnect) {
|
|
21861
|
-
this.connect().catch((
|
|
22293
|
+
this.connect().catch(() => {
|
|
22294
|
+
});
|
|
21862
22295
|
}
|
|
21863
22296
|
}
|
|
21864
22297
|
closeHandler() {
|
|
@@ -21868,13 +22301,17 @@ var SesameConnection = class extends EventEmitter2 {
|
|
|
21868
22301
|
}
|
|
21869
22302
|
this.socket = void 0;
|
|
21870
22303
|
if (this.active) {
|
|
21871
|
-
|
|
22304
|
+
if (this.autoReconnect) {
|
|
22305
|
+
this.setState("reconnecting" /* Reconnecting */);
|
|
21872
22306
|
setTimeout(() => {
|
|
21873
22307
|
this.retryHandler();
|
|
21874
22308
|
}, defaultBackoff(++this.numRetries));
|
|
21875
|
-
}
|
|
21876
|
-
|
|
22309
|
+
} else {
|
|
22310
|
+
this.active = false;
|
|
22311
|
+
this.setState("disconnected" /* Disconnected */);
|
|
21877
22312
|
}
|
|
22313
|
+
} else {
|
|
22314
|
+
this.setState("disconnected" /* Disconnected */);
|
|
21878
22315
|
}
|
|
21879
22316
|
}
|
|
21880
22317
|
errorHandler(error) {
|
|
@@ -21900,9 +22337,6 @@ var StatusApi = class {
|
|
|
21900
22337
|
async getIODevices() {
|
|
21901
22338
|
return this.rpc.service.requestIODeviceList(new sesame.v1.common.Empty());
|
|
21902
22339
|
}
|
|
21903
|
-
async requestKeyframe(outputId) {
|
|
21904
|
-
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
21905
|
-
}
|
|
21906
22340
|
};
|
|
21907
22341
|
|
|
21908
22342
|
// src/recorder-api.ts
|
|
@@ -22051,10 +22485,7 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22051
22485
|
constructor(portOrUrl) {
|
|
22052
22486
|
super();
|
|
22053
22487
|
this.subscriptions = [];
|
|
22054
|
-
this.
|
|
22055
|
-
this.onVideoPacket = () => {
|
|
22056
|
-
};
|
|
22057
|
-
this.onAudioPacket = () => {
|
|
22488
|
+
this.onMediaPacket = () => {
|
|
22058
22489
|
};
|
|
22059
22490
|
this.onCallbackMessage = () => {
|
|
22060
22491
|
};
|
|
@@ -22065,10 +22496,6 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22065
22496
|
autoReconnect: true
|
|
22066
22497
|
});
|
|
22067
22498
|
this.conn.on("error", () => {
|
|
22068
|
-
if (!this.errorIsLogged) {
|
|
22069
|
-
log.warn("Could not connect to Sesame Engine, will keep trying..");
|
|
22070
|
-
this.errorIsLogged = true;
|
|
22071
|
-
}
|
|
22072
22499
|
});
|
|
22073
22500
|
let events = {
|
|
22074
22501
|
[sesame.v1.common.EventTopic.EVENT_TOPIC_ERROR]: sesame.v1.status.Event,
|
|
@@ -22093,18 +22520,18 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22093
22520
|
}
|
|
22094
22521
|
});
|
|
22095
22522
|
this.rpc.on("error", (err) => {
|
|
22096
|
-
|
|
22523
|
+
if (this.isConnected()) {
|
|
22524
|
+
log.error(`RPC error: ${err.message}`);
|
|
22525
|
+
}
|
|
22097
22526
|
});
|
|
22098
22527
|
this.conn.on("open", async () => {
|
|
22099
22528
|
this.sendSubscriptions();
|
|
22100
|
-
this.errorIsLogged = false;
|
|
22101
22529
|
this.emit("connected");
|
|
22102
22530
|
});
|
|
22103
22531
|
this.conn.on("close", () => {
|
|
22104
22532
|
this.emit("disconnected");
|
|
22105
22533
|
});
|
|
22106
|
-
this.conn.on("
|
|
22107
|
-
this.conn.on("audio-packet", (data) => this.onAudioPacket(this.videoSubscriptionId, data));
|
|
22534
|
+
this.conn.on("media-packet", (frame) => this.onMediaPacket(this.mediaSubscriptionId, frame));
|
|
22108
22535
|
this.subscriptions = [];
|
|
22109
22536
|
}
|
|
22110
22537
|
isConnected() {
|
|
@@ -22114,14 +22541,14 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22114
22541
|
if (!this.isConnected()) return;
|
|
22115
22542
|
const eventTopics = this.subscriptions.map((subscription) => subscription.topic);
|
|
22116
22543
|
const channels = [];
|
|
22117
|
-
if (this.
|
|
22544
|
+
if (this.mediaSubscriptionId) channels.push(`media-stream/${this.mediaSubscriptionId}`);
|
|
22118
22545
|
let subs = { eventTopics, channels };
|
|
22119
22546
|
this.rpc.service.updateSubscriptions(subs).catch((err) => {
|
|
22120
22547
|
log.error(`Failed to update subscriptions: ${err.message}`);
|
|
22121
22548
|
});
|
|
22122
22549
|
}
|
|
22123
|
-
|
|
22124
|
-
this.
|
|
22550
|
+
addMediaSubscription(id) {
|
|
22551
|
+
this.mediaSubscriptionId = id;
|
|
22125
22552
|
this.sendSubscriptions();
|
|
22126
22553
|
}
|
|
22127
22554
|
addSubscription(topic, callback) {
|
|
@@ -22140,6 +22567,9 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22140
22567
|
getService() {
|
|
22141
22568
|
return this.rpc;
|
|
22142
22569
|
}
|
|
22570
|
+
async requestKeyframe(outputId) {
|
|
22571
|
+
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
22572
|
+
}
|
|
22143
22573
|
async execute(cl) {
|
|
22144
22574
|
cl.filterCreatedAndDestroyedSources();
|
|
22145
22575
|
if (cl.getCommandListMsg().commandList.length > 0) {
|
|
@@ -22159,19 +22589,21 @@ var Event = sesame.v1.rpc.Event;
|
|
|
22159
22589
|
export {
|
|
22160
22590
|
CodecType,
|
|
22161
22591
|
CommandList,
|
|
22592
|
+
ConnectionState,
|
|
22162
22593
|
EaseKind,
|
|
22163
22594
|
Event,
|
|
22595
|
+
FrameHeader,
|
|
22596
|
+
FrameType,
|
|
22164
22597
|
JobsApi,
|
|
22165
22598
|
Message,
|
|
22166
|
-
PacketType,
|
|
22167
22599
|
RPCClient,
|
|
22168
22600
|
RecorderApi,
|
|
22169
22601
|
Request,
|
|
22170
22602
|
Response,
|
|
22171
|
-
SesameBinaryProtocol,
|
|
22172
22603
|
SesameClient,
|
|
22173
22604
|
SesameConnection,
|
|
22174
22605
|
StatusApi,
|
|
22606
|
+
WireProtocol,
|
|
22175
22607
|
getLogger,
|
|
22176
22608
|
log,
|
|
22177
22609
|
sesame,
|