@moqtap/codec 0.9.0 → 0.11.0
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/CHANGELOG.md +173 -0
- package/dist/auth-redaction-DsdLq4Qs.d.cts +102 -0
- package/dist/auth-redaction-DsdLq4Qs.d.ts +102 -0
- package/dist/{chunk-PU2KV7VP.cjs → chunk-27K5BUAG.cjs} +485 -515
- package/dist/{chunk-BV6MITLO.js → chunk-3RNQMGKA.js} +365 -390
- package/dist/{chunk-2XH6PHXR.js → chunk-5AWIXOLB.js} +442 -467
- package/dist/{chunk-4XLYCT5Q.cjs → chunk-5IMHJIAZ.cjs} +52 -2
- package/dist/{chunk-TVSFDQYE.cjs → chunk-5JGZCKJO.cjs} +513 -531
- package/dist/{chunk-IADVBKEJ.cjs → chunk-73K4OSAN.cjs} +407 -432
- package/dist/{chunk-N2V7Z37J.js → chunk-7VQKRGRD.js} +19 -3
- package/dist/{chunk-UZO5Z2XT.cjs → chunk-A3UCQOIB.cjs} +490 -515
- package/dist/{chunk-JKMYAUGY.js → chunk-A7PDMVXM.js} +35 -11
- package/dist/{chunk-VZHL2U2N.cjs → chunk-A7VQO6YC.cjs} +54 -38
- package/dist/{chunk-KCH4BQXK.cjs → chunk-ACQHZLRZ.cjs} +73 -47
- package/dist/{chunk-H6DTAIWM.js → chunk-BBICOMW6.js} +47 -19
- package/dist/{chunk-MAXEHYVB.cjs → chunk-BNIUVOCJ.cjs} +554 -612
- package/dist/{chunk-QGIHC6BA.cjs → chunk-CNC6ANS4.cjs} +70 -46
- package/dist/{chunk-NH4L6NIY.js → chunk-FDLQSWHK.js} +437 -467
- package/dist/{chunk-IJAF6PAY.js → chunk-FFNOE4UR.js} +19 -3
- package/dist/{chunk-CZNW3R5E.cjs → chunk-GMENT63T.cjs} +54 -38
- package/dist/{chunk-7ENEWAMZ.cjs → chunk-HM7BLRVP.cjs} +305 -305
- package/dist/{chunk-XHAP2YST.js → chunk-HZONHFNO.js} +19 -3
- package/dist/{chunk-EVCPBFSR.cjs → chunk-ILYABWDK.cjs} +83 -55
- package/dist/{chunk-IDV2JYJ6.cjs → chunk-KRSFTZVO.cjs} +56 -40
- package/dist/{chunk-RIIA4ALQ.cjs → chunk-KSPH6KMH.cjs} +54 -38
- package/dist/{chunk-UA5XFP4O.cjs → chunk-KTY4LAUV.cjs} +485 -494
- package/dist/{chunk-RZTLQAKF.js → chunk-OJNLJT5D.js} +0 -1
- package/dist/{chunk-YJGOD3Y4.js → chunk-PJK2ZS3I.js} +492 -550
- package/dist/{chunk-TMXRYOBS.js → chunk-PSMZKHOC.js} +444 -453
- package/dist/{chunk-7RE6KSIY.cjs → chunk-Q5JQGHWY.cjs} +0 -1
- package/dist/{chunk-23KRITJ6.js → chunk-SQTUQY5E.js} +37 -11
- package/dist/{chunk-XQGEOFGE.js → chunk-WCRLAKDW.js} +253 -253
- package/dist/{chunk-KYVTM5VI.js → chunk-WL2YUEXH.js} +19 -3
- package/dist/{chunk-Q7NSUXXB.js → chunk-YCNIVZS7.js} +464 -482
- package/dist/{chunk-KLPWJU6W.js → chunk-YRZQVNZO.js} +50 -0
- package/dist/{codec-Bym-K2q2.d.cts → codec-76xzrLTL.d.cts} +21 -2
- package/dist/{codec-BKsVu3Fr.d.ts → codec-8p40WdLg.d.ts} +21 -2
- package/dist/{codec-Dl_QIXMz.d.ts → codec-BN2Bu0KI.d.ts} +20 -1
- package/dist/{codec-D4RvFQmu.d.ts → codec-Bb6GKTrv.d.ts} +21 -2
- package/dist/{codec-DAyiF5sq.d.cts → codec-BgpfHoAd.d.cts} +21 -2
- package/dist/{codec-CA6nbbEk.d.ts → codec-BkheTXO7.d.ts} +21 -2
- package/dist/{codec-DchsPfr3.d.cts → codec-BwVDkokh.d.cts} +21 -2
- package/dist/{codec-CgZdadPt.d.cts → codec-C5s1eBJX.d.cts} +21 -2
- package/dist/codec-CM5yd6n3.d.ts +38 -0
- package/dist/{codec-DJmqoIsp.d.cts → codec-Cb8HC3XV.d.cts} +21 -2
- package/dist/codec-Clu_skx8.d.cts +38 -0
- package/dist/{codec-DzkdW4kO.d.cts → codec-CpOpemR8.d.cts} +20 -1
- package/dist/{codec-CXCjya_G.d.cts → codec-Cshdl9Tt.d.cts} +20 -1
- package/dist/{codec-CSBFdPgP.d.cts → codec-DELe00w_.d.cts} +21 -2
- package/dist/{codec-C_xxsbKy.d.cts → codec-DHzKAUCa.d.cts} +21 -2
- package/dist/{codec--CVeqGQv.d.ts → codec-DdVBtvx7.d.ts} +20 -1
- package/dist/{codec-CviAa4lp.d.ts → codec-DlxGuYMv.d.ts} +21 -2
- package/dist/{codec-BNy5syCU.d.ts → codec-DxtgPxJS.d.ts} +20 -1
- package/dist/{codec-CtvFK4aV.d.cts → codec-GAY4lybi.d.cts} +21 -2
- package/dist/{codec-Cfo_z5ET.d.cts → codec-I8u2pfS4.d.cts} +20 -1
- package/dist/{codec-vddqy0KY.d.cts → codec-XLrnreeu.d.cts} +21 -2
- package/dist/{codec-O-1Js7h4.d.ts → codec-c0YEwwWn.d.ts} +21 -2
- package/dist/{codec-Cl73EfRW.d.ts → codec-ejDu-va6.d.ts} +21 -2
- package/dist/{codec-C006F75E.d.ts → codec-kaBUzdpV.d.ts} +21 -2
- package/dist/{codec-C5evFHL-.d.ts → codec-mVYqkIUF.d.ts} +21 -2
- package/dist/{codec-BMwgZIgG.d.ts → codec-qSbO5nOa.d.ts} +21 -2
- package/dist/{codec-BQa6Qsav.d.ts → codec-yYKGOipj.d.ts} +21 -2
- package/dist/{codec-DzLvG8Wb.d.cts → codec-zfzg9uiy.d.cts} +21 -2
- package/dist/draft07.cjs +48 -4
- package/dist/draft07.d.cts +42 -2
- package/dist/draft07.d.ts +42 -2
- package/dist/draft07.js +49 -5
- package/dist/draft08.cjs +76 -3
- package/dist/draft08.d.cts +70 -2
- package/dist/draft08.d.ts +70 -2
- package/dist/draft08.js +77 -4
- package/dist/draft09.cjs +76 -3
- package/dist/draft09.d.cts +70 -2
- package/dist/draft09.d.ts +70 -2
- package/dist/draft09.js +77 -4
- package/dist/draft10.cjs +76 -3
- package/dist/draft10.d.cts +70 -2
- package/dist/draft10.d.ts +70 -2
- package/dist/draft10.js +77 -4
- package/dist/draft11-session.d.cts +1 -1
- package/dist/draft11-session.d.ts +1 -1
- package/dist/draft11.cjs +104 -3
- package/dist/draft11.d.cts +100 -4
- package/dist/draft11.d.ts +100 -4
- package/dist/draft11.js +105 -4
- package/dist/draft12-session.d.cts +1 -1
- package/dist/draft12-session.d.ts +1 -1
- package/dist/draft12.cjs +113 -3
- package/dist/draft12.d.cts +109 -4
- package/dist/draft12.d.ts +109 -4
- package/dist/draft12.js +114 -4
- package/dist/draft13-session.d.cts +1 -1
- package/dist/draft13-session.d.ts +1 -1
- package/dist/draft13.cjs +105 -3
- package/dist/draft13.d.cts +101 -4
- package/dist/draft13.d.ts +101 -4
- package/dist/draft13.js +106 -4
- package/dist/draft14-session.d.cts +1 -1
- package/dist/draft14-session.d.ts +1 -1
- package/dist/draft14.cjs +107 -3
- package/dist/draft14.d.cts +103 -30
- package/dist/draft14.d.ts +103 -30
- package/dist/draft14.js +108 -4
- package/dist/draft15-session.d.cts +1 -1
- package/dist/draft15-session.d.ts +1 -1
- package/dist/draft15.cjs +69 -3
- package/dist/draft15.d.cts +65 -22
- package/dist/draft15.d.ts +65 -22
- package/dist/draft15.js +70 -4
- package/dist/draft16-session.cjs +2 -2
- package/dist/draft16-session.d.cts +1 -1
- package/dist/draft16-session.d.ts +1 -1
- package/dist/draft16-session.js +1 -1
- package/dist/draft16.cjs +76 -8
- package/dist/draft16.d.cts +67 -13
- package/dist/draft16.d.ts +67 -13
- package/dist/draft16.js +73 -5
- package/dist/draft17-session.d.cts +1 -1
- package/dist/draft17-session.d.ts +1 -1
- package/dist/draft17.cjs +77 -3
- package/dist/draft17.d.cts +73 -4
- package/dist/draft17.d.ts +73 -4
- package/dist/draft17.js +78 -4
- package/dist/draft18-session.d.cts +1 -1
- package/dist/draft18-session.d.ts +1 -1
- package/dist/draft18.cjs +8 -3
- package/dist/draft18.d.cts +4 -3
- package/dist/draft18.d.ts +4 -3
- package/dist/draft18.js +9 -4
- package/dist/draft19-session.d.cts +1 -1
- package/dist/draft19-session.d.ts +1 -1
- package/dist/draft19.cjs +11 -4
- package/dist/draft19.d.cts +4 -3
- package/dist/draft19.d.ts +4 -3
- package/dist/draft19.js +12 -5
- package/dist/draft20-session.d.cts +1 -1
- package/dist/draft20-session.d.ts +1 -1
- package/dist/draft20.cjs +8 -3
- package/dist/draft20.d.cts +4 -3
- package/dist/draft20.d.ts +4 -3
- package/dist/draft20.js +9 -4
- package/dist/index.cjs +30 -30
- package/dist/index.d.cts +25 -24
- package/dist/index.d.ts +25 -24
- package/dist/index.js +15 -15
- package/dist/session.cjs +2 -2
- package/dist/session.d.cts +10 -10
- package/dist/session.d.ts +10 -10
- package/dist/session.js +1 -1
- package/dist/{types-zHgCS6o5.d.cts → types-Btp416jt.d.cts} +15 -7
- package/dist/{types-zHgCS6o5.d.ts → types-Btp416jt.d.ts} +15 -7
- package/dist/{types-Cm9fjeYC.d.cts → types-BxTL1NXw.d.cts} +9 -2
- package/dist/{types-Cm9fjeYC.d.ts → types-BxTL1NXw.d.ts} +9 -2
- package/dist/{types-Bio-91Rt.d.cts → types-CI_SX4Xe.d.cts} +2 -2
- package/dist/{types-Bio-91Rt.d.ts → types-CI_SX4Xe.d.ts} +2 -2
- package/dist/{types-HI_bbXka.d.cts → types-CmqT0jUf.d.cts} +1 -1
- package/dist/{types-HI_bbXka.d.ts → types-CmqT0jUf.d.ts} +1 -1
- package/dist/{types-CPaYBsMG.d.cts → types-CuibHYcf.d.cts} +9 -2
- package/dist/{types-CPaYBsMG.d.ts → types-CuibHYcf.d.ts} +9 -2
- package/dist/{types-CWCQwuvy.d.cts → types-CwN7AEoL.d.cts} +24 -12
- package/dist/{types-CWCQwuvy.d.ts → types-CwN7AEoL.d.ts} +24 -12
- package/dist/{types-Ck45Ex5S.d.cts → types-D0kTgUuL.d.cts} +1 -1
- package/dist/{types-Ck45Ex5S.d.ts → types-D0kTgUuL.d.ts} +1 -1
- package/dist/{types-D9eiB_9A.d.cts → types-DAnalt5K.d.cts} +9 -2
- package/dist/{types-D9eiB_9A.d.ts → types-DAnalt5K.d.ts} +9 -2
- package/dist/{types-CXlSn0I9.d.cts → types-DjxexghA.d.cts} +2 -2
- package/dist/{types-CXlSn0I9.d.ts → types-DjxexghA.d.ts} +2 -2
- package/dist/{types-Cqp10JtB.d.cts → types-DxXNP32l.d.cts} +10 -2
- package/dist/{types-Cqp10JtB.d.ts → types-DxXNP32l.d.ts} +10 -2
- package/package.json +3 -3
- package/src/core/auth-redaction.ts +192 -0
- package/src/drafts/draft07/codec.ts +40 -0
- package/src/drafts/draft07/error-codes.ts +44 -0
- package/src/drafts/draft07/index.ts +15 -0
- package/src/drafts/draft08/codec.ts +40 -0
- package/src/drafts/draft08/error-codes.ts +76 -0
- package/src/drafts/draft08/index.ts +21 -0
- package/src/drafts/draft09/codec.ts +40 -0
- package/src/drafts/draft09/error-codes.ts +76 -0
- package/src/drafts/draft09/index.ts +21 -0
- package/src/drafts/draft10/codec.ts +40 -0
- package/src/drafts/draft10/error-codes.ts +76 -0
- package/src/drafts/draft10/index.ts +21 -0
- package/src/drafts/draft11/codec.ts +71 -8
- package/src/drafts/draft11/error-codes.ts +106 -0
- package/src/drafts/draft11/index.ts +23 -0
- package/src/drafts/draft11/types.ts +1 -1
- package/src/drafts/draft12/codec.ts +83 -16
- package/src/drafts/draft12/error-codes.ts +116 -0
- package/src/drafts/draft12/index.ts +25 -0
- package/src/drafts/draft12/types.ts +2 -2
- package/src/drafts/draft13/codec.ts +75 -11
- package/src/drafts/draft13/error-codes.ts +107 -0
- package/src/drafts/draft13/index.ts +23 -0
- package/src/drafts/draft13/types.ts +3 -3
- package/src/drafts/draft14/codec.ts +79 -12
- package/src/drafts/draft14/data-streams.ts +331 -259
- package/src/drafts/draft14/error-codes.ts +109 -0
- package/src/drafts/draft14/index.ts +23 -0
- package/src/drafts/draft14/types.ts +1 -1
- package/src/drafts/draft15/codec.ts +71 -8
- package/src/drafts/draft15/data-streams.ts +489 -444
- package/src/drafts/draft15/error-codes.ts +66 -0
- package/src/drafts/draft15/index.ts +15 -0
- package/src/drafts/draft15/types.ts +9 -2
- package/src/drafts/draft16/codec.ts +149 -49
- package/src/drafts/draft16/data-streams.ts +513 -442
- package/src/drafts/draft16/error-codes.ts +68 -0
- package/src/drafts/draft16/index.ts +15 -0
- package/src/drafts/draft16/messages.ts +4 -4
- package/src/drafts/draft16/session-fsm.ts +0 -1
- package/src/drafts/draft16/types.ts +24 -10
- package/src/drafts/draft17/codec.ts +77 -10
- package/src/drafts/draft17/data-streams.ts +567 -488
- package/src/drafts/draft17/index.ts +15 -0
- package/src/drafts/draft17/types.ts +9 -2
- package/src/drafts/draft18/codec.ts +70 -7
- package/src/drafts/draft18/data-streams.ts +570 -482
- package/src/drafts/draft18/index.ts +3 -0
- package/src/drafts/draft18/types.ts +18 -10
- package/src/drafts/draft19/codec.ts +95 -23
- package/src/drafts/draft19/data-streams.ts +570 -482
- package/src/drafts/draft19/error-codes.ts +3 -1
- package/src/drafts/draft19/index.ts +3 -0
- package/src/drafts/draft19/messages.ts +3 -1
- package/src/drafts/draft19/types.ts +32 -18
- package/src/drafts/draft20/codec.ts +115 -36
- package/src/drafts/draft20/data-streams.ts +610 -563
- package/src/drafts/draft20/index.ts +3 -0
- package/src/drafts/draft20/types.ts +31 -13
- package/dist/codec-BJ7BHuiZ.d.ts +0 -18
- package/dist/codec-C6Mx4bwz.d.cts +0 -18
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk5IMHJIAZcjs = require('./chunk-5IMHJIAZ.cjs');
|
|
8
10
|
|
|
9
11
|
// src/drafts/draft18/messages.ts
|
|
10
12
|
var MSG_REQUEST_UPDATE = 0x02n;
|
|
@@ -108,7 +110,7 @@ function isValidSubgroupType(streamType) {
|
|
|
108
110
|
return (streamType & 6) !== 6;
|
|
109
111
|
}
|
|
110
112
|
function encodeSubgroupStream(stream) {
|
|
111
|
-
const w = new (0,
|
|
113
|
+
const w = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
|
|
112
114
|
const streamType = stream.headerType;
|
|
113
115
|
w.writeUint8(streamType);
|
|
114
116
|
const propertiesPresent = (streamType & 1) !== 0;
|
|
@@ -129,7 +131,7 @@ function encodeSubgroupStream(stream) {
|
|
|
129
131
|
w.writeVarInt(delta);
|
|
130
132
|
if (propertiesPresent) {
|
|
131
133
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
132
|
-
const tmpW = new (0,
|
|
134
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
|
|
133
135
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
134
136
|
const raw = tmpW.finish();
|
|
135
137
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -149,7 +151,7 @@ function encodeSubgroupStream(stream) {
|
|
|
149
151
|
return w.finish();
|
|
150
152
|
}
|
|
151
153
|
function encodeDatagram(dg) {
|
|
152
|
-
const w = new (0,
|
|
154
|
+
const w = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
|
|
153
155
|
const dgType = dg.datagramType;
|
|
154
156
|
w.writeUint8(dgType);
|
|
155
157
|
w.writeVarInt(dg.trackAlias);
|
|
@@ -166,7 +168,7 @@ function encodeDatagram(dg) {
|
|
|
166
168
|
}
|
|
167
169
|
if (propertiesPresent) {
|
|
168
170
|
if (dg.objectProperties && Object.keys(dg.objectProperties).length > 0) {
|
|
169
|
-
const tmpW = new (0,
|
|
171
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
|
|
170
172
|
encodeObjectProperties(dg.objectProperties, tmpW);
|
|
171
173
|
const raw = tmpW.finish();
|
|
172
174
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -183,7 +185,7 @@ function encodeDatagram(dg) {
|
|
|
183
185
|
return w.finish();
|
|
184
186
|
}
|
|
185
187
|
function encodeFetchStream(stream) {
|
|
186
|
-
const w = new (0,
|
|
188
|
+
const w = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
|
|
187
189
|
w.writeVarInt(FETCH_STREAM_TYPE);
|
|
188
190
|
w.writeVarInt(stream.requestId);
|
|
189
191
|
let prevGroupId = 0n;
|
|
@@ -205,7 +207,7 @@ function encodeFetchStream(stream) {
|
|
|
205
207
|
if (flags & 16) w.writeUint8(obj.publisherPriority);
|
|
206
208
|
if (flags & 32) {
|
|
207
209
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
208
|
-
const tmpW = new (0,
|
|
210
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
|
|
209
211
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
210
212
|
const raw = tmpW.finish();
|
|
211
213
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -229,7 +231,7 @@ function encodeFetchStream(stream) {
|
|
|
229
231
|
if (flags & 16) w.writeUint8(obj.publisherPriority);
|
|
230
232
|
if (flags & 32) {
|
|
231
233
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
232
|
-
const tmpW = new (0,
|
|
234
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
|
|
233
235
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
234
236
|
const raw = tmpW.finish();
|
|
235
237
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -250,112 +252,121 @@ function encodeFetchStream(stream) {
|
|
|
250
252
|
void prevObjectId;
|
|
251
253
|
return w.finish();
|
|
252
254
|
}
|
|
255
|
+
function readSubgroupHeader(r) {
|
|
256
|
+
const streamType = r.readUint8();
|
|
257
|
+
if (!isValidSubgroupType(streamType)) {
|
|
258
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
259
|
+
"CONSTRAINT_VIOLATION",
|
|
260
|
+
`Invalid subgroup stream type 0x${streamType.toString(16)}`,
|
|
261
|
+
0
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
const propertiesPresent = (streamType & 1) !== 0;
|
|
265
|
+
const subgroupMode = (streamType & 6) >> 1;
|
|
266
|
+
const hasSubgroupField = subgroupMode === 2;
|
|
267
|
+
const subgroupIsFirstObjId = subgroupMode === 1;
|
|
268
|
+
const endOfGroup = (streamType & 8) !== 0;
|
|
269
|
+
const hasPriority = (streamType & 32) === 0;
|
|
270
|
+
const firstObjectFlag = (streamType & 64) !== 0;
|
|
271
|
+
const trackAlias = r.readVarInt();
|
|
272
|
+
const groupId = r.readVarInt();
|
|
273
|
+
let subgroupId = 0n;
|
|
274
|
+
if (hasSubgroupField) {
|
|
275
|
+
subgroupId = r.readVarInt();
|
|
276
|
+
}
|
|
277
|
+
let publisherPriority = 128;
|
|
278
|
+
if (hasPriority) {
|
|
279
|
+
publisherPriority = r.readUint8();
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
streamType,
|
|
283
|
+
propertiesPresent,
|
|
284
|
+
subgroupIsFirstObjId,
|
|
285
|
+
endOfGroup,
|
|
286
|
+
firstObjectFlag,
|
|
287
|
+
trackAlias,
|
|
288
|
+
groupId,
|
|
289
|
+
subgroupId,
|
|
290
|
+
publisherPriority
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function readSubgroupObject(r, propertiesPresent, isFirst, prevObjectId, base) {
|
|
294
|
+
const byteOffset = base + r.offset;
|
|
295
|
+
const delta = r.readVarInt();
|
|
296
|
+
const objectId = isFirst ? delta : prevObjectId + 1n + delta;
|
|
297
|
+
const extensionData = new Uint8Array(0);
|
|
298
|
+
let objectProperties;
|
|
299
|
+
if (propertiesPresent) {
|
|
300
|
+
const propsLen = Number(r.readVarInt());
|
|
301
|
+
if (propsLen > 0) {
|
|
302
|
+
objectProperties = decodeObjectProperties(r, propsLen);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const payloadLength = Number(r.readVarInt());
|
|
306
|
+
let payload;
|
|
307
|
+
let status;
|
|
308
|
+
let payloadByteOffset;
|
|
309
|
+
if (payloadLength === 0) {
|
|
310
|
+
status = r.readVarInt();
|
|
311
|
+
payloadByteOffset = base + r.offset;
|
|
312
|
+
payload = new Uint8Array(0);
|
|
313
|
+
} else {
|
|
314
|
+
payloadByteOffset = base + r.offset;
|
|
315
|
+
payload = r.readBytesView(payloadLength);
|
|
316
|
+
}
|
|
317
|
+
const obj = {
|
|
318
|
+
type: "object",
|
|
319
|
+
byteOffset,
|
|
320
|
+
payloadByteOffset,
|
|
321
|
+
objectId,
|
|
322
|
+
payloadLength,
|
|
323
|
+
payload,
|
|
324
|
+
extensionData
|
|
325
|
+
};
|
|
326
|
+
if (status !== void 0) obj.status = status;
|
|
327
|
+
if (objectProperties !== void 0)
|
|
328
|
+
obj.objectProperties = objectProperties;
|
|
329
|
+
return obj;
|
|
330
|
+
}
|
|
253
331
|
function decodeSubgroupStream(bytes) {
|
|
254
332
|
try {
|
|
255
|
-
const r = new (0,
|
|
256
|
-
const
|
|
257
|
-
if (!isValidSubgroupType(streamType)) {
|
|
258
|
-
return {
|
|
259
|
-
ok: false,
|
|
260
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
261
|
-
"CONSTRAINT_VIOLATION",
|
|
262
|
-
`Invalid subgroup stream type 0x${streamType.toString(16)}`,
|
|
263
|
-
0
|
|
264
|
-
)
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
const propertiesPresent = (streamType & 1) !== 0;
|
|
268
|
-
const subgroupMode = (streamType & 6) >> 1;
|
|
269
|
-
const hasSubgroupField = subgroupMode === 2;
|
|
270
|
-
const subgroupIsFirstObjId = subgroupMode === 1;
|
|
271
|
-
const endOfGroup = (streamType & 8) !== 0;
|
|
272
|
-
const hasPriority = (streamType & 32) === 0;
|
|
273
|
-
const firstObject = (streamType & 64) !== 0;
|
|
274
|
-
const trackAlias = r.readVarInt();
|
|
275
|
-
const groupId = r.readVarInt();
|
|
276
|
-
let subgroupId = 0n;
|
|
277
|
-
if (hasSubgroupField) {
|
|
278
|
-
subgroupId = r.readVarInt();
|
|
279
|
-
}
|
|
280
|
-
let publisherPriority = 128;
|
|
281
|
-
if (hasPriority) {
|
|
282
|
-
publisherPriority = r.readUint8();
|
|
283
|
-
}
|
|
333
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
|
|
334
|
+
const h = readSubgroupHeader(r);
|
|
284
335
|
const objects = [];
|
|
285
336
|
let prevObjectId = -1n;
|
|
286
337
|
let isFirst = true;
|
|
338
|
+
let subgroupId = h.subgroupId;
|
|
287
339
|
while (r.remaining > 0) {
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if (isFirst) {
|
|
292
|
-
objectId = delta;
|
|
293
|
-
if (subgroupIsFirstObjId) {
|
|
294
|
-
subgroupId = objectId;
|
|
295
|
-
}
|
|
296
|
-
isFirst = false;
|
|
297
|
-
} else {
|
|
298
|
-
objectId = prevObjectId + 1n + delta;
|
|
299
|
-
}
|
|
300
|
-
const extensionData = new Uint8Array(0);
|
|
301
|
-
let objectProperties;
|
|
302
|
-
if (propertiesPresent) {
|
|
303
|
-
const propsLen = Number(r.readVarInt());
|
|
304
|
-
if (propsLen > 0) {
|
|
305
|
-
objectProperties = decodeObjectProperties(r, propsLen);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
const payloadLength = Number(r.readVarInt());
|
|
309
|
-
let payload;
|
|
310
|
-
let status;
|
|
311
|
-
let payloadByteOffset;
|
|
312
|
-
if (payloadLength === 0) {
|
|
313
|
-
status = r.readVarInt();
|
|
314
|
-
payloadByteOffset = r.offset;
|
|
315
|
-
payload = new Uint8Array(0);
|
|
316
|
-
} else {
|
|
317
|
-
payloadByteOffset = r.offset;
|
|
318
|
-
payload = r.readBytesView(payloadLength);
|
|
319
|
-
}
|
|
320
|
-
const obj = {
|
|
321
|
-
type: "object",
|
|
322
|
-
byteOffset,
|
|
323
|
-
payloadByteOffset,
|
|
324
|
-
objectId,
|
|
325
|
-
payloadLength,
|
|
326
|
-
payload,
|
|
327
|
-
extensionData
|
|
328
|
-
};
|
|
329
|
-
if (status !== void 0) obj.status = status;
|
|
330
|
-
if (objectProperties !== void 0)
|
|
331
|
-
obj.objectProperties = objectProperties;
|
|
340
|
+
const obj = readSubgroupObject(r, h.propertiesPresent, isFirst, prevObjectId, 0);
|
|
341
|
+
if (isFirst && h.subgroupIsFirstObjId) subgroupId = obj.objectId;
|
|
342
|
+
isFirst = false;
|
|
332
343
|
objects.push(obj);
|
|
333
|
-
prevObjectId = objectId;
|
|
344
|
+
prevObjectId = obj.objectId;
|
|
334
345
|
}
|
|
335
346
|
const result = {
|
|
336
347
|
type: "subgroup",
|
|
337
|
-
headerType: streamType,
|
|
338
|
-
trackAlias,
|
|
339
|
-
groupId,
|
|
348
|
+
headerType: h.streamType,
|
|
349
|
+
trackAlias: h.trackAlias,
|
|
350
|
+
groupId: h.groupId,
|
|
340
351
|
subgroupId,
|
|
341
|
-
publisherPriority,
|
|
342
|
-
objects
|
|
352
|
+
publisherPriority: h.publisherPriority,
|
|
353
|
+
objects,
|
|
354
|
+
...h.endOfGroup ? { endOfGroup: true } : {},
|
|
355
|
+
...h.firstObjectFlag ? { firstObject: true } : {}
|
|
343
356
|
};
|
|
344
|
-
if (endOfGroup) result.endOfGroup = true;
|
|
345
|
-
if (firstObject) result.firstObject = true;
|
|
346
357
|
return {
|
|
347
358
|
ok: true,
|
|
348
359
|
value: result,
|
|
349
360
|
bytesRead: r.offset
|
|
350
361
|
};
|
|
351
362
|
} catch (e) {
|
|
352
|
-
if (e instanceof
|
|
363
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
353
364
|
throw e;
|
|
354
365
|
}
|
|
355
366
|
}
|
|
356
367
|
function decodeDatagram(bytes) {
|
|
357
368
|
try {
|
|
358
|
-
const r = new (0,
|
|
369
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
|
|
359
370
|
const dgType = r.readUint8();
|
|
360
371
|
const objectIdAbsent = (dgType & 4) !== 0;
|
|
361
372
|
const endOfGroup = (dgType & 2) !== 0;
|
|
@@ -405,18 +416,190 @@ function decodeDatagram(bytes) {
|
|
|
405
416
|
result.objectProperties = objectProperties;
|
|
406
417
|
return { ok: true, value: result, bytesRead: r.offset };
|
|
407
418
|
} catch (e) {
|
|
408
|
-
if (e instanceof
|
|
419
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
409
420
|
throw e;
|
|
410
421
|
}
|
|
411
422
|
}
|
|
423
|
+
function newFetchObjectState() {
|
|
424
|
+
return { prevGroupId: 0n, prevSubgroupId: 0n, prevObjectId: 0n, prevPriority: 128, first: true };
|
|
425
|
+
}
|
|
426
|
+
function readFetchObject(r, base, st) {
|
|
427
|
+
const byteOffset = base + r.offset;
|
|
428
|
+
const flags = Number(r.readVarInt());
|
|
429
|
+
let groupId = st.prevGroupId;
|
|
430
|
+
let subgroupId = st.prevSubgroupId;
|
|
431
|
+
let objectId = st.prevObjectId + 1n;
|
|
432
|
+
let payloadLength;
|
|
433
|
+
let payload;
|
|
434
|
+
let payloadByteOffset;
|
|
435
|
+
const extensionData = new Uint8Array(0);
|
|
436
|
+
if (flags >= 128) {
|
|
437
|
+
if (flags !== 140 && flags !== 268) {
|
|
438
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
439
|
+
"CONSTRAINT_VIOLATION",
|
|
440
|
+
`Unknown serialization flags value: 0x${flags.toString(16)}`,
|
|
441
|
+
r.offset
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
groupId = r.readVarInt();
|
|
445
|
+
objectId = r.readVarInt();
|
|
446
|
+
payloadLength = Number(r.readVarInt());
|
|
447
|
+
payloadByteOffset = base + r.offset;
|
|
448
|
+
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
449
|
+
} else if (flags & 64) {
|
|
450
|
+
const objectIdPresent = (flags & 4) !== 0;
|
|
451
|
+
const groupIdPresent = (flags & 8) !== 0;
|
|
452
|
+
const priorityPresent = (flags & 16) !== 0;
|
|
453
|
+
const propsPresent = (flags & 32) !== 0;
|
|
454
|
+
if (groupIdPresent) {
|
|
455
|
+
const groupDelta = r.readVarInt();
|
|
456
|
+
groupId = st.first ? groupDelta : st.prevGroupId + groupDelta + 1n;
|
|
457
|
+
}
|
|
458
|
+
if (objectIdPresent) {
|
|
459
|
+
objectId = r.readVarInt();
|
|
460
|
+
}
|
|
461
|
+
if (priorityPresent) {
|
|
462
|
+
st.prevPriority = r.readUint8();
|
|
463
|
+
}
|
|
464
|
+
let objectProperties;
|
|
465
|
+
if (propsPresent) {
|
|
466
|
+
const propsLen = Number(r.readVarInt());
|
|
467
|
+
if (propsLen > 0) {
|
|
468
|
+
objectProperties = decodeObjectProperties(r, propsLen);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
payloadLength = Number(r.readVarInt());
|
|
472
|
+
payloadByteOffset = base + r.offset;
|
|
473
|
+
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
474
|
+
const obj2 = {
|
|
475
|
+
type: "object",
|
|
476
|
+
byteOffset,
|
|
477
|
+
payloadByteOffset,
|
|
478
|
+
serializationFlags: flags,
|
|
479
|
+
groupId,
|
|
480
|
+
subgroupId: 0n,
|
|
481
|
+
objectId,
|
|
482
|
+
publisherPriority: st.prevPriority,
|
|
483
|
+
payloadLength,
|
|
484
|
+
payload,
|
|
485
|
+
extensionData
|
|
486
|
+
};
|
|
487
|
+
if (objectProperties)
|
|
488
|
+
obj2.objectProperties = objectProperties;
|
|
489
|
+
st.prevGroupId = groupId;
|
|
490
|
+
st.prevObjectId = objectId;
|
|
491
|
+
st.first = false;
|
|
492
|
+
return obj2;
|
|
493
|
+
} else {
|
|
494
|
+
const subgroupEncoding = flags & 3;
|
|
495
|
+
const objectIdPresent = (flags & 4) !== 0;
|
|
496
|
+
const groupIdPresent = (flags & 8) !== 0;
|
|
497
|
+
const priorityPresent = (flags & 16) !== 0;
|
|
498
|
+
const propsPresent = (flags & 32) !== 0;
|
|
499
|
+
if (groupIdPresent) {
|
|
500
|
+
const groupDelta = r.readVarInt();
|
|
501
|
+
groupId = st.first ? groupDelta : st.prevGroupId + groupDelta + 1n;
|
|
502
|
+
} else if (st.first) {
|
|
503
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
504
|
+
"CONSTRAINT_VIOLATION",
|
|
505
|
+
"First fetch object must include groupId",
|
|
506
|
+
r.offset
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
if (subgroupEncoding === 0) {
|
|
510
|
+
subgroupId = 0n;
|
|
511
|
+
} else if (subgroupEncoding === 1) {
|
|
512
|
+
if (st.first) {
|
|
513
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
514
|
+
"CONSTRAINT_VIOLATION",
|
|
515
|
+
"First fetch object cannot reference prior subgroupId",
|
|
516
|
+
r.offset
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
subgroupId = st.prevSubgroupId;
|
|
520
|
+
} else if (subgroupEncoding === 2) {
|
|
521
|
+
if (st.first) {
|
|
522
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
523
|
+
"CONSTRAINT_VIOLATION",
|
|
524
|
+
"First fetch object cannot reference prior subgroupId",
|
|
525
|
+
r.offset
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
subgroupId = st.prevSubgroupId + 1n;
|
|
529
|
+
} else if (subgroupEncoding === 3) {
|
|
530
|
+
subgroupId = r.readVarInt();
|
|
531
|
+
}
|
|
532
|
+
if (objectIdPresent) {
|
|
533
|
+
objectId = r.readVarInt();
|
|
534
|
+
} else if (st.first) {
|
|
535
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
536
|
+
"CONSTRAINT_VIOLATION",
|
|
537
|
+
"First fetch object must include objectId",
|
|
538
|
+
r.offset
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
if (priorityPresent) {
|
|
542
|
+
st.prevPriority = r.readUint8();
|
|
543
|
+
}
|
|
544
|
+
let objectProperties;
|
|
545
|
+
if (propsPresent) {
|
|
546
|
+
const propsLen = Number(r.readVarInt());
|
|
547
|
+
if (propsLen > 0) {
|
|
548
|
+
objectProperties = decodeObjectProperties(r, propsLen);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
payloadLength = Number(r.readVarInt());
|
|
552
|
+
payloadByteOffset = base + r.offset;
|
|
553
|
+
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
554
|
+
if (objectProperties) {
|
|
555
|
+
const obj2 = {
|
|
556
|
+
type: "object",
|
|
557
|
+
byteOffset,
|
|
558
|
+
payloadByteOffset,
|
|
559
|
+
serializationFlags: flags,
|
|
560
|
+
groupId,
|
|
561
|
+
subgroupId,
|
|
562
|
+
objectId,
|
|
563
|
+
publisherPriority: st.prevPriority,
|
|
564
|
+
payloadLength,
|
|
565
|
+
payload,
|
|
566
|
+
extensionData
|
|
567
|
+
};
|
|
568
|
+
obj2.objectProperties = objectProperties;
|
|
569
|
+
st.prevGroupId = groupId;
|
|
570
|
+
st.prevSubgroupId = subgroupId;
|
|
571
|
+
st.prevObjectId = objectId;
|
|
572
|
+
st.first = false;
|
|
573
|
+
return obj2;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
const obj = {
|
|
577
|
+
type: "object",
|
|
578
|
+
byteOffset,
|
|
579
|
+
payloadByteOffset,
|
|
580
|
+
serializationFlags: flags,
|
|
581
|
+
groupId,
|
|
582
|
+
subgroupId,
|
|
583
|
+
objectId,
|
|
584
|
+
publisherPriority: st.prevPriority,
|
|
585
|
+
payloadLength,
|
|
586
|
+
payload,
|
|
587
|
+
extensionData
|
|
588
|
+
};
|
|
589
|
+
st.prevGroupId = groupId;
|
|
590
|
+
st.prevSubgroupId = subgroupId;
|
|
591
|
+
st.prevObjectId = objectId;
|
|
592
|
+
st.first = false;
|
|
593
|
+
return obj;
|
|
594
|
+
}
|
|
412
595
|
function decodeFetchStream(bytes) {
|
|
413
596
|
try {
|
|
414
|
-
const r = new (0,
|
|
597
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
|
|
415
598
|
const streamType = r.readVarInt();
|
|
416
599
|
if (streamType !== FETCH_STREAM_TYPE) {
|
|
417
600
|
return {
|
|
418
601
|
ok: false,
|
|
419
|
-
error: new (0,
|
|
602
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
420
603
|
"CONSTRAINT_VIOLATION",
|
|
421
604
|
`Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
|
|
422
605
|
0
|
|
@@ -425,196 +608,9 @@ function decodeFetchStream(bytes) {
|
|
|
425
608
|
}
|
|
426
609
|
const requestId = r.readVarInt();
|
|
427
610
|
const objects = [];
|
|
428
|
-
|
|
429
|
-
let prevSubgroupId = 0n;
|
|
430
|
-
let prevObjectId = 0n;
|
|
431
|
-
let prevPriority = 128;
|
|
432
|
-
let first = true;
|
|
611
|
+
const st = newFetchObjectState();
|
|
433
612
|
while (r.remaining > 0) {
|
|
434
|
-
|
|
435
|
-
const flags = Number(r.readVarInt());
|
|
436
|
-
let groupId = prevGroupId;
|
|
437
|
-
let subgroupId = prevSubgroupId;
|
|
438
|
-
let objectId = prevObjectId + 1n;
|
|
439
|
-
let payloadLength;
|
|
440
|
-
let payload;
|
|
441
|
-
let payloadByteOffset;
|
|
442
|
-
const extensionData = new Uint8Array(0);
|
|
443
|
-
if (flags >= 128) {
|
|
444
|
-
if (flags !== 140 && flags !== 268) {
|
|
445
|
-
return {
|
|
446
|
-
ok: false,
|
|
447
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
448
|
-
"CONSTRAINT_VIOLATION",
|
|
449
|
-
`Unknown serialization flags value: 0x${flags.toString(16)}`,
|
|
450
|
-
r.offset
|
|
451
|
-
)
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
groupId = r.readVarInt();
|
|
455
|
-
objectId = r.readVarInt();
|
|
456
|
-
payloadLength = Number(r.readVarInt());
|
|
457
|
-
payloadByteOffset = r.offset;
|
|
458
|
-
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
459
|
-
} else if (flags & 64) {
|
|
460
|
-
const objectIdPresent = (flags & 4) !== 0;
|
|
461
|
-
const groupIdPresent = (flags & 8) !== 0;
|
|
462
|
-
const priorityPresent = (flags & 16) !== 0;
|
|
463
|
-
const propsPresent = (flags & 32) !== 0;
|
|
464
|
-
if (groupIdPresent) {
|
|
465
|
-
const groupDelta = r.readVarInt();
|
|
466
|
-
groupId = first ? groupDelta : prevGroupId + groupDelta + 1n;
|
|
467
|
-
}
|
|
468
|
-
if (objectIdPresent) {
|
|
469
|
-
objectId = r.readVarInt();
|
|
470
|
-
}
|
|
471
|
-
if (priorityPresent) {
|
|
472
|
-
prevPriority = r.readUint8();
|
|
473
|
-
}
|
|
474
|
-
let objectProperties;
|
|
475
|
-
if (propsPresent) {
|
|
476
|
-
const propsLen = Number(r.readVarInt());
|
|
477
|
-
if (propsLen > 0) {
|
|
478
|
-
objectProperties = decodeObjectProperties(r, propsLen);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
payloadLength = Number(r.readVarInt());
|
|
482
|
-
payloadByteOffset = r.offset;
|
|
483
|
-
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
484
|
-
const obj2 = {
|
|
485
|
-
type: "object",
|
|
486
|
-
byteOffset,
|
|
487
|
-
payloadByteOffset,
|
|
488
|
-
serializationFlags: flags,
|
|
489
|
-
groupId,
|
|
490
|
-
subgroupId: 0n,
|
|
491
|
-
objectId,
|
|
492
|
-
publisherPriority: prevPriority,
|
|
493
|
-
payloadLength,
|
|
494
|
-
payload,
|
|
495
|
-
extensionData
|
|
496
|
-
};
|
|
497
|
-
if (objectProperties)
|
|
498
|
-
obj2.objectProperties = objectProperties;
|
|
499
|
-
objects.push(obj2);
|
|
500
|
-
prevGroupId = groupId;
|
|
501
|
-
prevObjectId = objectId;
|
|
502
|
-
first = false;
|
|
503
|
-
continue;
|
|
504
|
-
} else {
|
|
505
|
-
const subgroupEncoding = flags & 3;
|
|
506
|
-
const objectIdPresent = (flags & 4) !== 0;
|
|
507
|
-
const groupIdPresent = (flags & 8) !== 0;
|
|
508
|
-
const priorityPresent = (flags & 16) !== 0;
|
|
509
|
-
const propsPresent = (flags & 32) !== 0;
|
|
510
|
-
if (groupIdPresent) {
|
|
511
|
-
const groupDelta = r.readVarInt();
|
|
512
|
-
groupId = first ? groupDelta : prevGroupId + groupDelta + 1n;
|
|
513
|
-
} else if (first) {
|
|
514
|
-
return {
|
|
515
|
-
ok: false,
|
|
516
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
517
|
-
"CONSTRAINT_VIOLATION",
|
|
518
|
-
"First fetch object must include groupId",
|
|
519
|
-
r.offset
|
|
520
|
-
)
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
if (subgroupEncoding === 0) {
|
|
524
|
-
subgroupId = 0n;
|
|
525
|
-
} else if (subgroupEncoding === 1) {
|
|
526
|
-
if (first) {
|
|
527
|
-
return {
|
|
528
|
-
ok: false,
|
|
529
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
530
|
-
"CONSTRAINT_VIOLATION",
|
|
531
|
-
"First fetch object cannot reference prior subgroupId",
|
|
532
|
-
r.offset
|
|
533
|
-
)
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
subgroupId = prevSubgroupId;
|
|
537
|
-
} else if (subgroupEncoding === 2) {
|
|
538
|
-
if (first) {
|
|
539
|
-
return {
|
|
540
|
-
ok: false,
|
|
541
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
542
|
-
"CONSTRAINT_VIOLATION",
|
|
543
|
-
"First fetch object cannot reference prior subgroupId",
|
|
544
|
-
r.offset
|
|
545
|
-
)
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
subgroupId = prevSubgroupId + 1n;
|
|
549
|
-
} else if (subgroupEncoding === 3) {
|
|
550
|
-
subgroupId = r.readVarInt();
|
|
551
|
-
}
|
|
552
|
-
if (objectIdPresent) {
|
|
553
|
-
objectId = r.readVarInt();
|
|
554
|
-
} else if (first) {
|
|
555
|
-
return {
|
|
556
|
-
ok: false,
|
|
557
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
558
|
-
"CONSTRAINT_VIOLATION",
|
|
559
|
-
"First fetch object must include objectId",
|
|
560
|
-
r.offset
|
|
561
|
-
)
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
if (priorityPresent) {
|
|
565
|
-
prevPriority = r.readUint8();
|
|
566
|
-
}
|
|
567
|
-
let objectProperties;
|
|
568
|
-
if (propsPresent) {
|
|
569
|
-
const propsLen = Number(r.readVarInt());
|
|
570
|
-
if (propsLen > 0) {
|
|
571
|
-
objectProperties = decodeObjectProperties(r, propsLen);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
payloadLength = Number(r.readVarInt());
|
|
575
|
-
payloadByteOffset = r.offset;
|
|
576
|
-
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
577
|
-
if (objectProperties) {
|
|
578
|
-
const obj2 = {
|
|
579
|
-
type: "object",
|
|
580
|
-
byteOffset,
|
|
581
|
-
payloadByteOffset,
|
|
582
|
-
serializationFlags: flags,
|
|
583
|
-
groupId,
|
|
584
|
-
subgroupId,
|
|
585
|
-
objectId,
|
|
586
|
-
publisherPriority: prevPriority,
|
|
587
|
-
payloadLength,
|
|
588
|
-
payload,
|
|
589
|
-
extensionData
|
|
590
|
-
};
|
|
591
|
-
obj2.objectProperties = objectProperties;
|
|
592
|
-
objects.push(obj2);
|
|
593
|
-
prevGroupId = groupId;
|
|
594
|
-
prevSubgroupId = subgroupId;
|
|
595
|
-
prevObjectId = objectId;
|
|
596
|
-
first = false;
|
|
597
|
-
continue;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
const obj = {
|
|
601
|
-
type: "object",
|
|
602
|
-
byteOffset,
|
|
603
|
-
payloadByteOffset,
|
|
604
|
-
serializationFlags: flags,
|
|
605
|
-
groupId,
|
|
606
|
-
subgroupId,
|
|
607
|
-
objectId,
|
|
608
|
-
publisherPriority: prevPriority,
|
|
609
|
-
payloadLength,
|
|
610
|
-
payload,
|
|
611
|
-
extensionData
|
|
612
|
-
};
|
|
613
|
-
objects.push(obj);
|
|
614
|
-
prevGroupId = groupId;
|
|
615
|
-
prevSubgroupId = subgroupId;
|
|
616
|
-
prevObjectId = objectId;
|
|
617
|
-
first = false;
|
|
613
|
+
objects.push(readFetchObject(r, 0, st));
|
|
618
614
|
}
|
|
619
615
|
return {
|
|
620
616
|
ok: true,
|
|
@@ -622,7 +618,7 @@ function decodeFetchStream(bytes) {
|
|
|
622
618
|
bytesRead: r.offset
|
|
623
619
|
};
|
|
624
620
|
} catch (e) {
|
|
625
|
-
if (e instanceof
|
|
621
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
626
622
|
throw e;
|
|
627
623
|
}
|
|
628
624
|
}
|
|
@@ -640,135 +636,125 @@ function decodeDataStream(streamType, bytes) {
|
|
|
640
636
|
}
|
|
641
637
|
}
|
|
642
638
|
}
|
|
639
|
+
var StreamBuffer = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this); }
|
|
640
|
+
__init() {this.buf = new Uint8Array(0)}
|
|
641
|
+
/** Bytes written into `buf`. */
|
|
642
|
+
__init2() {this.len = 0}
|
|
643
|
+
/** Consumed prefix of `buf`; `base + offset` is the position in the stream. */
|
|
644
|
+
__init3() {this.offset = 0}
|
|
645
|
+
/** Absolute position of `buf[0]` within the stream. */
|
|
646
|
+
__init4() {this.base = 0}
|
|
647
|
+
get unread() {
|
|
648
|
+
return this.len - this.offset;
|
|
649
|
+
}
|
|
650
|
+
append(chunk) {
|
|
651
|
+
if (this.len + chunk.length > this.buf.length) {
|
|
652
|
+
const live = this.len - this.offset;
|
|
653
|
+
const needed = live + chunk.length;
|
|
654
|
+
let cap = Math.max(4096, this.buf.length);
|
|
655
|
+
while (cap < needed * 2) cap *= 2;
|
|
656
|
+
const next = new Uint8Array(cap);
|
|
657
|
+
next.set(this.buf.subarray(this.offset, this.len), 0);
|
|
658
|
+
this.buf = next;
|
|
659
|
+
this.base += this.offset;
|
|
660
|
+
this.len = live;
|
|
661
|
+
this.offset = 0;
|
|
662
|
+
}
|
|
663
|
+
this.buf.set(chunk, this.len);
|
|
664
|
+
this.len += chunk.length;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* The written bytes, for a reader positioned at `offset`. Bounded by `len`
|
|
668
|
+
* rather than by capacity, so `BufferReader.remaining` counts real bytes and
|
|
669
|
+
* not the spare room after them.
|
|
670
|
+
*/
|
|
671
|
+
written() {
|
|
672
|
+
return this.buf.subarray(0, this.len);
|
|
673
|
+
}
|
|
674
|
+
}, _class);
|
|
643
675
|
function createSubgroupStreamDecoder() {
|
|
644
|
-
|
|
645
|
-
let
|
|
676
|
+
const b = new StreamBuffer();
|
|
677
|
+
let header = null;
|
|
646
678
|
let headerEmitted = false;
|
|
647
679
|
let prevObjectId = -1n;
|
|
648
|
-
let
|
|
649
|
-
|
|
680
|
+
let isFirst = true;
|
|
681
|
+
function emitHeader(controller, h, subgroupId) {
|
|
682
|
+
controller.enqueue({
|
|
683
|
+
type: "subgroup_header",
|
|
684
|
+
headerType: h.streamType,
|
|
685
|
+
trackAlias: h.trackAlias,
|
|
686
|
+
groupId: h.groupId,
|
|
687
|
+
subgroupId,
|
|
688
|
+
publisherPriority: h.publisherPriority,
|
|
689
|
+
...h.endOfGroup ? { endOfGroup: true } : {},
|
|
690
|
+
...h.firstObjectFlag ? { firstObject: true } : {}
|
|
691
|
+
});
|
|
692
|
+
headerEmitted = true;
|
|
693
|
+
}
|
|
650
694
|
return new TransformStream({
|
|
651
695
|
transform(chunk, controller) {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
}
|
|
656
|
-
const newBuffer = new Uint8Array(buffer.length + chunk.length);
|
|
657
|
-
newBuffer.set(buffer, 0);
|
|
658
|
-
newBuffer.set(chunk, buffer.length);
|
|
659
|
-
buffer = newBuffer;
|
|
660
|
-
if (!headerEmitted) {
|
|
696
|
+
b.append(chunk);
|
|
697
|
+
const view = b.written();
|
|
698
|
+
if (header === null) {
|
|
661
699
|
try {
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
controller.error(
|
|
666
|
-
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
667
|
-
"CONSTRAINT_VIOLATION",
|
|
668
|
-
`Invalid subgroup stream type 0x${streamType.toString(16)}`,
|
|
669
|
-
0
|
|
670
|
-
)
|
|
671
|
-
);
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
_propertiesPresent = (streamType & 1) !== 0;
|
|
675
|
-
const subgroupMode = (streamType & 6) >> 1;
|
|
676
|
-
const hasSubgroupField = subgroupMode === 2;
|
|
677
|
-
const hasPriority = (streamType & 32) === 0;
|
|
678
|
-
const trackAlias = r.readVarInt();
|
|
679
|
-
const groupId = r.readVarInt();
|
|
680
|
-
let subgroupId = 0n;
|
|
681
|
-
if (hasSubgroupField) {
|
|
682
|
-
subgroupId = r.readVarInt();
|
|
683
|
-
}
|
|
684
|
-
let publisherPriority = 128;
|
|
685
|
-
if (hasPriority) {
|
|
686
|
-
publisherPriority = r.readUint8();
|
|
687
|
-
}
|
|
688
|
-
controller.enqueue({
|
|
689
|
-
type: "subgroup_header",
|
|
690
|
-
trackAlias,
|
|
691
|
-
groupId,
|
|
692
|
-
subgroupId,
|
|
693
|
-
publisherPriority
|
|
694
|
-
});
|
|
695
|
-
headerEmitted = true;
|
|
696
|
-
offset += r.offset;
|
|
700
|
+
const hr = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
|
|
701
|
+
header = readSubgroupHeader(hr);
|
|
702
|
+
b.offset = hr.offset;
|
|
697
703
|
} catch (e) {
|
|
698
|
-
if (e instanceof
|
|
704
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
699
705
|
return;
|
|
700
706
|
}
|
|
701
707
|
controller.error(e);
|
|
702
708
|
return;
|
|
703
709
|
}
|
|
710
|
+
if (!header.subgroupIsFirstObjId) emitHeader(controller, header, header.subgroupId);
|
|
704
711
|
}
|
|
705
|
-
|
|
712
|
+
const h = header;
|
|
713
|
+
if (h === null) return;
|
|
714
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
|
|
715
|
+
while (r.remaining > 0) {
|
|
716
|
+
const start = r.offset;
|
|
717
|
+
let obj;
|
|
706
718
|
try {
|
|
707
|
-
|
|
708
|
-
const delta = r.readVarInt();
|
|
709
|
-
let objectId;
|
|
710
|
-
if (firstObject) {
|
|
711
|
-
objectId = delta;
|
|
712
|
-
firstObject = false;
|
|
713
|
-
} else {
|
|
714
|
-
objectId = prevObjectId + 1n + delta;
|
|
715
|
-
}
|
|
716
|
-
let extensionData = new Uint8Array(0);
|
|
717
|
-
if (_propertiesPresent) {
|
|
718
|
-
const extLen = Number(r.readVarInt());
|
|
719
|
-
extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
720
|
-
}
|
|
721
|
-
const payloadLength = Number(r.readVarInt());
|
|
722
|
-
const payloadByteOffset = r.offset;
|
|
723
|
-
const payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
724
|
-
controller.enqueue({
|
|
725
|
-
type: "object",
|
|
726
|
-
objectId,
|
|
727
|
-
payloadLength,
|
|
728
|
-
payload,
|
|
729
|
-
extensionData,
|
|
730
|
-
byteOffset: 0,
|
|
731
|
-
payloadByteOffset
|
|
732
|
-
});
|
|
733
|
-
offset += r.offset;
|
|
734
|
-
prevObjectId = objectId;
|
|
719
|
+
obj = readSubgroupObject(r, h.propertiesPresent, isFirst, prevObjectId, b.base);
|
|
735
720
|
} catch (e) {
|
|
736
|
-
if (e instanceof
|
|
737
|
-
|
|
721
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
722
|
+
b.offset = start;
|
|
723
|
+
return;
|
|
738
724
|
}
|
|
739
725
|
controller.error(e);
|
|
740
726
|
return;
|
|
741
727
|
}
|
|
728
|
+
if (!headerEmitted) emitHeader(controller, h, obj.objectId);
|
|
729
|
+
isFirst = false;
|
|
730
|
+
b.offset = r.offset;
|
|
731
|
+
prevObjectId = obj.objectId;
|
|
732
|
+
controller.enqueue(obj);
|
|
742
733
|
}
|
|
743
734
|
},
|
|
744
735
|
flush(controller) {
|
|
745
|
-
if (
|
|
746
|
-
|
|
736
|
+
if (header !== null && !headerEmitted) emitHeader(controller, header, 0n);
|
|
737
|
+
if (b.unread > 0) {
|
|
738
|
+
controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
747
739
|
}
|
|
748
740
|
}
|
|
749
741
|
});
|
|
750
742
|
}
|
|
751
743
|
function createFetchStreamDecoder() {
|
|
752
|
-
|
|
753
|
-
let offset = 0;
|
|
744
|
+
const b = new StreamBuffer();
|
|
754
745
|
let headerEmitted = false;
|
|
746
|
+
const st = newFetchObjectState();
|
|
755
747
|
return new TransformStream({
|
|
756
748
|
transform(chunk, controller) {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
offset = 0;
|
|
760
|
-
}
|
|
761
|
-
const newBuffer = new Uint8Array(buffer.length + chunk.length);
|
|
762
|
-
newBuffer.set(buffer, 0);
|
|
763
|
-
newBuffer.set(chunk, buffer.length);
|
|
764
|
-
buffer = newBuffer;
|
|
749
|
+
b.append(chunk);
|
|
750
|
+
const view = b.written();
|
|
765
751
|
if (!headerEmitted) {
|
|
766
752
|
try {
|
|
767
|
-
const
|
|
768
|
-
const streamType =
|
|
753
|
+
const r2 = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
|
|
754
|
+
const streamType = r2.readVarInt();
|
|
769
755
|
if (streamType !== FETCH_STREAM_TYPE) {
|
|
770
756
|
controller.error(
|
|
771
|
-
new (0,
|
|
757
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
772
758
|
"CONSTRAINT_VIOLATION",
|
|
773
759
|
`Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
|
|
774
760
|
0
|
|
@@ -776,113 +762,96 @@ function createFetchStreamDecoder() {
|
|
|
776
762
|
);
|
|
777
763
|
return;
|
|
778
764
|
}
|
|
779
|
-
const requestId =
|
|
765
|
+
const requestId = r2.readVarInt();
|
|
780
766
|
controller.enqueue({ type: "fetch_header", requestId });
|
|
781
767
|
headerEmitted = true;
|
|
782
|
-
offset
|
|
768
|
+
b.offset = r2.offset;
|
|
783
769
|
} catch (e) {
|
|
784
|
-
if (e instanceof
|
|
770
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
785
771
|
return;
|
|
786
772
|
}
|
|
787
773
|
controller.error(e);
|
|
788
774
|
return;
|
|
789
775
|
}
|
|
790
776
|
}
|
|
791
|
-
|
|
777
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
|
|
778
|
+
while (r.remaining > 0) {
|
|
779
|
+
const start = r.offset;
|
|
780
|
+
let obj;
|
|
792
781
|
try {
|
|
793
|
-
|
|
794
|
-
const flags = Number(r.readVarInt());
|
|
795
|
-
const objectIdPresent = (flags & 4) !== 0;
|
|
796
|
-
const groupIdPresent = (flags & 8) !== 0;
|
|
797
|
-
const priorityPresent = (flags & 16) !== 0;
|
|
798
|
-
const extensionsPresent = (flags & 32) !== 0;
|
|
799
|
-
const subgroupEncoding = flags & 3;
|
|
800
|
-
if (groupIdPresent) r.readVarInt();
|
|
801
|
-
if (subgroupEncoding === 3) r.readVarInt();
|
|
802
|
-
let objectId = 0n;
|
|
803
|
-
if (objectIdPresent) objectId = r.readVarInt();
|
|
804
|
-
if (priorityPresent) r.readUint8();
|
|
805
|
-
let extensionData = new Uint8Array(0);
|
|
806
|
-
if (extensionsPresent) {
|
|
807
|
-
const extLen = Number(r.readVarInt());
|
|
808
|
-
extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
809
|
-
}
|
|
810
|
-
const payloadLength = Number(r.readVarInt());
|
|
811
|
-
const payloadByteOffset = r.offset;
|
|
812
|
-
const payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
813
|
-
controller.enqueue({
|
|
814
|
-
type: "object",
|
|
815
|
-
objectId,
|
|
816
|
-
payloadLength,
|
|
817
|
-
payload,
|
|
818
|
-
extensionData,
|
|
819
|
-
byteOffset: 0,
|
|
820
|
-
payloadByteOffset
|
|
821
|
-
});
|
|
822
|
-
offset += r.offset;
|
|
782
|
+
obj = readFetchObject(r, b.base, st);
|
|
823
783
|
} catch (e) {
|
|
824
|
-
if (e instanceof
|
|
825
|
-
|
|
784
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
785
|
+
b.offset = start;
|
|
786
|
+
return;
|
|
826
787
|
}
|
|
827
788
|
controller.error(e);
|
|
828
789
|
return;
|
|
829
790
|
}
|
|
791
|
+
b.offset = r.offset;
|
|
792
|
+
controller.enqueue(obj);
|
|
830
793
|
}
|
|
831
794
|
},
|
|
832
795
|
flush(controller) {
|
|
833
|
-
if (
|
|
834
|
-
controller.error(new (0,
|
|
796
|
+
if (b.unread > 0) {
|
|
797
|
+
controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
835
798
|
}
|
|
836
799
|
}
|
|
837
800
|
});
|
|
838
801
|
}
|
|
839
802
|
function createDataStreamDecoder() {
|
|
840
|
-
let
|
|
841
|
-
let
|
|
842
|
-
let
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
if (
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
const decoder = createSubgroupStreamDecoder();
|
|
858
|
-
inner = decoder;
|
|
859
|
-
} else if (firstByte === 5) {
|
|
860
|
-
const decoder = createFetchStreamDecoder();
|
|
861
|
-
inner = decoder;
|
|
862
|
-
} else {
|
|
863
|
-
controller.error(
|
|
864
|
-
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
865
|
-
"CONSTRAINT_VIOLATION",
|
|
866
|
-
`Unknown data stream type: 0x${firstByte.toString(16)}`,
|
|
867
|
-
0
|
|
868
|
-
)
|
|
869
|
-
);
|
|
870
|
-
return;
|
|
803
|
+
let writer = null;
|
|
804
|
+
let pump = Promise.resolve();
|
|
805
|
+
let broken = false;
|
|
806
|
+
function attach(inner, controller) {
|
|
807
|
+
writer = inner.writable.getWriter();
|
|
808
|
+
const reader = inner.readable.getReader();
|
|
809
|
+
pump = (async () => {
|
|
810
|
+
try {
|
|
811
|
+
for (; ; ) {
|
|
812
|
+
const { done, value } = await reader.read();
|
|
813
|
+
if (done) break;
|
|
814
|
+
controller.enqueue(value);
|
|
815
|
+
}
|
|
816
|
+
} catch (e) {
|
|
817
|
+
if (!broken) {
|
|
818
|
+
broken = true;
|
|
819
|
+
controller.error(e);
|
|
871
820
|
}
|
|
872
821
|
}
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
822
|
+
})();
|
|
823
|
+
}
|
|
824
|
+
async function feed(bytes) {
|
|
825
|
+
if (writer === null || broken || bytes.length === 0) return;
|
|
826
|
+
try {
|
|
827
|
+
await writer.write(bytes);
|
|
828
|
+
} catch (e2) {
|
|
829
|
+
broken = true;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
return new TransformStream({
|
|
833
|
+
async transform(chunk, controller) {
|
|
834
|
+
if (broken) return;
|
|
835
|
+
if (writer !== null) {
|
|
836
|
+
await feed(chunk);
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
if (chunk.length === 0) return;
|
|
840
|
+
const firstByte = chunk[0];
|
|
879
841
|
if (isValidSubgroupType(firstByte)) {
|
|
880
|
-
|
|
842
|
+
attach(
|
|
843
|
+
createSubgroupStreamDecoder(),
|
|
844
|
+
controller
|
|
845
|
+
);
|
|
881
846
|
} else if (firstByte === 5) {
|
|
882
|
-
|
|
847
|
+
attach(
|
|
848
|
+
createFetchStreamDecoder(),
|
|
849
|
+
controller
|
|
850
|
+
);
|
|
883
851
|
} else {
|
|
852
|
+
broken = true;
|
|
884
853
|
controller.error(
|
|
885
|
-
new (0,
|
|
854
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
886
855
|
"CONSTRAINT_VIOLATION",
|
|
887
856
|
`Unknown data stream type: 0x${firstByte.toString(16)}`,
|
|
888
857
|
0
|
|
@@ -890,31 +859,15 @@ function createDataStreamDecoder() {
|
|
|
890
859
|
);
|
|
891
860
|
return;
|
|
892
861
|
}
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
type: "subgroup_header",
|
|
901
|
-
trackAlias: stream.trackAlias,
|
|
902
|
-
groupId: stream.groupId,
|
|
903
|
-
subgroupId: stream.subgroupId,
|
|
904
|
-
publisherPriority: stream.publisherPriority
|
|
905
|
-
});
|
|
906
|
-
for (const obj of stream.objects) {
|
|
907
|
-
controller.enqueue(obj);
|
|
908
|
-
}
|
|
909
|
-
} else if (stream.type === "fetch") {
|
|
910
|
-
controller.enqueue({
|
|
911
|
-
type: "fetch_header",
|
|
912
|
-
requestId: stream.requestId
|
|
913
|
-
});
|
|
914
|
-
for (const obj of stream.objects) {
|
|
915
|
-
controller.enqueue(obj);
|
|
916
|
-
}
|
|
862
|
+
await feed(chunk);
|
|
863
|
+
},
|
|
864
|
+
async flush() {
|
|
865
|
+
if (writer === null) return;
|
|
866
|
+
try {
|
|
867
|
+
await writer.close();
|
|
868
|
+
} catch (e3) {
|
|
917
869
|
}
|
|
870
|
+
await pump;
|
|
918
871
|
}
|
|
919
872
|
});
|
|
920
873
|
}
|
|
@@ -935,12 +888,12 @@ function encodeSetupOptions(opts, writer) {
|
|
|
935
888
|
}
|
|
936
889
|
});
|
|
937
890
|
}
|
|
938
|
-
|
|
891
|
+
for (const token of _nullishCoalesce(opts.authorization_token, () => ( []))) {
|
|
939
892
|
entries.push({
|
|
940
893
|
type: SETUP_OPT_AUTHORIZATION_TOKEN,
|
|
941
894
|
encode: (w) => {
|
|
942
|
-
const tmpW = new (0,
|
|
943
|
-
encodeAuthorizationToken(
|
|
895
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(64);
|
|
896
|
+
encodeAuthorizationToken(token, tmpW);
|
|
944
897
|
const raw = tmpW.finish();
|
|
945
898
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
946
899
|
w.writeBytes(raw);
|
|
@@ -980,11 +933,11 @@ function encodeSetupOptions(opts, writer) {
|
|
|
980
933
|
type: id,
|
|
981
934
|
encode: (w) => {
|
|
982
935
|
if (id % 2n === 0n) {
|
|
983
|
-
const raw =
|
|
984
|
-
const tmpReader = new (0,
|
|
936
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
937
|
+
const tmpReader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(raw);
|
|
985
938
|
w.writeVarInt(tmpReader.readVarInt());
|
|
986
939
|
} else {
|
|
987
|
-
const raw =
|
|
940
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
988
941
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
989
942
|
w.writeBytes(raw);
|
|
990
943
|
}
|
|
@@ -1013,13 +966,13 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
1013
966
|
if (optType === SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE) {
|
|
1014
967
|
result.max_auth_token_cache_size = value;
|
|
1015
968
|
} else {
|
|
1016
|
-
const tmpWriter = new (0,
|
|
969
|
+
const tmpWriter = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(16);
|
|
1017
970
|
tmpWriter.writeVarInt(value);
|
|
1018
971
|
const raw = tmpWriter.finish();
|
|
1019
972
|
unknown.push({
|
|
1020
973
|
id: `0x${optType.toString(16)}`,
|
|
1021
974
|
length: raw.byteLength,
|
|
1022
|
-
raw_hex:
|
|
975
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, raw)
|
|
1023
976
|
});
|
|
1024
977
|
}
|
|
1025
978
|
} else {
|
|
@@ -1028,7 +981,9 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
1028
981
|
if (optType === SETUP_OPT_PATH) {
|
|
1029
982
|
result.path = textDecoder.decode(bytes);
|
|
1030
983
|
} else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
|
|
1031
|
-
|
|
984
|
+
const token = decodeAuthorizationToken(new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes));
|
|
985
|
+
noteAuthTokenValue(reader.offset - length, length, token.token_value);
|
|
986
|
+
result.authorization_token = [..._nullishCoalesce(result.authorization_token, () => ( [])), token];
|
|
1032
987
|
} else if (optType === SETUP_OPT_AUTHORITY) {
|
|
1033
988
|
result.authority = textDecoder.decode(bytes);
|
|
1034
989
|
} else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
|
|
@@ -1037,7 +992,7 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
1037
992
|
unknown.push({
|
|
1038
993
|
id: `0x${optType.toString(16)}`,
|
|
1039
994
|
length,
|
|
1040
|
-
raw_hex:
|
|
995
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, bytes)
|
|
1041
996
|
});
|
|
1042
997
|
}
|
|
1043
998
|
}
|
|
@@ -1138,12 +1093,12 @@ function encodeParams(params, writer) {
|
|
|
1138
1093
|
encode: (w) => w.writeVarInt(params.object_delivery_timeout)
|
|
1139
1094
|
});
|
|
1140
1095
|
}
|
|
1141
|
-
|
|
1096
|
+
for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
|
|
1142
1097
|
entries.push({
|
|
1143
1098
|
type: PARAM_AUTHORIZATION_TOKEN,
|
|
1144
1099
|
encode: (w) => {
|
|
1145
|
-
const tmpW = new (0,
|
|
1146
|
-
encodeAuthorizationToken(
|
|
1100
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(64);
|
|
1101
|
+
encodeAuthorizationToken(token, tmpW);
|
|
1147
1102
|
const raw = tmpW.finish();
|
|
1148
1103
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
1149
1104
|
w.writeBytes(raw);
|
|
@@ -1203,7 +1158,7 @@ function encodeParams(params, writer) {
|
|
|
1203
1158
|
type: PARAM_SUBSCRIPTION_FILTER,
|
|
1204
1159
|
encode: (w) => {
|
|
1205
1160
|
const f = params.subscription_filter;
|
|
1206
|
-
const tmpW = new (0,
|
|
1161
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
|
|
1207
1162
|
tmpW.writeVarInt(f.filter_type);
|
|
1208
1163
|
if (f.filter_type === 3n || f.filter_type === 4n) {
|
|
1209
1164
|
tmpW.writeVarInt(f.start_group);
|
|
@@ -1247,7 +1202,7 @@ function encodeParams(params, writer) {
|
|
|
1247
1202
|
entries.push({
|
|
1248
1203
|
type: id,
|
|
1249
1204
|
encode: (w) => {
|
|
1250
|
-
const raw =
|
|
1205
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1251
1206
|
w.writeBytes(raw);
|
|
1252
1207
|
}
|
|
1253
1208
|
});
|
|
@@ -1272,7 +1227,7 @@ function decodeParams(reader, messageType) {
|
|
|
1272
1227
|
prevType = paramType;
|
|
1273
1228
|
const scope = PARAMETER_SCOPE.get(paramType);
|
|
1274
1229
|
if (scope !== void 0 && !scope.has(messageType)) {
|
|
1275
|
-
throw new (0,
|
|
1230
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1276
1231
|
"CONSTRAINT_VIOLATION",
|
|
1277
1232
|
`Message Parameter 0x${paramType.toString(16)} may not appear in ${messageType}`,
|
|
1278
1233
|
reader.offset
|
|
@@ -1283,7 +1238,9 @@ function decodeParams(reader, messageType) {
|
|
|
1283
1238
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
1284
1239
|
const length = Number(reader.readVarInt());
|
|
1285
1240
|
const bytes = reader.readBytes(length);
|
|
1286
|
-
|
|
1241
|
+
const token = decodeAuthorizationToken(new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes));
|
|
1242
|
+
noteAuthTokenValue(reader.offset - length, length, token.token_value);
|
|
1243
|
+
result.authorization_token = [..._nullishCoalesce(result.authorization_token, () => ( [])), token];
|
|
1287
1244
|
} else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
|
|
1288
1245
|
result.rendezvous_timeout = reader.readVarInt();
|
|
1289
1246
|
} else if (paramType === PARAM_SUBGROUP_DELIVERY_TIMEOUT) {
|
|
@@ -1322,7 +1279,7 @@ function decodeParams(reader, messageType) {
|
|
|
1322
1279
|
} else if (paramType === PARAM_TRACK_NAMESPACE_PREFIX) {
|
|
1323
1280
|
result.track_namespace_prefix = decodeNamespaceTuple(reader);
|
|
1324
1281
|
} else {
|
|
1325
|
-
throw new (0,
|
|
1282
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1326
1283
|
"INVALID_PARAMETER",
|
|
1327
1284
|
`Unknown Message Parameter type 0x${paramType.toString(16)}`,
|
|
1328
1285
|
reader.offset
|
|
@@ -1393,11 +1350,11 @@ function encodeTrackProperties(props, writer) {
|
|
|
1393
1350
|
type: id,
|
|
1394
1351
|
encode: (w) => {
|
|
1395
1352
|
if (id % 2n === 0n) {
|
|
1396
|
-
const raw =
|
|
1397
|
-
const tmpReader = new (0,
|
|
1353
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1354
|
+
const tmpReader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(raw);
|
|
1398
1355
|
w.writeVarInt(tmpReader.readVarInt());
|
|
1399
1356
|
} else {
|
|
1400
|
-
const raw =
|
|
1357
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1401
1358
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
1402
1359
|
w.writeBytes(raw);
|
|
1403
1360
|
}
|
|
@@ -1436,13 +1393,13 @@ function decodeTrackProperties(reader, payloadEnd) {
|
|
|
1436
1393
|
} else if (propType === TPROP_DYNAMIC_GROUPS) {
|
|
1437
1394
|
result.dynamic_groups = value;
|
|
1438
1395
|
} else {
|
|
1439
|
-
const tmpWriter = new (0,
|
|
1396
|
+
const tmpWriter = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(16);
|
|
1440
1397
|
tmpWriter.writeVarInt(value);
|
|
1441
1398
|
const raw = tmpWriter.finish();
|
|
1442
1399
|
unknown.push({
|
|
1443
1400
|
id: `0x${propType.toString(16)}`,
|
|
1444
1401
|
length: raw.byteLength,
|
|
1445
|
-
raw_hex:
|
|
1402
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, raw)
|
|
1446
1403
|
});
|
|
1447
1404
|
}
|
|
1448
1405
|
} else {
|
|
@@ -1454,7 +1411,7 @@ function decodeTrackProperties(reader, payloadEnd) {
|
|
|
1454
1411
|
unknown.push({
|
|
1455
1412
|
id: `0x${propType.toString(16)}`,
|
|
1456
1413
|
length,
|
|
1457
|
-
raw_hex:
|
|
1414
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, bytes)
|
|
1458
1415
|
});
|
|
1459
1416
|
}
|
|
1460
1417
|
}
|
|
@@ -1688,7 +1645,7 @@ function decodeFetchPayload(r) {
|
|
|
1688
1645
|
const fetch_type = r.readVarInt();
|
|
1689
1646
|
const ft = Number(fetch_type);
|
|
1690
1647
|
if (ft < 1 || ft > 3) {
|
|
1691
|
-
throw new (0,
|
|
1648
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid fetch_type: ${ft}`, r.offset);
|
|
1692
1649
|
}
|
|
1693
1650
|
let standalone;
|
|
1694
1651
|
let joining;
|
|
@@ -1785,13 +1742,13 @@ function encodeMessage(message) {
|
|
|
1785
1742
|
if (typeId === void 0) {
|
|
1786
1743
|
throw new Error(`Unknown message type: ${message.type}`);
|
|
1787
1744
|
}
|
|
1788
|
-
const payloadWriter = new (0,
|
|
1745
|
+
const payloadWriter = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
|
|
1789
1746
|
encodePayload(message, payloadWriter);
|
|
1790
1747
|
const payload = payloadWriter.finishView();
|
|
1791
1748
|
if (payload.byteLength > 65535) {
|
|
1792
1749
|
throw new Error(`Payload too large for 16-bit length: ${payload.byteLength}`);
|
|
1793
1750
|
}
|
|
1794
|
-
const writer = new (0,
|
|
1751
|
+
const writer = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(payload.byteLength + 16);
|
|
1795
1752
|
writer.writeVarInt(typeId);
|
|
1796
1753
|
writer.writeUint8(payload.byteLength >> 8 & 255);
|
|
1797
1754
|
writer.writeUint8(payload.byteLength & 255);
|
|
@@ -1844,13 +1801,13 @@ function encodePayload(msg, w) {
|
|
|
1844
1801
|
}
|
|
1845
1802
|
function decodeMessage(bytes) {
|
|
1846
1803
|
try {
|
|
1847
|
-
const reader = new (0,
|
|
1804
|
+
const reader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
|
|
1848
1805
|
const typeId = reader.readVarInt();
|
|
1849
1806
|
const lenHi = reader.readUint8();
|
|
1850
1807
|
const lenLo = reader.readUint8();
|
|
1851
1808
|
const payloadLength = lenHi << 8 | lenLo;
|
|
1852
1809
|
const payloadBytes = reader.readBytes(payloadLength);
|
|
1853
|
-
const payloadReader = new (0,
|
|
1810
|
+
const payloadReader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(payloadBytes);
|
|
1854
1811
|
let message;
|
|
1855
1812
|
if (typeId === MSG_SETUP) {
|
|
1856
1813
|
message = decodeSetupPayload(payloadReader, payloadLength);
|
|
@@ -1891,7 +1848,7 @@ function decodeMessage(bytes) {
|
|
|
1891
1848
|
} else {
|
|
1892
1849
|
return {
|
|
1893
1850
|
ok: false,
|
|
1894
|
-
error: new (0,
|
|
1851
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1895
1852
|
"UNKNOWN_MESSAGE_TYPE",
|
|
1896
1853
|
`Unknown message type ID: 0x${typeId.toString(16)}`,
|
|
1897
1854
|
0
|
|
@@ -1900,7 +1857,7 @@ function decodeMessage(bytes) {
|
|
|
1900
1857
|
}
|
|
1901
1858
|
return { ok: true, value: message, bytesRead: reader.offset };
|
|
1902
1859
|
} catch (e) {
|
|
1903
|
-
if (e instanceof
|
|
1860
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) {
|
|
1904
1861
|
return { ok: false, error: e };
|
|
1905
1862
|
}
|
|
1906
1863
|
throw e;
|
|
@@ -1935,7 +1892,7 @@ function createStreamDecoder() {
|
|
|
1935
1892
|
flush(controller) {
|
|
1936
1893
|
if (offset < buffer.length) {
|
|
1937
1894
|
controller.error(
|
|
1938
|
-
new (0,
|
|
1895
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete message data", 0)
|
|
1939
1896
|
);
|
|
1940
1897
|
}
|
|
1941
1898
|
}
|
|
@@ -1959,6 +1916,24 @@ function createDraft18Codec() {
|
|
|
1959
1916
|
createDataStreamDecoder
|
|
1960
1917
|
};
|
|
1961
1918
|
}
|
|
1919
|
+
function noteAuthTokenValue(valueStart, valueLength, value) {
|
|
1920
|
+
if (value === void 0 || value.byteLength === 0) return;
|
|
1921
|
+
_chunk5IMHJIAZcjs.recordAuthValueSpan.call(void 0, valueStart + valueLength - value.byteLength, value.byteLength);
|
|
1922
|
+
}
|
|
1923
|
+
function redactAuthTokens(bytes) {
|
|
1924
|
+
let payloadStart;
|
|
1925
|
+
try {
|
|
1926
|
+
const probe = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
|
|
1927
|
+
probe.readVarInt();
|
|
1928
|
+
probe.readUint8();
|
|
1929
|
+
probe.readUint8();
|
|
1930
|
+
payloadStart = probe.offset;
|
|
1931
|
+
} catch (e4) {
|
|
1932
|
+
return { bytes, redacted: 0, incomplete: false, decoded: false };
|
|
1933
|
+
}
|
|
1934
|
+
return _chunk5IMHJIAZcjs.redactWith.call(void 0, bytes, payloadStart, () => decodeMessage(bytes).ok);
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1962
1937
|
|
|
1963
1938
|
|
|
1964
1939
|
|
|
@@ -2001,4 +1976,4 @@ function createDraft18Codec() {
|
|
|
2001
1976
|
|
|
2002
1977
|
|
|
2003
1978
|
|
|
2004
|
-
exports.MSG_REQUEST_UPDATE = MSG_REQUEST_UPDATE; exports.MSG_SUBSCRIBE = MSG_SUBSCRIBE; exports.MSG_SUBSCRIBE_OK = MSG_SUBSCRIBE_OK; exports.MSG_REQUEST_ERROR = MSG_REQUEST_ERROR; exports.MSG_PUBLISH_NAMESPACE = MSG_PUBLISH_NAMESPACE; exports.MSG_REQUEST_OK = MSG_REQUEST_OK; exports.MSG_NAMESPACE = MSG_NAMESPACE; exports.MSG_PUBLISH_DONE = MSG_PUBLISH_DONE; exports.MSG_TRACK_STATUS = MSG_TRACK_STATUS; exports.MSG_NAMESPACE_DONE = MSG_NAMESPACE_DONE; exports.MSG_PUBLISH_BLOCKED = MSG_PUBLISH_BLOCKED; exports.MSG_GOAWAY = MSG_GOAWAY; exports.MSG_FETCH = MSG_FETCH; exports.MSG_FETCH_OK = MSG_FETCH_OK; exports.MSG_PUBLISH = MSG_PUBLISH; exports.MSG_PUBLISH_OK = MSG_PUBLISH_OK; exports.MSG_SUBSCRIBE_NAMESPACE = MSG_SUBSCRIBE_NAMESPACE; exports.MSG_SUBSCRIBE_TRACKS = MSG_SUBSCRIBE_TRACKS; exports.MSG_SETUP = MSG_SETUP; exports.SETUP_OPT_PATH = SETUP_OPT_PATH; exports.SETUP_OPT_AUTHORIZATION_TOKEN = SETUP_OPT_AUTHORIZATION_TOKEN; exports.SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE = SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE; exports.SETUP_OPT_AUTHORITY = SETUP_OPT_AUTHORITY; exports.SETUP_OPT_MOQT_IMPLEMENTATION = SETUP_OPT_MOQT_IMPLEMENTATION; exports.MESSAGE_TYPE_MAP = MESSAGE_TYPE_MAP; exports.MESSAGE_ID_MAP = MESSAGE_ID_MAP; exports.encodeSubgroupStream = encodeSubgroupStream; exports.encodeDatagram = encodeDatagram; exports.encodeFetchStream = encodeFetchStream; exports.decodeSubgroupStream = decodeSubgroupStream; exports.decodeDatagram = decodeDatagram; exports.decodeFetchStream = decodeFetchStream; exports.decodeDataStream = decodeDataStream; exports.createSubgroupStreamDecoder = createSubgroupStreamDecoder; exports.createFetchStreamDecoder = createFetchStreamDecoder; exports.createDataStreamDecoder = createDataStreamDecoder; exports.encodeMessage = encodeMessage; exports.decodeMessage = decodeMessage; exports.createStreamDecoder = createStreamDecoder; exports.createDraft18Codec = createDraft18Codec;
|
|
1979
|
+
exports.MSG_REQUEST_UPDATE = MSG_REQUEST_UPDATE; exports.MSG_SUBSCRIBE = MSG_SUBSCRIBE; exports.MSG_SUBSCRIBE_OK = MSG_SUBSCRIBE_OK; exports.MSG_REQUEST_ERROR = MSG_REQUEST_ERROR; exports.MSG_PUBLISH_NAMESPACE = MSG_PUBLISH_NAMESPACE; exports.MSG_REQUEST_OK = MSG_REQUEST_OK; exports.MSG_NAMESPACE = MSG_NAMESPACE; exports.MSG_PUBLISH_DONE = MSG_PUBLISH_DONE; exports.MSG_TRACK_STATUS = MSG_TRACK_STATUS; exports.MSG_NAMESPACE_DONE = MSG_NAMESPACE_DONE; exports.MSG_PUBLISH_BLOCKED = MSG_PUBLISH_BLOCKED; exports.MSG_GOAWAY = MSG_GOAWAY; exports.MSG_FETCH = MSG_FETCH; exports.MSG_FETCH_OK = MSG_FETCH_OK; exports.MSG_PUBLISH = MSG_PUBLISH; exports.MSG_PUBLISH_OK = MSG_PUBLISH_OK; exports.MSG_SUBSCRIBE_NAMESPACE = MSG_SUBSCRIBE_NAMESPACE; exports.MSG_SUBSCRIBE_TRACKS = MSG_SUBSCRIBE_TRACKS; exports.MSG_SETUP = MSG_SETUP; exports.SETUP_OPT_PATH = SETUP_OPT_PATH; exports.SETUP_OPT_AUTHORIZATION_TOKEN = SETUP_OPT_AUTHORIZATION_TOKEN; exports.SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE = SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE; exports.SETUP_OPT_AUTHORITY = SETUP_OPT_AUTHORITY; exports.SETUP_OPT_MOQT_IMPLEMENTATION = SETUP_OPT_MOQT_IMPLEMENTATION; exports.MESSAGE_TYPE_MAP = MESSAGE_TYPE_MAP; exports.MESSAGE_ID_MAP = MESSAGE_ID_MAP; exports.encodeSubgroupStream = encodeSubgroupStream; exports.encodeDatagram = encodeDatagram; exports.encodeFetchStream = encodeFetchStream; exports.decodeSubgroupStream = decodeSubgroupStream; exports.decodeDatagram = decodeDatagram; exports.decodeFetchStream = decodeFetchStream; exports.decodeDataStream = decodeDataStream; exports.createSubgroupStreamDecoder = createSubgroupStreamDecoder; exports.createFetchStreamDecoder = createFetchStreamDecoder; exports.createDataStreamDecoder = createDataStreamDecoder; exports.encodeMessage = encodeMessage; exports.decodeMessage = decodeMessage; exports.createStreamDecoder = createStreamDecoder; exports.createDraft18Codec = createDraft18Codec; exports.redactAuthTokens = redactAuthTokens;
|