@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.browser.mjs
CHANGED
|
@@ -21449,6 +21449,602 @@ var sesame = $root.sesame = (() => {
|
|
|
21449
21449
|
}();
|
|
21450
21450
|
return rpc;
|
|
21451
21451
|
}();
|
|
21452
|
+
v1.wire = function() {
|
|
21453
|
+
const wire = {};
|
|
21454
|
+
wire.FrameType = function() {
|
|
21455
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
21456
|
+
values[valuesById[0] = "FRAME_TYPE_UNSPECIFIED"] = 0;
|
|
21457
|
+
values[valuesById[1] = "FRAME_TYPE_RPC"] = 1;
|
|
21458
|
+
values[valuesById[2] = "FRAME_TYPE_VIDEO"] = 2;
|
|
21459
|
+
values[valuesById[3] = "FRAME_TYPE_AUDIO"] = 3;
|
|
21460
|
+
values[valuesById[4] = "FRAME_TYPE_MUXED"] = 4;
|
|
21461
|
+
values[valuesById[5] = "FRAME_TYPE_DECODER_DATA"] = 5;
|
|
21462
|
+
return values;
|
|
21463
|
+
}();
|
|
21464
|
+
wire.CodecType = function() {
|
|
21465
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
21466
|
+
values[valuesById[0] = "CODEC_TYPE_UNSPECIFIED"] = 0;
|
|
21467
|
+
values[valuesById[1] = "CODEC_TYPE_VIDEO_VP8"] = 1;
|
|
21468
|
+
values[valuesById[2] = "CODEC_TYPE_VIDEO_VP9"] = 2;
|
|
21469
|
+
values[valuesById[3] = "CODEC_TYPE_VIDEO_AVC"] = 3;
|
|
21470
|
+
values[valuesById[4] = "CODEC_TYPE_VIDEO_HEVC"] = 4;
|
|
21471
|
+
values[valuesById[5] = "CODEC_TYPE_VIDEO_AV1"] = 5;
|
|
21472
|
+
values[valuesById[64] = "CODEC_TYPE_AUDIO_OPUS"] = 64;
|
|
21473
|
+
values[valuesById[65] = "CODEC_TYPE_AUDIO_AAC"] = 65;
|
|
21474
|
+
values[valuesById[66] = "CODEC_TYPE_AUDIO_PCM"] = 66;
|
|
21475
|
+
return values;
|
|
21476
|
+
}();
|
|
21477
|
+
wire.MediaCodecData = function() {
|
|
21478
|
+
function MediaCodecData2(properties) {
|
|
21479
|
+
if (properties) {
|
|
21480
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
21481
|
+
if (properties[keys[i]] != null)
|
|
21482
|
+
this[keys[i]] = properties[keys[i]];
|
|
21483
|
+
}
|
|
21484
|
+
}
|
|
21485
|
+
MediaCodecData2.prototype.codecType = 0;
|
|
21486
|
+
MediaCodecData2.prototype.sampleRate = 0;
|
|
21487
|
+
MediaCodecData2.prototype.timebaseNum = 0;
|
|
21488
|
+
MediaCodecData2.prototype.timebaseDen = 0;
|
|
21489
|
+
MediaCodecData2.prototype.codecProfile = 0;
|
|
21490
|
+
MediaCodecData2.prototype.codecLevel = 0;
|
|
21491
|
+
MediaCodecData2.prototype.width = 0;
|
|
21492
|
+
MediaCodecData2.prototype.height = 0;
|
|
21493
|
+
MediaCodecData2.prototype.channels = 0;
|
|
21494
|
+
MediaCodecData2.prototype.bitDepth = 0;
|
|
21495
|
+
MediaCodecData2.create = function create(properties) {
|
|
21496
|
+
return new MediaCodecData2(properties);
|
|
21497
|
+
};
|
|
21498
|
+
MediaCodecData2.encode = function encode(message, writer) {
|
|
21499
|
+
if (!writer)
|
|
21500
|
+
writer = $Writer.create();
|
|
21501
|
+
if (message.codecType != null && Object.hasOwnProperty.call(message, "codecType"))
|
|
21502
|
+
writer.uint32(
|
|
21503
|
+
/* id 1, wireType 0 =*/
|
|
21504
|
+
8
|
|
21505
|
+
).int32(message.codecType);
|
|
21506
|
+
if (message.sampleRate != null && Object.hasOwnProperty.call(message, "sampleRate"))
|
|
21507
|
+
writer.uint32(
|
|
21508
|
+
/* id 2, wireType 0 =*/
|
|
21509
|
+
16
|
|
21510
|
+
).uint32(message.sampleRate);
|
|
21511
|
+
if (message.timebaseNum != null && Object.hasOwnProperty.call(message, "timebaseNum"))
|
|
21512
|
+
writer.uint32(
|
|
21513
|
+
/* id 3, wireType 0 =*/
|
|
21514
|
+
24
|
|
21515
|
+
).uint32(message.timebaseNum);
|
|
21516
|
+
if (message.timebaseDen != null && Object.hasOwnProperty.call(message, "timebaseDen"))
|
|
21517
|
+
writer.uint32(
|
|
21518
|
+
/* id 4, wireType 0 =*/
|
|
21519
|
+
32
|
|
21520
|
+
).uint32(message.timebaseDen);
|
|
21521
|
+
if (message.codecProfile != null && Object.hasOwnProperty.call(message, "codecProfile"))
|
|
21522
|
+
writer.uint32(
|
|
21523
|
+
/* id 5, wireType 0 =*/
|
|
21524
|
+
40
|
|
21525
|
+
).uint32(message.codecProfile);
|
|
21526
|
+
if (message.codecLevel != null && Object.hasOwnProperty.call(message, "codecLevel"))
|
|
21527
|
+
writer.uint32(
|
|
21528
|
+
/* id 6, wireType 0 =*/
|
|
21529
|
+
48
|
|
21530
|
+
).uint32(message.codecLevel);
|
|
21531
|
+
if (message.width != null && Object.hasOwnProperty.call(message, "width"))
|
|
21532
|
+
writer.uint32(
|
|
21533
|
+
/* id 7, wireType 0 =*/
|
|
21534
|
+
56
|
|
21535
|
+
).uint32(message.width);
|
|
21536
|
+
if (message.height != null && Object.hasOwnProperty.call(message, "height"))
|
|
21537
|
+
writer.uint32(
|
|
21538
|
+
/* id 8, wireType 0 =*/
|
|
21539
|
+
64
|
|
21540
|
+
).uint32(message.height);
|
|
21541
|
+
if (message.channels != null && Object.hasOwnProperty.call(message, "channels"))
|
|
21542
|
+
writer.uint32(
|
|
21543
|
+
/* id 9, wireType 0 =*/
|
|
21544
|
+
72
|
|
21545
|
+
).uint32(message.channels);
|
|
21546
|
+
if (message.bitDepth != null && Object.hasOwnProperty.call(message, "bitDepth"))
|
|
21547
|
+
writer.uint32(
|
|
21548
|
+
/* id 10, wireType 0 =*/
|
|
21549
|
+
80
|
|
21550
|
+
).uint32(message.bitDepth);
|
|
21551
|
+
return writer;
|
|
21552
|
+
};
|
|
21553
|
+
MediaCodecData2.encodeDelimited = function encodeDelimited(message, writer) {
|
|
21554
|
+
return this.encode(message, writer).ldelim();
|
|
21555
|
+
};
|
|
21556
|
+
MediaCodecData2.decode = function decode(reader, length, error) {
|
|
21557
|
+
if (!(reader instanceof $Reader))
|
|
21558
|
+
reader = $Reader.create(reader);
|
|
21559
|
+
let end = length === void 0 ? reader.len : reader.pos + length, message = new $root.sesame.v1.wire.MediaCodecData();
|
|
21560
|
+
while (reader.pos < end) {
|
|
21561
|
+
let tag = reader.uint32();
|
|
21562
|
+
if (tag === error)
|
|
21563
|
+
break;
|
|
21564
|
+
switch (tag >>> 3) {
|
|
21565
|
+
case 1: {
|
|
21566
|
+
message.codecType = reader.int32();
|
|
21567
|
+
break;
|
|
21568
|
+
}
|
|
21569
|
+
case 2: {
|
|
21570
|
+
message.sampleRate = reader.uint32();
|
|
21571
|
+
break;
|
|
21572
|
+
}
|
|
21573
|
+
case 3: {
|
|
21574
|
+
message.timebaseNum = reader.uint32();
|
|
21575
|
+
break;
|
|
21576
|
+
}
|
|
21577
|
+
case 4: {
|
|
21578
|
+
message.timebaseDen = reader.uint32();
|
|
21579
|
+
break;
|
|
21580
|
+
}
|
|
21581
|
+
case 5: {
|
|
21582
|
+
message.codecProfile = reader.uint32();
|
|
21583
|
+
break;
|
|
21584
|
+
}
|
|
21585
|
+
case 6: {
|
|
21586
|
+
message.codecLevel = reader.uint32();
|
|
21587
|
+
break;
|
|
21588
|
+
}
|
|
21589
|
+
case 7: {
|
|
21590
|
+
message.width = reader.uint32();
|
|
21591
|
+
break;
|
|
21592
|
+
}
|
|
21593
|
+
case 8: {
|
|
21594
|
+
message.height = reader.uint32();
|
|
21595
|
+
break;
|
|
21596
|
+
}
|
|
21597
|
+
case 9: {
|
|
21598
|
+
message.channels = reader.uint32();
|
|
21599
|
+
break;
|
|
21600
|
+
}
|
|
21601
|
+
case 10: {
|
|
21602
|
+
message.bitDepth = reader.uint32();
|
|
21603
|
+
break;
|
|
21604
|
+
}
|
|
21605
|
+
default:
|
|
21606
|
+
reader.skipType(tag & 7);
|
|
21607
|
+
break;
|
|
21608
|
+
}
|
|
21609
|
+
}
|
|
21610
|
+
return message;
|
|
21611
|
+
};
|
|
21612
|
+
MediaCodecData2.decodeDelimited = function decodeDelimited(reader) {
|
|
21613
|
+
if (!(reader instanceof $Reader))
|
|
21614
|
+
reader = new $Reader(reader);
|
|
21615
|
+
return this.decode(reader, reader.uint32());
|
|
21616
|
+
};
|
|
21617
|
+
MediaCodecData2.verify = function verify(message) {
|
|
21618
|
+
if (typeof message !== "object" || message === null)
|
|
21619
|
+
return "object expected";
|
|
21620
|
+
if (message.codecType != null && message.hasOwnProperty("codecType"))
|
|
21621
|
+
switch (message.codecType) {
|
|
21622
|
+
default:
|
|
21623
|
+
return "codecType: enum value expected";
|
|
21624
|
+
case 0:
|
|
21625
|
+
case 1:
|
|
21626
|
+
case 2:
|
|
21627
|
+
case 3:
|
|
21628
|
+
case 4:
|
|
21629
|
+
case 5:
|
|
21630
|
+
case 64:
|
|
21631
|
+
case 65:
|
|
21632
|
+
case 66:
|
|
21633
|
+
break;
|
|
21634
|
+
}
|
|
21635
|
+
if (message.sampleRate != null && message.hasOwnProperty("sampleRate")) {
|
|
21636
|
+
if (!$util.isInteger(message.sampleRate))
|
|
21637
|
+
return "sampleRate: integer expected";
|
|
21638
|
+
}
|
|
21639
|
+
if (message.timebaseNum != null && message.hasOwnProperty("timebaseNum")) {
|
|
21640
|
+
if (!$util.isInteger(message.timebaseNum))
|
|
21641
|
+
return "timebaseNum: integer expected";
|
|
21642
|
+
}
|
|
21643
|
+
if (message.timebaseDen != null && message.hasOwnProperty("timebaseDen")) {
|
|
21644
|
+
if (!$util.isInteger(message.timebaseDen))
|
|
21645
|
+
return "timebaseDen: integer expected";
|
|
21646
|
+
}
|
|
21647
|
+
if (message.codecProfile != null && message.hasOwnProperty("codecProfile")) {
|
|
21648
|
+
if (!$util.isInteger(message.codecProfile))
|
|
21649
|
+
return "codecProfile: integer expected";
|
|
21650
|
+
}
|
|
21651
|
+
if (message.codecLevel != null && message.hasOwnProperty("codecLevel")) {
|
|
21652
|
+
if (!$util.isInteger(message.codecLevel))
|
|
21653
|
+
return "codecLevel: integer expected";
|
|
21654
|
+
}
|
|
21655
|
+
if (message.width != null && message.hasOwnProperty("width")) {
|
|
21656
|
+
if (!$util.isInteger(message.width))
|
|
21657
|
+
return "width: integer expected";
|
|
21658
|
+
}
|
|
21659
|
+
if (message.height != null && message.hasOwnProperty("height")) {
|
|
21660
|
+
if (!$util.isInteger(message.height))
|
|
21661
|
+
return "height: integer expected";
|
|
21662
|
+
}
|
|
21663
|
+
if (message.channels != null && message.hasOwnProperty("channels")) {
|
|
21664
|
+
if (!$util.isInteger(message.channels))
|
|
21665
|
+
return "channels: integer expected";
|
|
21666
|
+
}
|
|
21667
|
+
if (message.bitDepth != null && message.hasOwnProperty("bitDepth")) {
|
|
21668
|
+
if (!$util.isInteger(message.bitDepth))
|
|
21669
|
+
return "bitDepth: integer expected";
|
|
21670
|
+
}
|
|
21671
|
+
return null;
|
|
21672
|
+
};
|
|
21673
|
+
MediaCodecData2.fromObject = function fromObject(object) {
|
|
21674
|
+
if (object instanceof $root.sesame.v1.wire.MediaCodecData)
|
|
21675
|
+
return object;
|
|
21676
|
+
let message = new $root.sesame.v1.wire.MediaCodecData();
|
|
21677
|
+
switch (object.codecType) {
|
|
21678
|
+
default:
|
|
21679
|
+
if (typeof object.codecType === "number") {
|
|
21680
|
+
message.codecType = object.codecType;
|
|
21681
|
+
break;
|
|
21682
|
+
}
|
|
21683
|
+
break;
|
|
21684
|
+
case "CODEC_TYPE_UNSPECIFIED":
|
|
21685
|
+
case 0:
|
|
21686
|
+
message.codecType = 0;
|
|
21687
|
+
break;
|
|
21688
|
+
case "CODEC_TYPE_VIDEO_VP8":
|
|
21689
|
+
case 1:
|
|
21690
|
+
message.codecType = 1;
|
|
21691
|
+
break;
|
|
21692
|
+
case "CODEC_TYPE_VIDEO_VP9":
|
|
21693
|
+
case 2:
|
|
21694
|
+
message.codecType = 2;
|
|
21695
|
+
break;
|
|
21696
|
+
case "CODEC_TYPE_VIDEO_AVC":
|
|
21697
|
+
case 3:
|
|
21698
|
+
message.codecType = 3;
|
|
21699
|
+
break;
|
|
21700
|
+
case "CODEC_TYPE_VIDEO_HEVC":
|
|
21701
|
+
case 4:
|
|
21702
|
+
message.codecType = 4;
|
|
21703
|
+
break;
|
|
21704
|
+
case "CODEC_TYPE_VIDEO_AV1":
|
|
21705
|
+
case 5:
|
|
21706
|
+
message.codecType = 5;
|
|
21707
|
+
break;
|
|
21708
|
+
case "CODEC_TYPE_AUDIO_OPUS":
|
|
21709
|
+
case 64:
|
|
21710
|
+
message.codecType = 64;
|
|
21711
|
+
break;
|
|
21712
|
+
case "CODEC_TYPE_AUDIO_AAC":
|
|
21713
|
+
case 65:
|
|
21714
|
+
message.codecType = 65;
|
|
21715
|
+
break;
|
|
21716
|
+
case "CODEC_TYPE_AUDIO_PCM":
|
|
21717
|
+
case 66:
|
|
21718
|
+
message.codecType = 66;
|
|
21719
|
+
break;
|
|
21720
|
+
}
|
|
21721
|
+
if (object.sampleRate != null)
|
|
21722
|
+
message.sampleRate = object.sampleRate >>> 0;
|
|
21723
|
+
if (object.timebaseNum != null)
|
|
21724
|
+
message.timebaseNum = object.timebaseNum >>> 0;
|
|
21725
|
+
if (object.timebaseDen != null)
|
|
21726
|
+
message.timebaseDen = object.timebaseDen >>> 0;
|
|
21727
|
+
if (object.codecProfile != null)
|
|
21728
|
+
message.codecProfile = object.codecProfile >>> 0;
|
|
21729
|
+
if (object.codecLevel != null)
|
|
21730
|
+
message.codecLevel = object.codecLevel >>> 0;
|
|
21731
|
+
if (object.width != null)
|
|
21732
|
+
message.width = object.width >>> 0;
|
|
21733
|
+
if (object.height != null)
|
|
21734
|
+
message.height = object.height >>> 0;
|
|
21735
|
+
if (object.channels != null)
|
|
21736
|
+
message.channels = object.channels >>> 0;
|
|
21737
|
+
if (object.bitDepth != null)
|
|
21738
|
+
message.bitDepth = object.bitDepth >>> 0;
|
|
21739
|
+
return message;
|
|
21740
|
+
};
|
|
21741
|
+
MediaCodecData2.toObject = function toObject(message, options) {
|
|
21742
|
+
if (!options)
|
|
21743
|
+
options = {};
|
|
21744
|
+
let object = {};
|
|
21745
|
+
if (options.defaults) {
|
|
21746
|
+
object.codecType = options.enums === String ? "CODEC_TYPE_UNSPECIFIED" : 0;
|
|
21747
|
+
object.sampleRate = 0;
|
|
21748
|
+
object.timebaseNum = 0;
|
|
21749
|
+
object.timebaseDen = 0;
|
|
21750
|
+
object.codecProfile = 0;
|
|
21751
|
+
object.codecLevel = 0;
|
|
21752
|
+
object.width = 0;
|
|
21753
|
+
object.height = 0;
|
|
21754
|
+
object.channels = 0;
|
|
21755
|
+
object.bitDepth = 0;
|
|
21756
|
+
}
|
|
21757
|
+
if (message.codecType != null && message.hasOwnProperty("codecType"))
|
|
21758
|
+
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;
|
|
21759
|
+
if (message.sampleRate != null && message.hasOwnProperty("sampleRate"))
|
|
21760
|
+
object.sampleRate = message.sampleRate;
|
|
21761
|
+
if (message.timebaseNum != null && message.hasOwnProperty("timebaseNum"))
|
|
21762
|
+
object.timebaseNum = message.timebaseNum;
|
|
21763
|
+
if (message.timebaseDen != null && message.hasOwnProperty("timebaseDen"))
|
|
21764
|
+
object.timebaseDen = message.timebaseDen;
|
|
21765
|
+
if (message.codecProfile != null && message.hasOwnProperty("codecProfile"))
|
|
21766
|
+
object.codecProfile = message.codecProfile;
|
|
21767
|
+
if (message.codecLevel != null && message.hasOwnProperty("codecLevel"))
|
|
21768
|
+
object.codecLevel = message.codecLevel;
|
|
21769
|
+
if (message.width != null && message.hasOwnProperty("width"))
|
|
21770
|
+
object.width = message.width;
|
|
21771
|
+
if (message.height != null && message.hasOwnProperty("height"))
|
|
21772
|
+
object.height = message.height;
|
|
21773
|
+
if (message.channels != null && message.hasOwnProperty("channels"))
|
|
21774
|
+
object.channels = message.channels;
|
|
21775
|
+
if (message.bitDepth != null && message.hasOwnProperty("bitDepth"))
|
|
21776
|
+
object.bitDepth = message.bitDepth;
|
|
21777
|
+
return object;
|
|
21778
|
+
};
|
|
21779
|
+
MediaCodecData2.prototype.toJSON = function toJSON() {
|
|
21780
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
21781
|
+
};
|
|
21782
|
+
MediaCodecData2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
21783
|
+
if (typeUrlPrefix === void 0) {
|
|
21784
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
21785
|
+
}
|
|
21786
|
+
return typeUrlPrefix + "/sesame.v1.wire.MediaCodecData";
|
|
21787
|
+
};
|
|
21788
|
+
return MediaCodecData2;
|
|
21789
|
+
}();
|
|
21790
|
+
wire.FrameHeader = function() {
|
|
21791
|
+
function FrameHeader2(properties) {
|
|
21792
|
+
if (properties) {
|
|
21793
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
21794
|
+
if (properties[keys[i]] != null)
|
|
21795
|
+
this[keys[i]] = properties[keys[i]];
|
|
21796
|
+
}
|
|
21797
|
+
}
|
|
21798
|
+
FrameHeader2.prototype.type = 0;
|
|
21799
|
+
FrameHeader2.prototype.pts = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
|
21800
|
+
FrameHeader2.prototype.id = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
|
21801
|
+
FrameHeader2.prototype.keyframe = false;
|
|
21802
|
+
FrameHeader2.prototype.codecData = null;
|
|
21803
|
+
FrameHeader2.prototype.routingMetadata = "";
|
|
21804
|
+
FrameHeader2.create = function create(properties) {
|
|
21805
|
+
return new FrameHeader2(properties);
|
|
21806
|
+
};
|
|
21807
|
+
FrameHeader2.encode = function encode(message, writer) {
|
|
21808
|
+
if (!writer)
|
|
21809
|
+
writer = $Writer.create();
|
|
21810
|
+
if (message.type != null && Object.hasOwnProperty.call(message, "type"))
|
|
21811
|
+
writer.uint32(
|
|
21812
|
+
/* id 1, wireType 0 =*/
|
|
21813
|
+
8
|
|
21814
|
+
).int32(message.type);
|
|
21815
|
+
if (message.pts != null && Object.hasOwnProperty.call(message, "pts"))
|
|
21816
|
+
writer.uint32(
|
|
21817
|
+
/* id 2, wireType 0 =*/
|
|
21818
|
+
16
|
|
21819
|
+
).uint64(message.pts);
|
|
21820
|
+
if (message.id != null && Object.hasOwnProperty.call(message, "id"))
|
|
21821
|
+
writer.uint32(
|
|
21822
|
+
/* id 3, wireType 0 =*/
|
|
21823
|
+
24
|
|
21824
|
+
).uint64(message.id);
|
|
21825
|
+
if (message.keyframe != null && Object.hasOwnProperty.call(message, "keyframe"))
|
|
21826
|
+
writer.uint32(
|
|
21827
|
+
/* id 4, wireType 0 =*/
|
|
21828
|
+
32
|
|
21829
|
+
).bool(message.keyframe);
|
|
21830
|
+
if (message.codecData != null && Object.hasOwnProperty.call(message, "codecData"))
|
|
21831
|
+
$root.sesame.v1.wire.MediaCodecData.encode(message.codecData, writer.uint32(
|
|
21832
|
+
/* id 5, wireType 2 =*/
|
|
21833
|
+
42
|
|
21834
|
+
).fork()).ldelim();
|
|
21835
|
+
if (message.routingMetadata != null && Object.hasOwnProperty.call(message, "routingMetadata"))
|
|
21836
|
+
writer.uint32(
|
|
21837
|
+
/* id 6, wireType 2 =*/
|
|
21838
|
+
50
|
|
21839
|
+
).string(message.routingMetadata);
|
|
21840
|
+
return writer;
|
|
21841
|
+
};
|
|
21842
|
+
FrameHeader2.encodeDelimited = function encodeDelimited(message, writer) {
|
|
21843
|
+
return this.encode(message, writer).ldelim();
|
|
21844
|
+
};
|
|
21845
|
+
FrameHeader2.decode = function decode(reader, length, error) {
|
|
21846
|
+
if (!(reader instanceof $Reader))
|
|
21847
|
+
reader = $Reader.create(reader);
|
|
21848
|
+
let end = length === void 0 ? reader.len : reader.pos + length, message = new $root.sesame.v1.wire.FrameHeader();
|
|
21849
|
+
while (reader.pos < end) {
|
|
21850
|
+
let tag = reader.uint32();
|
|
21851
|
+
if (tag === error)
|
|
21852
|
+
break;
|
|
21853
|
+
switch (tag >>> 3) {
|
|
21854
|
+
case 1: {
|
|
21855
|
+
message.type = reader.int32();
|
|
21856
|
+
break;
|
|
21857
|
+
}
|
|
21858
|
+
case 2: {
|
|
21859
|
+
message.pts = reader.uint64();
|
|
21860
|
+
break;
|
|
21861
|
+
}
|
|
21862
|
+
case 3: {
|
|
21863
|
+
message.id = reader.uint64();
|
|
21864
|
+
break;
|
|
21865
|
+
}
|
|
21866
|
+
case 4: {
|
|
21867
|
+
message.keyframe = reader.bool();
|
|
21868
|
+
break;
|
|
21869
|
+
}
|
|
21870
|
+
case 5: {
|
|
21871
|
+
message.codecData = $root.sesame.v1.wire.MediaCodecData.decode(reader, reader.uint32());
|
|
21872
|
+
break;
|
|
21873
|
+
}
|
|
21874
|
+
case 6: {
|
|
21875
|
+
message.routingMetadata = reader.string();
|
|
21876
|
+
break;
|
|
21877
|
+
}
|
|
21878
|
+
default:
|
|
21879
|
+
reader.skipType(tag & 7);
|
|
21880
|
+
break;
|
|
21881
|
+
}
|
|
21882
|
+
}
|
|
21883
|
+
return message;
|
|
21884
|
+
};
|
|
21885
|
+
FrameHeader2.decodeDelimited = function decodeDelimited(reader) {
|
|
21886
|
+
if (!(reader instanceof $Reader))
|
|
21887
|
+
reader = new $Reader(reader);
|
|
21888
|
+
return this.decode(reader, reader.uint32());
|
|
21889
|
+
};
|
|
21890
|
+
FrameHeader2.verify = function verify(message) {
|
|
21891
|
+
if (typeof message !== "object" || message === null)
|
|
21892
|
+
return "object expected";
|
|
21893
|
+
if (message.type != null && message.hasOwnProperty("type"))
|
|
21894
|
+
switch (message.type) {
|
|
21895
|
+
default:
|
|
21896
|
+
return "type: enum value expected";
|
|
21897
|
+
case 0:
|
|
21898
|
+
case 1:
|
|
21899
|
+
case 2:
|
|
21900
|
+
case 3:
|
|
21901
|
+
case 4:
|
|
21902
|
+
case 5:
|
|
21903
|
+
break;
|
|
21904
|
+
}
|
|
21905
|
+
if (message.pts != null && message.hasOwnProperty("pts")) {
|
|
21906
|
+
if (!$util.isInteger(message.pts) && !(message.pts && $util.isInteger(message.pts.low) && $util.isInteger(message.pts.high)))
|
|
21907
|
+
return "pts: integer|Long expected";
|
|
21908
|
+
}
|
|
21909
|
+
if (message.id != null && message.hasOwnProperty("id")) {
|
|
21910
|
+
if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)))
|
|
21911
|
+
return "id: integer|Long expected";
|
|
21912
|
+
}
|
|
21913
|
+
if (message.keyframe != null && message.hasOwnProperty("keyframe")) {
|
|
21914
|
+
if (typeof message.keyframe !== "boolean")
|
|
21915
|
+
return "keyframe: boolean expected";
|
|
21916
|
+
}
|
|
21917
|
+
if (message.codecData != null && message.hasOwnProperty("codecData")) {
|
|
21918
|
+
let error = $root.sesame.v1.wire.MediaCodecData.verify(message.codecData);
|
|
21919
|
+
if (error)
|
|
21920
|
+
return "codecData." + error;
|
|
21921
|
+
}
|
|
21922
|
+
if (message.routingMetadata != null && message.hasOwnProperty("routingMetadata")) {
|
|
21923
|
+
if (!$util.isString(message.routingMetadata))
|
|
21924
|
+
return "routingMetadata: string expected";
|
|
21925
|
+
}
|
|
21926
|
+
return null;
|
|
21927
|
+
};
|
|
21928
|
+
FrameHeader2.fromObject = function fromObject(object) {
|
|
21929
|
+
if (object instanceof $root.sesame.v1.wire.FrameHeader)
|
|
21930
|
+
return object;
|
|
21931
|
+
let message = new $root.sesame.v1.wire.FrameHeader();
|
|
21932
|
+
switch (object.type) {
|
|
21933
|
+
default:
|
|
21934
|
+
if (typeof object.type === "number") {
|
|
21935
|
+
message.type = object.type;
|
|
21936
|
+
break;
|
|
21937
|
+
}
|
|
21938
|
+
break;
|
|
21939
|
+
case "FRAME_TYPE_UNSPECIFIED":
|
|
21940
|
+
case 0:
|
|
21941
|
+
message.type = 0;
|
|
21942
|
+
break;
|
|
21943
|
+
case "FRAME_TYPE_RPC":
|
|
21944
|
+
case 1:
|
|
21945
|
+
message.type = 1;
|
|
21946
|
+
break;
|
|
21947
|
+
case "FRAME_TYPE_VIDEO":
|
|
21948
|
+
case 2:
|
|
21949
|
+
message.type = 2;
|
|
21950
|
+
break;
|
|
21951
|
+
case "FRAME_TYPE_AUDIO":
|
|
21952
|
+
case 3:
|
|
21953
|
+
message.type = 3;
|
|
21954
|
+
break;
|
|
21955
|
+
case "FRAME_TYPE_MUXED":
|
|
21956
|
+
case 4:
|
|
21957
|
+
message.type = 4;
|
|
21958
|
+
break;
|
|
21959
|
+
case "FRAME_TYPE_DECODER_DATA":
|
|
21960
|
+
case 5:
|
|
21961
|
+
message.type = 5;
|
|
21962
|
+
break;
|
|
21963
|
+
}
|
|
21964
|
+
if (object.pts != null) {
|
|
21965
|
+
if ($util.Long)
|
|
21966
|
+
(message.pts = $util.Long.fromValue(object.pts)).unsigned = true;
|
|
21967
|
+
else if (typeof object.pts === "string")
|
|
21968
|
+
message.pts = parseInt(object.pts, 10);
|
|
21969
|
+
else if (typeof object.pts === "number")
|
|
21970
|
+
message.pts = object.pts;
|
|
21971
|
+
else if (typeof object.pts === "object")
|
|
21972
|
+
message.pts = new $util.LongBits(object.pts.low >>> 0, object.pts.high >>> 0).toNumber(true);
|
|
21973
|
+
}
|
|
21974
|
+
if (object.id != null) {
|
|
21975
|
+
if ($util.Long)
|
|
21976
|
+
(message.id = $util.Long.fromValue(object.id)).unsigned = true;
|
|
21977
|
+
else if (typeof object.id === "string")
|
|
21978
|
+
message.id = parseInt(object.id, 10);
|
|
21979
|
+
else if (typeof object.id === "number")
|
|
21980
|
+
message.id = object.id;
|
|
21981
|
+
else if (typeof object.id === "object")
|
|
21982
|
+
message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true);
|
|
21983
|
+
}
|
|
21984
|
+
if (object.keyframe != null)
|
|
21985
|
+
message.keyframe = Boolean(object.keyframe);
|
|
21986
|
+
if (object.codecData != null) {
|
|
21987
|
+
if (typeof object.codecData !== "object")
|
|
21988
|
+
throw TypeError(".sesame.v1.wire.FrameHeader.codecData: object expected");
|
|
21989
|
+
message.codecData = $root.sesame.v1.wire.MediaCodecData.fromObject(object.codecData);
|
|
21990
|
+
}
|
|
21991
|
+
if (object.routingMetadata != null)
|
|
21992
|
+
message.routingMetadata = String(object.routingMetadata);
|
|
21993
|
+
return message;
|
|
21994
|
+
};
|
|
21995
|
+
FrameHeader2.toObject = function toObject(message, options) {
|
|
21996
|
+
if (!options)
|
|
21997
|
+
options = {};
|
|
21998
|
+
let object = {};
|
|
21999
|
+
if (options.defaults) {
|
|
22000
|
+
object.type = options.enums === String ? "FRAME_TYPE_UNSPECIFIED" : 0;
|
|
22001
|
+
if ($util.Long) {
|
|
22002
|
+
let long = new $util.Long(0, 0, true);
|
|
22003
|
+
object.pts = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
|
22004
|
+
} else
|
|
22005
|
+
object.pts = options.longs === String ? "0" : 0;
|
|
22006
|
+
if ($util.Long) {
|
|
22007
|
+
let long = new $util.Long(0, 0, true);
|
|
22008
|
+
object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
|
22009
|
+
} else
|
|
22010
|
+
object.id = options.longs === String ? "0" : 0;
|
|
22011
|
+
object.keyframe = false;
|
|
22012
|
+
object.codecData = null;
|
|
22013
|
+
object.routingMetadata = "";
|
|
22014
|
+
}
|
|
22015
|
+
if (message.type != null && message.hasOwnProperty("type"))
|
|
22016
|
+
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;
|
|
22017
|
+
if (message.pts != null && message.hasOwnProperty("pts"))
|
|
22018
|
+
if (typeof message.pts === "number")
|
|
22019
|
+
object.pts = options.longs === String ? String(message.pts) : message.pts;
|
|
22020
|
+
else
|
|
22021
|
+
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;
|
|
22022
|
+
if (message.id != null && message.hasOwnProperty("id"))
|
|
22023
|
+
if (typeof message.id === "number")
|
|
22024
|
+
object.id = options.longs === String ? String(message.id) : message.id;
|
|
22025
|
+
else
|
|
22026
|
+
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;
|
|
22027
|
+
if (message.keyframe != null && message.hasOwnProperty("keyframe"))
|
|
22028
|
+
object.keyframe = message.keyframe;
|
|
22029
|
+
if (message.codecData != null && message.hasOwnProperty("codecData"))
|
|
22030
|
+
object.codecData = $root.sesame.v1.wire.MediaCodecData.toObject(message.codecData, options);
|
|
22031
|
+
if (message.routingMetadata != null && message.hasOwnProperty("routingMetadata"))
|
|
22032
|
+
object.routingMetadata = message.routingMetadata;
|
|
22033
|
+
return object;
|
|
22034
|
+
};
|
|
22035
|
+
FrameHeader2.prototype.toJSON = function toJSON() {
|
|
22036
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
22037
|
+
};
|
|
22038
|
+
FrameHeader2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
22039
|
+
if (typeUrlPrefix === void 0) {
|
|
22040
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
22041
|
+
}
|
|
22042
|
+
return typeUrlPrefix + "/sesame.v1.wire.FrameHeader";
|
|
22043
|
+
};
|
|
22044
|
+
return FrameHeader2;
|
|
22045
|
+
}();
|
|
22046
|
+
return wire;
|
|
22047
|
+
}();
|
|
21452
22048
|
return v1;
|
|
21453
22049
|
}();
|
|
21454
22050
|
return sesame2;
|
|
@@ -21888,7 +22484,8 @@ var RPCClient = class extends import_events.EventEmitter {
|
|
|
21888
22484
|
eventHandler(event) {
|
|
21889
22485
|
const topic = event.topic ?? 0;
|
|
21890
22486
|
if (topic === sesame.v1.common.EventTopic.EVENT_TOPIC_UNSPECIFIED) {
|
|
21891
|
-
|
|
22487
|
+
log.warn(`Ignoring event with unspecified topic: ${event.topic}`);
|
|
22488
|
+
return;
|
|
21892
22489
|
}
|
|
21893
22490
|
const type = this.eventTypes[topic];
|
|
21894
22491
|
let payload;
|
|
@@ -21914,255 +22511,58 @@ var RPCClient = class extends import_events.EventEmitter {
|
|
|
21914
22511
|
// src/sesame-connection.ts
|
|
21915
22512
|
var import_events2 = __toESM(require_events());
|
|
21916
22513
|
|
|
21917
|
-
// src/sesame-
|
|
21918
|
-
var
|
|
21919
|
-
var
|
|
21920
|
-
var
|
|
21921
|
-
var
|
|
21922
|
-
var
|
|
21923
|
-
var
|
|
21924
|
-
var FLAG_HAS_METADATA = 1 << 1;
|
|
21925
|
-
var FLAG_IS_KEYFRAME = 1 << 2;
|
|
21926
|
-
var PacketType = /* @__PURE__ */ ((PacketType2) => {
|
|
21927
|
-
PacketType2[PacketType2["VIDEO_FRAME"] = 1] = "VIDEO_FRAME";
|
|
21928
|
-
PacketType2[PacketType2["AUDIO_FRAME"] = 2] = "AUDIO_FRAME";
|
|
21929
|
-
PacketType2[PacketType2["RPC"] = 3] = "RPC";
|
|
21930
|
-
PacketType2[PacketType2["MUXED_DATA"] = 4] = "MUXED_DATA";
|
|
21931
|
-
PacketType2[PacketType2["DECODER_DATA"] = 5] = "DECODER_DATA";
|
|
21932
|
-
return PacketType2;
|
|
21933
|
-
})(PacketType || {});
|
|
21934
|
-
var CodecType = /* @__PURE__ */ ((CodecType2) => {
|
|
21935
|
-
CodecType2[CodecType2["VIDEO_VP8"] = 1] = "VIDEO_VP8";
|
|
21936
|
-
CodecType2[CodecType2["VIDEO_VP9"] = 2] = "VIDEO_VP9";
|
|
21937
|
-
CodecType2[CodecType2["VIDEO_AVC"] = 3] = "VIDEO_AVC";
|
|
21938
|
-
CodecType2[CodecType2["VIDEO_HEVC"] = 4] = "VIDEO_HEVC";
|
|
21939
|
-
CodecType2[CodecType2["VIDEO_AV1"] = 5] = "VIDEO_AV1";
|
|
21940
|
-
CodecType2[CodecType2["AUDIO_OPUS"] = 64] = "AUDIO_OPUS";
|
|
21941
|
-
CodecType2[CodecType2["AUDIO_AAC"] = 65] = "AUDIO_AAC";
|
|
21942
|
-
CodecType2[CodecType2["AUDIO_PCM"] = 66] = "AUDIO_PCM";
|
|
21943
|
-
return CodecType2;
|
|
21944
|
-
})(CodecType || {});
|
|
21945
|
-
var SesameBinaryProtocol = class {
|
|
21946
|
-
/**
|
|
21947
|
-
* Initialize a header data structure with proper defaults
|
|
21948
|
-
*/
|
|
21949
|
-
static initHeader(type, flags, pts, id) {
|
|
21950
|
-
return {
|
|
21951
|
-
magic: PROTOCOL_MAGIC,
|
|
21952
|
-
version: PROTOCOL_VERSION,
|
|
21953
|
-
header_size: this.calculateHeaderSize(flags),
|
|
21954
|
-
type,
|
|
21955
|
-
flags,
|
|
21956
|
-
pts,
|
|
21957
|
-
id,
|
|
21958
|
-
reserved: 0
|
|
21959
|
-
// Always zero reserved fields
|
|
21960
|
-
};
|
|
21961
|
-
}
|
|
21962
|
-
/**
|
|
21963
|
-
* Calculate the total header size based on flags
|
|
21964
|
-
*/
|
|
21965
|
-
static calculateHeaderSize(flags) {
|
|
21966
|
-
let size = HEADER_DATA_SIZE;
|
|
21967
|
-
if (flags & FLAG_HAS_METADATA) {
|
|
21968
|
-
size += HEADER_METADATA_SIZE;
|
|
21969
|
-
}
|
|
21970
|
-
if (flags & FLAG_HAS_CODEC_DATA) {
|
|
21971
|
-
size += HEADER_CODEC_DATA_SIZE;
|
|
21972
|
-
}
|
|
21973
|
-
return size;
|
|
21974
|
-
}
|
|
21975
|
-
/**
|
|
21976
|
-
* Validate a header structure
|
|
21977
|
-
*/
|
|
21978
|
-
static validateHeader(header, totalSize) {
|
|
21979
|
-
if (header.magic !== PROTOCOL_MAGIC) {
|
|
21980
|
-
return false;
|
|
21981
|
-
}
|
|
21982
|
-
if (header.version !== PROTOCOL_VERSION) {
|
|
21983
|
-
return false;
|
|
21984
|
-
}
|
|
21985
|
-
const expectedHeaderSize = this.calculateHeaderSize(header.flags);
|
|
21986
|
-
if (header.header_size !== expectedHeaderSize) {
|
|
21987
|
-
return false;
|
|
21988
|
-
}
|
|
21989
|
-
if (totalSize < header.header_size) {
|
|
21990
|
-
return false;
|
|
21991
|
-
}
|
|
21992
|
-
return true;
|
|
21993
|
-
}
|
|
22514
|
+
// src/sesame-wire-protocol.ts
|
|
22515
|
+
var FrameType = sesame.v1.wire.FrameType;
|
|
22516
|
+
var FrameHeader = sesame.v1.wire.FrameHeader;
|
|
22517
|
+
var MediaCodecData = sesame.v1.wire.MediaCodecData;
|
|
22518
|
+
var CodecType = sesame.v1.wire.CodecType;
|
|
22519
|
+
var PREFIX_SIZE = 4;
|
|
22520
|
+
var WireProtocol = class {
|
|
21994
22521
|
/**
|
|
21995
|
-
* Serialize
|
|
22522
|
+
* Serialize a wire frame: 4-byte LE header_size + protobuf FrameHeader + payload.
|
|
21996
22523
|
*/
|
|
21997
|
-
static serialize(header,
|
|
21998
|
-
const
|
|
21999
|
-
const
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
|
|
22003
|
-
|
|
22004
|
-
|
|
22005
|
-
|
|
22006
|
-
|
|
22007
|
-
|
|
22008
|
-
view.setUint32(offset, header.magic, true);
|
|
22009
|
-
offset += 4;
|
|
22010
|
-
view.setUint32(offset, header.flags, true);
|
|
22011
|
-
offset += 4;
|
|
22012
|
-
view.setBigUint64(offset, header.pts, true);
|
|
22013
|
-
offset += 8;
|
|
22014
|
-
view.setBigUint64(offset, header.id, true);
|
|
22015
|
-
offset += 8;
|
|
22016
|
-
view.setUint16(offset, header.version, true);
|
|
22017
|
-
offset += 2;
|
|
22018
|
-
view.setUint16(offset, header.header_size, true);
|
|
22019
|
-
offset += 2;
|
|
22020
|
-
view.setUint16(offset, header.type, true);
|
|
22021
|
-
offset += 2;
|
|
22022
|
-
view.setUint16(offset, header.reserved, true);
|
|
22023
|
-
offset += 2;
|
|
22024
|
-
if (includeMetadata && metadata) {
|
|
22025
|
-
const metadataBytes = this.stringToFixedBytes(metadata.metadata, 64);
|
|
22026
|
-
new Uint8Array(buffer, offset, 64).set(metadataBytes);
|
|
22027
|
-
offset += 64;
|
|
22524
|
+
static serialize(header, payload) {
|
|
22525
|
+
const headerBytes = sesame.v1.wire.FrameHeader.encode(header).finish();
|
|
22526
|
+
const headerSize = headerBytes.length;
|
|
22527
|
+
const payloadSize = payload ? payload.length : 0;
|
|
22528
|
+
const total = PREFIX_SIZE + headerSize + payloadSize;
|
|
22529
|
+
const buffer = new Uint8Array(total);
|
|
22530
|
+
const view = new DataView(buffer.buffer);
|
|
22531
|
+
view.setUint32(0, headerSize, true);
|
|
22532
|
+
buffer.set(headerBytes, PREFIX_SIZE);
|
|
22533
|
+
if (payload && payloadSize > 0) {
|
|
22534
|
+
buffer.set(payload, PREFIX_SIZE + headerSize);
|
|
22028
22535
|
}
|
|
22029
|
-
|
|
22030
|
-
view.setUint32(offset, codecData.sample_rate, true);
|
|
22031
|
-
offset += 4;
|
|
22032
|
-
view.setUint32(offset, codecData.timebase_num, true);
|
|
22033
|
-
offset += 4;
|
|
22034
|
-
view.setUint32(offset, codecData.timebase_den, true);
|
|
22035
|
-
offset += 4;
|
|
22036
|
-
view.setUint16(offset, codecData.codec_profile, true);
|
|
22037
|
-
offset += 2;
|
|
22038
|
-
view.setUint16(offset, codecData.codec_level, true);
|
|
22039
|
-
offset += 2;
|
|
22040
|
-
view.setUint16(offset, codecData.width, true);
|
|
22041
|
-
offset += 2;
|
|
22042
|
-
view.setUint16(offset, codecData.height, true);
|
|
22043
|
-
offset += 2;
|
|
22044
|
-
view.setUint8(offset, codecData.codec_type);
|
|
22045
|
-
offset += 1;
|
|
22046
|
-
view.setUint8(offset, codecData.channels);
|
|
22047
|
-
offset += 1;
|
|
22048
|
-
view.setUint8(offset, codecData.bit_depth);
|
|
22049
|
-
offset += 1;
|
|
22050
|
-
view.setUint8(offset, codecData.reserved);
|
|
22051
|
-
offset += 1;
|
|
22052
|
-
}
|
|
22053
|
-
if (payload && payload.length > 0) {
|
|
22054
|
-
new Uint8Array(buffer, offset).set(payload);
|
|
22055
|
-
}
|
|
22056
|
-
return new Uint8Array(buffer);
|
|
22536
|
+
return buffer;
|
|
22057
22537
|
}
|
|
22058
22538
|
/**
|
|
22059
|
-
* Parse incoming
|
|
22539
|
+
* Parse an incoming wire frame.
|
|
22060
22540
|
*/
|
|
22061
|
-
static
|
|
22062
|
-
const result = {
|
|
22063
|
-
|
|
22064
|
-
|
|
22065
|
-
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
}
|
|
22073
|
-
const view = new DataView(data.buffer, data.byteOffset);
|
|
22074
|
-
let offset = 0;
|
|
22075
|
-
const header = {
|
|
22076
|
-
magic: view.getUint32(offset, true),
|
|
22077
|
-
flags: view.getUint32(offset + 4, true),
|
|
22078
|
-
pts: view.getBigUint64(offset + 8, true),
|
|
22079
|
-
id: view.getBigUint64(offset + 16, true),
|
|
22080
|
-
version: view.getUint16(offset + 24, true),
|
|
22081
|
-
header_size: view.getUint16(offset + 26, true),
|
|
22082
|
-
type: view.getUint16(offset + 28, true),
|
|
22083
|
-
reserved: view.getUint16(offset + 30, true)
|
|
22084
|
-
};
|
|
22085
|
-
offset += HEADER_DATA_SIZE;
|
|
22086
|
-
if (!this.validateHeader(header, data.length)) {
|
|
22087
|
-
return result;
|
|
22088
|
-
}
|
|
22089
|
-
result.header = header;
|
|
22090
|
-
if (header.flags & FLAG_HAS_METADATA) {
|
|
22091
|
-
if (data.length < offset + HEADER_METADATA_SIZE) {
|
|
22092
|
-
return result;
|
|
22093
|
-
}
|
|
22094
|
-
const metadataBytes = data.slice(offset, offset + HEADER_METADATA_SIZE);
|
|
22095
|
-
const metadataStr = this.fixedBytesToString(metadataBytes);
|
|
22096
|
-
result.metadata = { metadata: metadataStr };
|
|
22097
|
-
offset += HEADER_METADATA_SIZE;
|
|
22541
|
+
static parse(data) {
|
|
22542
|
+
const result = { valid: false, header: null, payload: null };
|
|
22543
|
+
if (!data || data.length < PREFIX_SIZE) return result;
|
|
22544
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
22545
|
+
const headerSize = view.getUint32(0, true);
|
|
22546
|
+
if (data.length < PREFIX_SIZE + headerSize) return result;
|
|
22547
|
+
try {
|
|
22548
|
+
const headerBytes = data.subarray(PREFIX_SIZE, PREFIX_SIZE + headerSize);
|
|
22549
|
+
result.header = sesame.v1.wire.FrameHeader.decode(headerBytes);
|
|
22550
|
+
result.payload = data.subarray(PREFIX_SIZE + headerSize);
|
|
22551
|
+
result.valid = true;
|
|
22552
|
+
} catch {
|
|
22098
22553
|
}
|
|
22099
|
-
if (header.flags & FLAG_HAS_CODEC_DATA) {
|
|
22100
|
-
if (data.length < offset + HEADER_CODEC_DATA_SIZE) {
|
|
22101
|
-
return result;
|
|
22102
|
-
}
|
|
22103
|
-
result.codec_data = {
|
|
22104
|
-
sample_rate: view.getUint32(offset, true),
|
|
22105
|
-
timebase_num: view.getUint32(offset + 4, true),
|
|
22106
|
-
timebase_den: view.getUint32(offset + 8, true),
|
|
22107
|
-
codec_profile: view.getUint16(offset + 12, true),
|
|
22108
|
-
codec_level: view.getUint16(offset + 14, true),
|
|
22109
|
-
width: view.getUint16(offset + 16, true),
|
|
22110
|
-
height: view.getUint16(offset + 18, true),
|
|
22111
|
-
codec_type: view.getUint8(offset + 20),
|
|
22112
|
-
channels: view.getUint8(offset + 21),
|
|
22113
|
-
bit_depth: view.getUint8(offset + 22),
|
|
22114
|
-
reserved: view.getUint8(offset + 23)
|
|
22115
|
-
};
|
|
22116
|
-
offset += HEADER_CODEC_DATA_SIZE;
|
|
22117
|
-
}
|
|
22118
|
-
if (offset < data.length) {
|
|
22119
|
-
result.payload = data.slice(offset);
|
|
22120
|
-
result.payload_size = result.payload.length;
|
|
22121
|
-
} else {
|
|
22122
|
-
result.payload = new Uint8Array(0);
|
|
22123
|
-
result.payload_size = 0;
|
|
22124
|
-
}
|
|
22125
|
-
result.valid = true;
|
|
22126
22554
|
return result;
|
|
22127
22555
|
}
|
|
22128
|
-
/**
|
|
22129
|
-
* Helper: Convert string to fixed-size byte array (null-terminated)
|
|
22130
|
-
*/
|
|
22131
|
-
static stringToFixedBytes(str, size) {
|
|
22132
|
-
const bytes = new Uint8Array(size);
|
|
22133
|
-
let encoded;
|
|
22134
|
-
if (typeof TextEncoder !== "undefined") {
|
|
22135
|
-
const encoder = new TextEncoder();
|
|
22136
|
-
encoded = encoder.encode(str);
|
|
22137
|
-
} else {
|
|
22138
|
-
encoded = new Uint8Array(Buffer.from(str, "utf8"));
|
|
22139
|
-
}
|
|
22140
|
-
const copyLen = Math.min(encoded.length, size - 1);
|
|
22141
|
-
bytes.set(encoded.slice(0, copyLen));
|
|
22142
|
-
bytes[copyLen] = 0;
|
|
22143
|
-
return bytes;
|
|
22144
|
-
}
|
|
22145
|
-
/**
|
|
22146
|
-
* Helper: Convert fixed-size byte array to string (null-terminated)
|
|
22147
|
-
*/
|
|
22148
|
-
static fixedBytesToString(bytes) {
|
|
22149
|
-
let len = bytes.length;
|
|
22150
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
22151
|
-
if (bytes[i] === 0) {
|
|
22152
|
-
len = i;
|
|
22153
|
-
break;
|
|
22154
|
-
}
|
|
22155
|
-
}
|
|
22156
|
-
if (typeof TextDecoder !== "undefined") {
|
|
22157
|
-
const decoder = new TextDecoder();
|
|
22158
|
-
return decoder.decode(bytes.slice(0, len));
|
|
22159
|
-
} else {
|
|
22160
|
-
return Buffer.from(bytes.slice(0, len)).toString("utf8");
|
|
22161
|
-
}
|
|
22162
|
-
}
|
|
22163
22556
|
};
|
|
22164
22557
|
|
|
22165
22558
|
// src/sesame-connection.ts
|
|
22559
|
+
var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
|
|
22560
|
+
ConnectionState2["Disconnected"] = "disconnected";
|
|
22561
|
+
ConnectionState2["Connecting"] = "connecting";
|
|
22562
|
+
ConnectionState2["Connected"] = "connected";
|
|
22563
|
+
ConnectionState2["Reconnecting"] = "reconnecting";
|
|
22564
|
+
return ConnectionState2;
|
|
22565
|
+
})(ConnectionState || {});
|
|
22166
22566
|
function waitForEvent(emitter, eventName) {
|
|
22167
22567
|
return new Promise((resolve) => {
|
|
22168
22568
|
emitter.once(eventName, resolve);
|
|
@@ -22175,6 +22575,7 @@ var SesameConnection = class extends import_events2.EventEmitter {
|
|
|
22175
22575
|
this.numRetries = 0;
|
|
22176
22576
|
this.url = "";
|
|
22177
22577
|
this.autoReconnect = true;
|
|
22578
|
+
this._state = "disconnected" /* Disconnected */;
|
|
22178
22579
|
/* Bound listeners so we can removeEventListener later */
|
|
22179
22580
|
this.boundMessageHandler = (event) => this.messageHandler(event);
|
|
22180
22581
|
this.boundOpenHandler = () => this.openHandler();
|
|
@@ -22182,38 +22583,68 @@ var SesameConnection = class extends import_events2.EventEmitter {
|
|
|
22182
22583
|
this.boundErrorHandler = (event) => this.errorHandler(event);
|
|
22183
22584
|
this.openHandler = () => {
|
|
22184
22585
|
this.numRetries = 0;
|
|
22586
|
+
this.setState("connected" /* Connected */);
|
|
22185
22587
|
this.emit("open");
|
|
22186
22588
|
};
|
|
22187
22589
|
this.messageHandler = (event) => {
|
|
22188
22590
|
if (event.data instanceof ArrayBuffer) {
|
|
22189
|
-
const parsed =
|
|
22190
|
-
if (!parsed.valid)
|
|
22191
|
-
|
|
22192
|
-
|
|
22193
|
-
}
|
|
22194
|
-
|
|
22195
|
-
|
|
22591
|
+
const parsed = WireProtocol.parse(new Uint8Array(event.data));
|
|
22592
|
+
if (!parsed.valid) {
|
|
22593
|
+
this.emit("error", new Error("Invalid packet received"));
|
|
22594
|
+
return;
|
|
22595
|
+
}
|
|
22596
|
+
const frameType = parsed.header?.type;
|
|
22597
|
+
if (frameType === FrameType.FRAME_TYPE_RPC) {
|
|
22196
22598
|
this.emit("rpc", parsed.payload);
|
|
22599
|
+
} else {
|
|
22600
|
+
this.emit("media-packet", parsed);
|
|
22197
22601
|
}
|
|
22198
22602
|
}
|
|
22199
22603
|
};
|
|
22200
22604
|
this.url = options.url;
|
|
22201
22605
|
this.autoReconnect = options.autoReconnect;
|
|
22202
|
-
if (options.autoConnect) this.connect().catch(() =>
|
|
22606
|
+
if (options.autoConnect) this.connect().catch(() => {
|
|
22607
|
+
});
|
|
22608
|
+
}
|
|
22609
|
+
get state() {
|
|
22610
|
+
return this._state;
|
|
22611
|
+
}
|
|
22612
|
+
setState(newState) {
|
|
22613
|
+
if (this._state === newState) return;
|
|
22614
|
+
const prev = this._state;
|
|
22615
|
+
this._state = newState;
|
|
22616
|
+
switch (newState) {
|
|
22617
|
+
case "connected" /* Connected */:
|
|
22618
|
+
log.info("Connected to Sesame");
|
|
22619
|
+
break;
|
|
22620
|
+
case "reconnecting" /* Reconnecting */:
|
|
22621
|
+
if (prev === "connected" /* Connected */) {
|
|
22622
|
+
log.warn("Lost connection to Sesame, will try reconnect..");
|
|
22623
|
+
} else {
|
|
22624
|
+
log.warn("Failed to connect to Sesame, will try reconnect..");
|
|
22625
|
+
}
|
|
22626
|
+
break;
|
|
22627
|
+
case "disconnected" /* Disconnected */:
|
|
22628
|
+
log.info("Disconnected from Sesame");
|
|
22629
|
+
break;
|
|
22630
|
+
}
|
|
22631
|
+
this.emit("state", newState, prev);
|
|
22203
22632
|
}
|
|
22204
22633
|
isConnected() {
|
|
22205
22634
|
return this.socket !== void 0 && this.socket.readyState === WebSocket.OPEN;
|
|
22206
22635
|
}
|
|
22207
22636
|
async send(data) {
|
|
22208
22637
|
if (!this.isConnected()) throw new Error("Not connected");
|
|
22209
|
-
const header =
|
|
22210
|
-
const
|
|
22211
|
-
|
|
22212
|
-
this.socket.send(data_to_send);
|
|
22638
|
+
const header = { type: sesame.v1.wire.FrameType.FRAME_TYPE_RPC };
|
|
22639
|
+
const frame = WireProtocol.serialize(header, data);
|
|
22640
|
+
this.socket.send(frame);
|
|
22213
22641
|
return Promise.resolve();
|
|
22214
22642
|
}
|
|
22215
22643
|
async connect() {
|
|
22216
22644
|
this.active = true;
|
|
22645
|
+
if (this._state === "disconnected" /* Disconnected */) {
|
|
22646
|
+
this.setState("connecting" /* Connecting */);
|
|
22647
|
+
}
|
|
22217
22648
|
this.socket = new WebSocket(this.url);
|
|
22218
22649
|
this.socket.addEventListener("message", this.boundMessageHandler);
|
|
22219
22650
|
this.socket.addEventListener("open", this.boundOpenHandler);
|
|
@@ -22236,6 +22667,7 @@ var SesameConnection = class extends import_events2.EventEmitter {
|
|
|
22236
22667
|
async disconnect() {
|
|
22237
22668
|
this.active = false;
|
|
22238
22669
|
if (!this.socket) {
|
|
22670
|
+
this.setState("disconnected" /* Disconnected */);
|
|
22239
22671
|
return;
|
|
22240
22672
|
}
|
|
22241
22673
|
const sock = this.socket;
|
|
@@ -22253,7 +22685,8 @@ var SesameConnection = class extends import_events2.EventEmitter {
|
|
|
22253
22685
|
}
|
|
22254
22686
|
retryHandler() {
|
|
22255
22687
|
if (this.active && this.autoReconnect) {
|
|
22256
|
-
this.connect().catch((
|
|
22688
|
+
this.connect().catch(() => {
|
|
22689
|
+
});
|
|
22257
22690
|
}
|
|
22258
22691
|
}
|
|
22259
22692
|
closeHandler() {
|
|
@@ -22263,13 +22696,17 @@ var SesameConnection = class extends import_events2.EventEmitter {
|
|
|
22263
22696
|
}
|
|
22264
22697
|
this.socket = void 0;
|
|
22265
22698
|
if (this.active) {
|
|
22266
|
-
|
|
22699
|
+
if (this.autoReconnect) {
|
|
22700
|
+
this.setState("reconnecting" /* Reconnecting */);
|
|
22267
22701
|
setTimeout(() => {
|
|
22268
22702
|
this.retryHandler();
|
|
22269
22703
|
}, defaultBackoff(++this.numRetries));
|
|
22270
|
-
}
|
|
22271
|
-
|
|
22704
|
+
} else {
|
|
22705
|
+
this.active = false;
|
|
22706
|
+
this.setState("disconnected" /* Disconnected */);
|
|
22272
22707
|
}
|
|
22708
|
+
} else {
|
|
22709
|
+
this.setState("disconnected" /* Disconnected */);
|
|
22273
22710
|
}
|
|
22274
22711
|
}
|
|
22275
22712
|
errorHandler(error) {
|
|
@@ -22295,9 +22732,6 @@ var StatusApi = class {
|
|
|
22295
22732
|
async getIODevices() {
|
|
22296
22733
|
return this.rpc.service.requestIODeviceList(new sesame.v1.common.Empty());
|
|
22297
22734
|
}
|
|
22298
|
-
async requestKeyframe(outputId) {
|
|
22299
|
-
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
22300
|
-
}
|
|
22301
22735
|
};
|
|
22302
22736
|
|
|
22303
22737
|
// src/recorder-api.ts
|
|
@@ -22446,10 +22880,7 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22446
22880
|
constructor(portOrUrl) {
|
|
22447
22881
|
super();
|
|
22448
22882
|
this.subscriptions = [];
|
|
22449
|
-
this.
|
|
22450
|
-
this.onVideoPacket = () => {
|
|
22451
|
-
};
|
|
22452
|
-
this.onAudioPacket = () => {
|
|
22883
|
+
this.onMediaPacket = () => {
|
|
22453
22884
|
};
|
|
22454
22885
|
this.onCallbackMessage = () => {
|
|
22455
22886
|
};
|
|
@@ -22460,10 +22891,6 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22460
22891
|
autoReconnect: true
|
|
22461
22892
|
});
|
|
22462
22893
|
this.conn.on("error", () => {
|
|
22463
|
-
if (!this.errorIsLogged) {
|
|
22464
|
-
log.warn("Could not connect to Sesame Engine, will keep trying..");
|
|
22465
|
-
this.errorIsLogged = true;
|
|
22466
|
-
}
|
|
22467
22894
|
});
|
|
22468
22895
|
let events = {
|
|
22469
22896
|
[sesame.v1.common.EventTopic.EVENT_TOPIC_ERROR]: sesame.v1.status.Event,
|
|
@@ -22488,18 +22915,18 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22488
22915
|
}
|
|
22489
22916
|
});
|
|
22490
22917
|
this.rpc.on("error", (err) => {
|
|
22491
|
-
|
|
22918
|
+
if (this.isConnected()) {
|
|
22919
|
+
log.error(`RPC error: ${err.message}`);
|
|
22920
|
+
}
|
|
22492
22921
|
});
|
|
22493
22922
|
this.conn.on("open", async () => {
|
|
22494
22923
|
this.sendSubscriptions();
|
|
22495
|
-
this.errorIsLogged = false;
|
|
22496
22924
|
this.emit("connected");
|
|
22497
22925
|
});
|
|
22498
22926
|
this.conn.on("close", () => {
|
|
22499
22927
|
this.emit("disconnected");
|
|
22500
22928
|
});
|
|
22501
|
-
this.conn.on("
|
|
22502
|
-
this.conn.on("audio-packet", (data) => this.onAudioPacket(this.videoSubscriptionId, data));
|
|
22929
|
+
this.conn.on("media-packet", (frame) => this.onMediaPacket(this.mediaSubscriptionId, frame));
|
|
22503
22930
|
this.subscriptions = [];
|
|
22504
22931
|
}
|
|
22505
22932
|
isConnected() {
|
|
@@ -22509,14 +22936,14 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22509
22936
|
if (!this.isConnected()) return;
|
|
22510
22937
|
const eventTopics = this.subscriptions.map((subscription) => subscription.topic);
|
|
22511
22938
|
const channels = [];
|
|
22512
|
-
if (this.
|
|
22939
|
+
if (this.mediaSubscriptionId) channels.push(`media-stream/${this.mediaSubscriptionId}`);
|
|
22513
22940
|
let subs = { eventTopics, channels };
|
|
22514
22941
|
this.rpc.service.updateSubscriptions(subs).catch((err) => {
|
|
22515
22942
|
log.error(`Failed to update subscriptions: ${err.message}`);
|
|
22516
22943
|
});
|
|
22517
22944
|
}
|
|
22518
|
-
|
|
22519
|
-
this.
|
|
22945
|
+
addMediaSubscription(id) {
|
|
22946
|
+
this.mediaSubscriptionId = id;
|
|
22520
22947
|
this.sendSubscriptions();
|
|
22521
22948
|
}
|
|
22522
22949
|
addSubscription(topic, callback) {
|
|
@@ -22535,6 +22962,9 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22535
22962
|
getService() {
|
|
22536
22963
|
return this.rpc;
|
|
22537
22964
|
}
|
|
22965
|
+
async requestKeyframe(outputId) {
|
|
22966
|
+
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
22967
|
+
}
|
|
22538
22968
|
async execute(cl) {
|
|
22539
22969
|
cl.filterCreatedAndDestroyedSources();
|
|
22540
22970
|
if (cl.getCommandListMsg().commandList.length > 0) {
|
|
@@ -22554,19 +22984,21 @@ var Event = sesame.v1.rpc.Event;
|
|
|
22554
22984
|
export {
|
|
22555
22985
|
CodecType,
|
|
22556
22986
|
CommandList,
|
|
22987
|
+
ConnectionState,
|
|
22557
22988
|
EaseKind,
|
|
22558
22989
|
Event,
|
|
22990
|
+
FrameHeader,
|
|
22991
|
+
FrameType,
|
|
22559
22992
|
JobsApi,
|
|
22560
22993
|
Message,
|
|
22561
|
-
PacketType,
|
|
22562
22994
|
RPCClient,
|
|
22563
22995
|
RecorderApi,
|
|
22564
22996
|
Request,
|
|
22565
22997
|
Response,
|
|
22566
|
-
SesameBinaryProtocol,
|
|
22567
22998
|
SesameClient,
|
|
22568
22999
|
SesameConnection,
|
|
22569
23000
|
StatusApi,
|
|
23001
|
+
WireProtocol,
|
|
22570
23002
|
getLogger,
|
|
22571
23003
|
log,
|
|
22572
23004
|
sesame,
|