@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,13 @@
|
|
|
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
|
+
|
|
10
|
+
var _chunk5IMHJIAZcjs = require('./chunk-5IMHJIAZ.cjs');
|
|
8
11
|
|
|
9
12
|
// src/drafts/draft20/messages.ts
|
|
10
13
|
var MSG_REQUEST_UPDATE = 0x02n;
|
|
@@ -147,7 +150,7 @@ function datagramTypeFlagsError(typeFlags) {
|
|
|
147
150
|
var OBJECT_STATUS_NORMAL = 0n;
|
|
148
151
|
var MAX_U64 = 0xffffffffffffffffn;
|
|
149
152
|
function encodeSubgroupStream(stream) {
|
|
150
|
-
const w = new (0,
|
|
153
|
+
const w = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
|
|
151
154
|
const streamType = stream.headerType;
|
|
152
155
|
w.writeVarInt(BigInt(streamType));
|
|
153
156
|
const propertiesPresent = (streamType & 1) !== 0;
|
|
@@ -168,7 +171,7 @@ function encodeSubgroupStream(stream) {
|
|
|
168
171
|
w.writeVarInt(delta);
|
|
169
172
|
if (propertiesPresent) {
|
|
170
173
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
171
|
-
const tmpW = new (0,
|
|
174
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
|
|
172
175
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
173
176
|
const raw = tmpW.finish();
|
|
174
177
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -188,7 +191,7 @@ function encodeSubgroupStream(stream) {
|
|
|
188
191
|
return w.finish();
|
|
189
192
|
}
|
|
190
193
|
function encodeDatagram(dg) {
|
|
191
|
-
const w = new (0,
|
|
194
|
+
const w = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
|
|
192
195
|
const dgType = dg.datagramType;
|
|
193
196
|
w.writeVarInt(BigInt(dgType));
|
|
194
197
|
w.writeVarInt(dg.trackAlias);
|
|
@@ -205,7 +208,7 @@ function encodeDatagram(dg) {
|
|
|
205
208
|
}
|
|
206
209
|
if (propertiesPresent) {
|
|
207
210
|
if (dg.objectProperties && Object.keys(dg.objectProperties).length > 0) {
|
|
208
|
-
const tmpW = new (0,
|
|
211
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
|
|
209
212
|
encodeObjectProperties(dg.objectProperties, tmpW);
|
|
210
213
|
const raw = tmpW.finish();
|
|
211
214
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -222,7 +225,7 @@ function encodeDatagram(dg) {
|
|
|
222
225
|
return w.finish();
|
|
223
226
|
}
|
|
224
227
|
function encodeFetchStream(stream) {
|
|
225
|
-
const w = new (0,
|
|
228
|
+
const w = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
|
|
226
229
|
w.writeVarInt(FETCH_STREAM_TYPE);
|
|
227
230
|
w.writeVarInt(stream.requestId);
|
|
228
231
|
let prevGroupId = 0n;
|
|
@@ -245,7 +248,7 @@ function encodeFetchStream(stream) {
|
|
|
245
248
|
if (flags & 16) w.writeUint8(obj.publisherPriority);
|
|
246
249
|
if (flags & 32) {
|
|
247
250
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
248
|
-
const tmpW = new (0,
|
|
251
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
|
|
249
252
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
250
253
|
const raw = tmpW.finish();
|
|
251
254
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -269,7 +272,7 @@ function encodeFetchStream(stream) {
|
|
|
269
272
|
if (flags & 16) w.writeUint8(obj.publisherPriority);
|
|
270
273
|
if (flags & 32) {
|
|
271
274
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
272
|
-
const tmpW = new (0,
|
|
275
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
|
|
273
276
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
274
277
|
const raw = tmpW.finish();
|
|
275
278
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -298,116 +301,128 @@ function resolveObjectId(groupIdPresent, delta, prevObjectId) {
|
|
|
298
301
|
function resolveGroupId(first, delta, prevGroupId, offset) {
|
|
299
302
|
const groupId = first ? delta : prevGroupId + delta + 1n;
|
|
300
303
|
if (groupId > MAX_U64) {
|
|
301
|
-
throw new (0,
|
|
304
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", "computed Group ID exceeds 2^64 - 1", offset);
|
|
302
305
|
}
|
|
303
306
|
return groupId;
|
|
304
307
|
}
|
|
308
|
+
function readSubgroupHeader(r) {
|
|
309
|
+
const typeFlags = r.readVarInt();
|
|
310
|
+
const flagsError = subgroupTypeFlagsError(typeFlags);
|
|
311
|
+
if (flagsError !== null) {
|
|
312
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", flagsError, 0);
|
|
313
|
+
}
|
|
314
|
+
const streamType = Number(typeFlags);
|
|
315
|
+
const propertiesPresent = (streamType & 1) !== 0;
|
|
316
|
+
const subgroupMode = (streamType & 6) >> 1;
|
|
317
|
+
const hasSubgroupField = subgroupMode === 2;
|
|
318
|
+
const subgroupIsFirstObjId = subgroupMode === 1;
|
|
319
|
+
const endOfGroup = (streamType & 8) !== 0;
|
|
320
|
+
const hasPriority = (streamType & 32) === 0;
|
|
321
|
+
const firstObjectFlag = (streamType & 64) !== 0;
|
|
322
|
+
const trackAlias = r.readVarInt();
|
|
323
|
+
const groupId = r.readVarInt();
|
|
324
|
+
let subgroupId = 0n;
|
|
325
|
+
if (hasSubgroupField) {
|
|
326
|
+
subgroupId = r.readVarInt();
|
|
327
|
+
}
|
|
328
|
+
let publisherPriority = 128;
|
|
329
|
+
if (hasPriority) {
|
|
330
|
+
publisherPriority = r.readUint8();
|
|
331
|
+
}
|
|
332
|
+
return {
|
|
333
|
+
streamType,
|
|
334
|
+
propertiesPresent,
|
|
335
|
+
subgroupIsFirstObjId,
|
|
336
|
+
endOfGroup,
|
|
337
|
+
firstObjectFlag,
|
|
338
|
+
trackAlias,
|
|
339
|
+
groupId,
|
|
340
|
+
subgroupId,
|
|
341
|
+
publisherPriority
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
function readSubgroupObject(r, propertiesPresent, isFirst, prevObjectId, base) {
|
|
345
|
+
const byteOffset = base + r.offset;
|
|
346
|
+
const delta = r.readVarInt();
|
|
347
|
+
const objectId = isFirst ? delta : prevObjectId + 1n + delta;
|
|
348
|
+
const extensionData = new Uint8Array(0);
|
|
349
|
+
let objectProperties;
|
|
350
|
+
if (propertiesPresent) {
|
|
351
|
+
const propsLen = Number(r.readVarInt());
|
|
352
|
+
if (propsLen > 0) {
|
|
353
|
+
objectProperties = decodeObjectProperties(r, propsLen);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
const payloadLength = Number(r.readVarInt());
|
|
357
|
+
let payload;
|
|
358
|
+
let status;
|
|
359
|
+
let payloadByteOffset;
|
|
360
|
+
if (payloadLength === 0) {
|
|
361
|
+
status = r.readVarInt();
|
|
362
|
+
payloadByteOffset = base + r.offset;
|
|
363
|
+
payload = new Uint8Array(0);
|
|
364
|
+
} else {
|
|
365
|
+
payloadByteOffset = base + r.offset;
|
|
366
|
+
payload = r.readBytesView(payloadLength);
|
|
367
|
+
}
|
|
368
|
+
const obj = {
|
|
369
|
+
type: "object",
|
|
370
|
+
byteOffset,
|
|
371
|
+
payloadByteOffset,
|
|
372
|
+
objectId,
|
|
373
|
+
objectIdDelta: delta,
|
|
374
|
+
payloadLength,
|
|
375
|
+
payload,
|
|
376
|
+
extensionData
|
|
377
|
+
};
|
|
378
|
+
if (status !== void 0) obj.status = status;
|
|
379
|
+
if (objectProperties !== void 0)
|
|
380
|
+
obj.objectProperties = objectProperties;
|
|
381
|
+
return obj;
|
|
382
|
+
}
|
|
305
383
|
function decodeSubgroupStream(bytes) {
|
|
306
384
|
try {
|
|
307
|
-
const r = new (0,
|
|
308
|
-
const
|
|
309
|
-
const flagsError = subgroupTypeFlagsError(typeFlags);
|
|
310
|
-
if (flagsError !== null) {
|
|
311
|
-
return { ok: false, error: new (0, _chunk4XLYCT5Qcjs.DecodeError)("CONSTRAINT_VIOLATION", flagsError, 0) };
|
|
312
|
-
}
|
|
313
|
-
const streamType = Number(typeFlags);
|
|
314
|
-
const propertiesPresent = (streamType & 1) !== 0;
|
|
315
|
-
const subgroupMode = (streamType & 6) >> 1;
|
|
316
|
-
const hasSubgroupField = subgroupMode === 2;
|
|
317
|
-
const subgroupIsFirstObjId = subgroupMode === 1;
|
|
318
|
-
const endOfGroup = (streamType & 8) !== 0;
|
|
319
|
-
const hasPriority = (streamType & 32) === 0;
|
|
320
|
-
const firstObject = (streamType & 64) !== 0;
|
|
321
|
-
const trackAlias = r.readVarInt();
|
|
322
|
-
const groupId = r.readVarInt();
|
|
323
|
-
let subgroupId = 0n;
|
|
324
|
-
if (hasSubgroupField) {
|
|
325
|
-
subgroupId = r.readVarInt();
|
|
326
|
-
}
|
|
327
|
-
let publisherPriority = 128;
|
|
328
|
-
if (hasPriority) {
|
|
329
|
-
publisherPriority = r.readUint8();
|
|
330
|
-
}
|
|
385
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
|
|
386
|
+
const h = readSubgroupHeader(r);
|
|
331
387
|
const objects = [];
|
|
332
388
|
let prevObjectId = -1n;
|
|
333
389
|
let isFirst = true;
|
|
390
|
+
let subgroupId = h.subgroupId;
|
|
334
391
|
while (r.remaining > 0) {
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (isFirst) {
|
|
339
|
-
objectId = delta;
|
|
340
|
-
if (subgroupIsFirstObjId) {
|
|
341
|
-
subgroupId = objectId;
|
|
342
|
-
}
|
|
343
|
-
isFirst = false;
|
|
344
|
-
} else {
|
|
345
|
-
objectId = prevObjectId + 1n + delta;
|
|
346
|
-
}
|
|
347
|
-
const extensionData = new Uint8Array(0);
|
|
348
|
-
let objectProperties;
|
|
349
|
-
if (propertiesPresent) {
|
|
350
|
-
const propsLen = Number(r.readVarInt());
|
|
351
|
-
if (propsLen > 0) {
|
|
352
|
-
objectProperties = decodeObjectProperties(r, propsLen);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
const payloadLength = Number(r.readVarInt());
|
|
356
|
-
let payload;
|
|
357
|
-
let status;
|
|
358
|
-
let payloadByteOffset;
|
|
359
|
-
if (payloadLength === 0) {
|
|
360
|
-
status = r.readVarInt();
|
|
361
|
-
payloadByteOffset = r.offset;
|
|
362
|
-
payload = new Uint8Array(0);
|
|
363
|
-
} else {
|
|
364
|
-
payloadByteOffset = r.offset;
|
|
365
|
-
payload = r.readBytesView(payloadLength);
|
|
366
|
-
}
|
|
367
|
-
const obj = {
|
|
368
|
-
type: "object",
|
|
369
|
-
byteOffset,
|
|
370
|
-
payloadByteOffset,
|
|
371
|
-
objectId,
|
|
372
|
-
objectIdDelta: delta,
|
|
373
|
-
payloadLength,
|
|
374
|
-
payload,
|
|
375
|
-
extensionData
|
|
376
|
-
};
|
|
377
|
-
if (status !== void 0) obj.status = status;
|
|
378
|
-
if (objectProperties !== void 0)
|
|
379
|
-
obj.objectProperties = objectProperties;
|
|
392
|
+
const obj = readSubgroupObject(r, h.propertiesPresent, isFirst, prevObjectId, 0);
|
|
393
|
+
if (isFirst && h.subgroupIsFirstObjId) subgroupId = obj.objectId;
|
|
394
|
+
isFirst = false;
|
|
380
395
|
objects.push(obj);
|
|
381
|
-
prevObjectId = objectId;
|
|
396
|
+
prevObjectId = obj.objectId;
|
|
382
397
|
}
|
|
383
398
|
const result = {
|
|
384
399
|
type: "subgroup",
|
|
385
|
-
headerType: streamType,
|
|
386
|
-
trackAlias,
|
|
387
|
-
groupId,
|
|
400
|
+
headerType: h.streamType,
|
|
401
|
+
trackAlias: h.trackAlias,
|
|
402
|
+
groupId: h.groupId,
|
|
388
403
|
subgroupId,
|
|
389
|
-
publisherPriority,
|
|
390
|
-
objects
|
|
404
|
+
publisherPriority: h.publisherPriority,
|
|
405
|
+
objects,
|
|
406
|
+
...h.endOfGroup ? { endOfGroup: true } : {},
|
|
407
|
+
...h.firstObjectFlag ? { firstObject: true } : {}
|
|
391
408
|
};
|
|
392
|
-
if (endOfGroup) result.endOfGroup = true;
|
|
393
|
-
if (firstObject) result.firstObject = true;
|
|
394
409
|
return {
|
|
395
410
|
ok: true,
|
|
396
411
|
value: result,
|
|
397
412
|
bytesRead: r.offset
|
|
398
413
|
};
|
|
399
414
|
} catch (e) {
|
|
400
|
-
if (e instanceof
|
|
415
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
401
416
|
throw e;
|
|
402
417
|
}
|
|
403
418
|
}
|
|
404
419
|
function decodeDatagram(bytes) {
|
|
405
420
|
try {
|
|
406
|
-
const r = new (0,
|
|
421
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
|
|
407
422
|
const typeFlags = r.readVarInt();
|
|
408
423
|
const flagsError = datagramTypeFlagsError(typeFlags);
|
|
409
424
|
if (flagsError !== null) {
|
|
410
|
-
return { ok: false, error: new (0,
|
|
425
|
+
return { ok: false, error: new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", flagsError, 0) };
|
|
411
426
|
}
|
|
412
427
|
const dgType = Number(typeFlags);
|
|
413
428
|
const objectIdAbsent = (dgType & 4) !== 0;
|
|
@@ -431,7 +446,7 @@ function decodeDatagram(bytes) {
|
|
|
431
446
|
if (propsLen === 0) {
|
|
432
447
|
return {
|
|
433
448
|
ok: false,
|
|
434
|
-
error: new (0,
|
|
449
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
435
450
|
"CONSTRAINT_VIOLATION",
|
|
436
451
|
"a datagram with the PROPERTIES bit set must carry a non-empty Properties structure",
|
|
437
452
|
r.offset
|
|
@@ -447,7 +462,7 @@ function decodeDatagram(bytes) {
|
|
|
447
462
|
if (propertiesPresent && objectStatus !== OBJECT_STATUS_NORMAL) {
|
|
448
463
|
return {
|
|
449
464
|
ok: false,
|
|
450
|
-
error: new (0,
|
|
465
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
451
466
|
"CONSTRAINT_VIOLATION",
|
|
452
467
|
`only a Normal (0x0) Object may carry Properties, got status 0x${objectStatus.toString(16)}`,
|
|
453
468
|
r.offset
|
|
@@ -457,7 +472,7 @@ function decodeDatagram(bytes) {
|
|
|
457
472
|
if (r.remaining > 0) {
|
|
458
473
|
return {
|
|
459
474
|
ok: false,
|
|
460
|
-
error: new (0,
|
|
475
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
461
476
|
"CONSTRAINT_VIOLATION",
|
|
462
477
|
`a status datagram must not carry a payload (${r.remaining} trailing byte(s))`,
|
|
463
478
|
r.offset
|
|
@@ -486,18 +501,207 @@ function decodeDatagram(bytes) {
|
|
|
486
501
|
result.objectProperties = objectProperties;
|
|
487
502
|
return { ok: true, value: result, bytesRead: r.offset };
|
|
488
503
|
} catch (e) {
|
|
489
|
-
if (e instanceof
|
|
504
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
490
505
|
throw e;
|
|
491
506
|
}
|
|
492
507
|
}
|
|
508
|
+
function newFetchObjectState() {
|
|
509
|
+
return { prevGroupId: 0n, prevSubgroupId: 0n, prevObjectId: 0n, prevPriority: 128, first: true };
|
|
510
|
+
}
|
|
511
|
+
function readFetchObject(r, base, st) {
|
|
512
|
+
const byteOffset = base + r.offset;
|
|
513
|
+
const flags = Number(r.readVarInt());
|
|
514
|
+
let groupId = st.prevGroupId;
|
|
515
|
+
let subgroupId = st.prevSubgroupId;
|
|
516
|
+
let objectId = st.prevObjectId + 1n;
|
|
517
|
+
let payloadLength;
|
|
518
|
+
let payload;
|
|
519
|
+
let payloadByteOffset;
|
|
520
|
+
const extensionData = new Uint8Array(0);
|
|
521
|
+
if (flags >= 128) {
|
|
522
|
+
if (!FETCH_END_OF_RANGE_MARKERS.has(flags)) {
|
|
523
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
524
|
+
"CONSTRAINT_VIOLATION",
|
|
525
|
+
`0x${flags.toString(16)} is neither a flag combination below 128 nor one of the three End of Range markers`,
|
|
526
|
+
r.offset
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
const groupDelta2 = r.readVarInt();
|
|
530
|
+
groupId = resolveGroupId(st.first, groupDelta2, st.prevGroupId, r.offset);
|
|
531
|
+
const objectDelta2 = r.readVarInt();
|
|
532
|
+
objectId = objectDelta2;
|
|
533
|
+
payloadLength = Number(r.readVarInt());
|
|
534
|
+
payloadByteOffset = base + r.offset;
|
|
535
|
+
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
536
|
+
const marker = {
|
|
537
|
+
type: "object",
|
|
538
|
+
byteOffset,
|
|
539
|
+
payloadByteOffset,
|
|
540
|
+
serializationFlags: flags,
|
|
541
|
+
groupId,
|
|
542
|
+
groupIdDelta: groupDelta2,
|
|
543
|
+
// A marker has no Subgroup ID or Priority of its own — Section
|
|
544
|
+
// 11.4.4.2 says neither field is present. The interface requires
|
|
545
|
+
// both, so they carry the last actual Object's values, which is also
|
|
546
|
+
// what a following Object that references "the prior Object" gets.
|
|
547
|
+
subgroupId: st.prevSubgroupId,
|
|
548
|
+
objectId,
|
|
549
|
+
objectIdDelta: objectDelta2,
|
|
550
|
+
publisherPriority: st.prevPriority,
|
|
551
|
+
payloadLength,
|
|
552
|
+
payload,
|
|
553
|
+
extensionData
|
|
554
|
+
};
|
|
555
|
+
st.prevGroupId = groupId;
|
|
556
|
+
st.prevObjectId = objectId;
|
|
557
|
+
st.first = false;
|
|
558
|
+
return marker;
|
|
559
|
+
}
|
|
560
|
+
if (flags & 64) {
|
|
561
|
+
const objectIdPresent2 = (flags & 4) !== 0;
|
|
562
|
+
const groupIdPresent2 = (flags & 8) !== 0;
|
|
563
|
+
const priorityPresent2 = (flags & 16) !== 0;
|
|
564
|
+
const propsPresent2 = (flags & 32) !== 0;
|
|
565
|
+
let groupDelta2;
|
|
566
|
+
if (groupIdPresent2) {
|
|
567
|
+
groupDelta2 = r.readVarInt();
|
|
568
|
+
groupId = resolveGroupId(st.first, groupDelta2, st.prevGroupId, r.offset);
|
|
569
|
+
}
|
|
570
|
+
let objectDelta2;
|
|
571
|
+
if (objectIdPresent2) {
|
|
572
|
+
objectDelta2 = r.readVarInt();
|
|
573
|
+
objectId = resolveObjectId(groupIdPresent2, objectDelta2, st.prevObjectId);
|
|
574
|
+
}
|
|
575
|
+
if (objectId > MAX_U64) {
|
|
576
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", "computed Object ID exceeds 2^64 - 1", r.offset);
|
|
577
|
+
}
|
|
578
|
+
if (priorityPresent2) {
|
|
579
|
+
st.prevPriority = r.readUint8();
|
|
580
|
+
}
|
|
581
|
+
let objectProperties2;
|
|
582
|
+
if (propsPresent2) {
|
|
583
|
+
const propsLen = Number(r.readVarInt());
|
|
584
|
+
if (propsLen > 0) {
|
|
585
|
+
objectProperties2 = decodeObjectProperties(r, propsLen);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
payloadLength = Number(r.readVarInt());
|
|
589
|
+
payloadByteOffset = base + r.offset;
|
|
590
|
+
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
591
|
+
const obj2 = {
|
|
592
|
+
type: "object",
|
|
593
|
+
byteOffset,
|
|
594
|
+
payloadByteOffset,
|
|
595
|
+
serializationFlags: flags,
|
|
596
|
+
groupId,
|
|
597
|
+
subgroupId: 0n,
|
|
598
|
+
objectId,
|
|
599
|
+
publisherPriority: st.prevPriority,
|
|
600
|
+
payloadLength,
|
|
601
|
+
payload,
|
|
602
|
+
extensionData
|
|
603
|
+
};
|
|
604
|
+
if (groupDelta2 !== void 0)
|
|
605
|
+
obj2.groupIdDelta = groupDelta2;
|
|
606
|
+
if (objectDelta2 !== void 0)
|
|
607
|
+
obj2.objectIdDelta = objectDelta2;
|
|
608
|
+
if (objectProperties2)
|
|
609
|
+
obj2.objectProperties = objectProperties2;
|
|
610
|
+
st.prevGroupId = groupId;
|
|
611
|
+
st.prevObjectId = objectId;
|
|
612
|
+
st.first = false;
|
|
613
|
+
return obj2;
|
|
614
|
+
}
|
|
615
|
+
const subgroupEncoding = flags & 3;
|
|
616
|
+
const objectIdPresent = (flags & 4) !== 0;
|
|
617
|
+
const groupIdPresent = (flags & 8) !== 0;
|
|
618
|
+
const priorityPresent = (flags & 16) !== 0;
|
|
619
|
+
const propsPresent = (flags & 32) !== 0;
|
|
620
|
+
let groupDelta;
|
|
621
|
+
if (groupIdPresent) {
|
|
622
|
+
groupDelta = r.readVarInt();
|
|
623
|
+
groupId = resolveGroupId(st.first, groupDelta, st.prevGroupId, r.offset);
|
|
624
|
+
} else if (st.first) {
|
|
625
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
626
|
+
"CONSTRAINT_VIOLATION",
|
|
627
|
+
"First fetch object must include groupId",
|
|
628
|
+
r.offset
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
if (subgroupEncoding === 0) {
|
|
632
|
+
subgroupId = 0n;
|
|
633
|
+
} else if (subgroupEncoding === 1 || subgroupEncoding === 2) {
|
|
634
|
+
if (st.first) {
|
|
635
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
636
|
+
"CONSTRAINT_VIOLATION",
|
|
637
|
+
"First fetch object cannot reference prior subgroupId",
|
|
638
|
+
r.offset
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
subgroupId = subgroupEncoding === 1 ? st.prevSubgroupId : st.prevSubgroupId + 1n;
|
|
642
|
+
} else {
|
|
643
|
+
subgroupId = r.readVarInt();
|
|
644
|
+
}
|
|
645
|
+
let objectDelta;
|
|
646
|
+
if (objectIdPresent) {
|
|
647
|
+
objectDelta = r.readVarInt();
|
|
648
|
+
objectId = resolveObjectId(groupIdPresent, objectDelta, st.prevObjectId);
|
|
649
|
+
} else if (st.first) {
|
|
650
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
651
|
+
"CONSTRAINT_VIOLATION",
|
|
652
|
+
"First fetch object must include objectId",
|
|
653
|
+
r.offset
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
if (objectId > MAX_U64) {
|
|
657
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", "computed Object ID exceeds 2^64 - 1", r.offset);
|
|
658
|
+
}
|
|
659
|
+
if (priorityPresent) {
|
|
660
|
+
st.prevPriority = r.readUint8();
|
|
661
|
+
}
|
|
662
|
+
let objectProperties;
|
|
663
|
+
if (propsPresent) {
|
|
664
|
+
const propsLen = Number(r.readVarInt());
|
|
665
|
+
if (propsLen > 0) {
|
|
666
|
+
objectProperties = decodeObjectProperties(r, propsLen);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
payloadLength = Number(r.readVarInt());
|
|
670
|
+
payloadByteOffset = base + r.offset;
|
|
671
|
+
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
672
|
+
const obj = {
|
|
673
|
+
type: "object",
|
|
674
|
+
byteOffset,
|
|
675
|
+
payloadByteOffset,
|
|
676
|
+
serializationFlags: flags,
|
|
677
|
+
groupId,
|
|
678
|
+
subgroupId,
|
|
679
|
+
objectId,
|
|
680
|
+
publisherPriority: st.prevPriority,
|
|
681
|
+
payloadLength,
|
|
682
|
+
payload,
|
|
683
|
+
extensionData
|
|
684
|
+
};
|
|
685
|
+
if (groupDelta !== void 0)
|
|
686
|
+
obj.groupIdDelta = groupDelta;
|
|
687
|
+
if (objectDelta !== void 0)
|
|
688
|
+
obj.objectIdDelta = objectDelta;
|
|
689
|
+
if (objectProperties)
|
|
690
|
+
obj.objectProperties = objectProperties;
|
|
691
|
+
st.prevGroupId = groupId;
|
|
692
|
+
st.prevSubgroupId = subgroupId;
|
|
693
|
+
st.prevObjectId = objectId;
|
|
694
|
+
st.first = false;
|
|
695
|
+
return obj;
|
|
696
|
+
}
|
|
493
697
|
function decodeFetchStream(bytes) {
|
|
494
698
|
try {
|
|
495
|
-
const r = new (0,
|
|
699
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
|
|
496
700
|
const streamType = r.readVarInt();
|
|
497
701
|
if (streamType !== FETCH_STREAM_TYPE) {
|
|
498
702
|
return {
|
|
499
703
|
ok: false,
|
|
500
|
-
error: new (0,
|
|
704
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
501
705
|
"CONSTRAINT_VIOLATION",
|
|
502
706
|
`Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
|
|
503
707
|
0
|
|
@@ -506,224 +710,9 @@ function decodeFetchStream(bytes) {
|
|
|
506
710
|
}
|
|
507
711
|
const requestId = r.readVarInt();
|
|
508
712
|
const objects = [];
|
|
509
|
-
|
|
510
|
-
let prevSubgroupId = 0n;
|
|
511
|
-
let prevObjectId = 0n;
|
|
512
|
-
let prevPriority = 128;
|
|
513
|
-
let first = true;
|
|
713
|
+
const st = newFetchObjectState();
|
|
514
714
|
while (r.remaining > 0) {
|
|
515
|
-
|
|
516
|
-
const flags = Number(r.readVarInt());
|
|
517
|
-
let groupId = prevGroupId;
|
|
518
|
-
let subgroupId = prevSubgroupId;
|
|
519
|
-
let objectId = prevObjectId + 1n;
|
|
520
|
-
let payloadLength;
|
|
521
|
-
let payload;
|
|
522
|
-
let payloadByteOffset;
|
|
523
|
-
const extensionData = new Uint8Array(0);
|
|
524
|
-
if (flags >= 128) {
|
|
525
|
-
if (!FETCH_END_OF_RANGE_MARKERS.has(flags)) {
|
|
526
|
-
return {
|
|
527
|
-
ok: false,
|
|
528
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
529
|
-
"CONSTRAINT_VIOLATION",
|
|
530
|
-
`0x${flags.toString(16)} is neither a flag combination below 128 nor one of the three End of Range markers`,
|
|
531
|
-
r.offset
|
|
532
|
-
)
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
const groupDelta2 = r.readVarInt();
|
|
536
|
-
groupId = resolveGroupId(first, groupDelta2, prevGroupId, r.offset);
|
|
537
|
-
const objectDelta2 = r.readVarInt();
|
|
538
|
-
objectId = objectDelta2;
|
|
539
|
-
payloadLength = Number(r.readVarInt());
|
|
540
|
-
payloadByteOffset = r.offset;
|
|
541
|
-
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
542
|
-
const marker = {
|
|
543
|
-
type: "object",
|
|
544
|
-
byteOffset,
|
|
545
|
-
payloadByteOffset,
|
|
546
|
-
serializationFlags: flags,
|
|
547
|
-
groupId,
|
|
548
|
-
groupIdDelta: groupDelta2,
|
|
549
|
-
// A marker has no Subgroup ID or Priority of its own — Section
|
|
550
|
-
// 11.4.4.2 says neither field is present. The interface requires
|
|
551
|
-
// both, so they carry the last actual Object's values, which is also
|
|
552
|
-
// what a following Object that references "the prior Object" gets.
|
|
553
|
-
subgroupId: prevSubgroupId,
|
|
554
|
-
objectId,
|
|
555
|
-
objectIdDelta: objectDelta2,
|
|
556
|
-
publisherPriority: prevPriority,
|
|
557
|
-
payloadLength,
|
|
558
|
-
payload,
|
|
559
|
-
extensionData
|
|
560
|
-
};
|
|
561
|
-
objects.push(marker);
|
|
562
|
-
prevGroupId = groupId;
|
|
563
|
-
prevObjectId = objectId;
|
|
564
|
-
first = false;
|
|
565
|
-
continue;
|
|
566
|
-
}
|
|
567
|
-
if (flags & 64) {
|
|
568
|
-
const objectIdPresent2 = (flags & 4) !== 0;
|
|
569
|
-
const groupIdPresent2 = (flags & 8) !== 0;
|
|
570
|
-
const priorityPresent2 = (flags & 16) !== 0;
|
|
571
|
-
const propsPresent2 = (flags & 32) !== 0;
|
|
572
|
-
let groupDelta2;
|
|
573
|
-
if (groupIdPresent2) {
|
|
574
|
-
groupDelta2 = r.readVarInt();
|
|
575
|
-
groupId = resolveGroupId(first, groupDelta2, prevGroupId, r.offset);
|
|
576
|
-
}
|
|
577
|
-
let objectDelta2;
|
|
578
|
-
if (objectIdPresent2) {
|
|
579
|
-
objectDelta2 = r.readVarInt();
|
|
580
|
-
objectId = resolveObjectId(groupIdPresent2, objectDelta2, prevObjectId);
|
|
581
|
-
}
|
|
582
|
-
if (objectId > MAX_U64) {
|
|
583
|
-
return {
|
|
584
|
-
ok: false,
|
|
585
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
586
|
-
"CONSTRAINT_VIOLATION",
|
|
587
|
-
"computed Object ID exceeds 2^64 - 1",
|
|
588
|
-
r.offset
|
|
589
|
-
)
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
if (priorityPresent2) {
|
|
593
|
-
prevPriority = r.readUint8();
|
|
594
|
-
}
|
|
595
|
-
let objectProperties2;
|
|
596
|
-
if (propsPresent2) {
|
|
597
|
-
const propsLen = Number(r.readVarInt());
|
|
598
|
-
if (propsLen > 0) {
|
|
599
|
-
objectProperties2 = decodeObjectProperties(r, propsLen);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
payloadLength = Number(r.readVarInt());
|
|
603
|
-
payloadByteOffset = r.offset;
|
|
604
|
-
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
605
|
-
const obj2 = {
|
|
606
|
-
type: "object",
|
|
607
|
-
byteOffset,
|
|
608
|
-
payloadByteOffset,
|
|
609
|
-
serializationFlags: flags,
|
|
610
|
-
groupId,
|
|
611
|
-
subgroupId: 0n,
|
|
612
|
-
objectId,
|
|
613
|
-
publisherPriority: prevPriority,
|
|
614
|
-
payloadLength,
|
|
615
|
-
payload,
|
|
616
|
-
extensionData
|
|
617
|
-
};
|
|
618
|
-
if (groupDelta2 !== void 0)
|
|
619
|
-
obj2.groupIdDelta = groupDelta2;
|
|
620
|
-
if (objectDelta2 !== void 0)
|
|
621
|
-
obj2.objectIdDelta = objectDelta2;
|
|
622
|
-
if (objectProperties2)
|
|
623
|
-
obj2.objectProperties = objectProperties2;
|
|
624
|
-
objects.push(obj2);
|
|
625
|
-
prevGroupId = groupId;
|
|
626
|
-
prevObjectId = objectId;
|
|
627
|
-
first = false;
|
|
628
|
-
continue;
|
|
629
|
-
}
|
|
630
|
-
const subgroupEncoding = flags & 3;
|
|
631
|
-
const objectIdPresent = (flags & 4) !== 0;
|
|
632
|
-
const groupIdPresent = (flags & 8) !== 0;
|
|
633
|
-
const priorityPresent = (flags & 16) !== 0;
|
|
634
|
-
const propsPresent = (flags & 32) !== 0;
|
|
635
|
-
let groupDelta;
|
|
636
|
-
if (groupIdPresent) {
|
|
637
|
-
groupDelta = r.readVarInt();
|
|
638
|
-
groupId = resolveGroupId(first, groupDelta, prevGroupId, r.offset);
|
|
639
|
-
} else if (first) {
|
|
640
|
-
return {
|
|
641
|
-
ok: false,
|
|
642
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
643
|
-
"CONSTRAINT_VIOLATION",
|
|
644
|
-
"First fetch object must include groupId",
|
|
645
|
-
r.offset
|
|
646
|
-
)
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
if (subgroupEncoding === 0) {
|
|
650
|
-
subgroupId = 0n;
|
|
651
|
-
} else if (subgroupEncoding === 1 || subgroupEncoding === 2) {
|
|
652
|
-
if (first) {
|
|
653
|
-
return {
|
|
654
|
-
ok: false,
|
|
655
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
656
|
-
"CONSTRAINT_VIOLATION",
|
|
657
|
-
"First fetch object cannot reference prior subgroupId",
|
|
658
|
-
r.offset
|
|
659
|
-
)
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
subgroupId = subgroupEncoding === 1 ? prevSubgroupId : prevSubgroupId + 1n;
|
|
663
|
-
} else {
|
|
664
|
-
subgroupId = r.readVarInt();
|
|
665
|
-
}
|
|
666
|
-
let objectDelta;
|
|
667
|
-
if (objectIdPresent) {
|
|
668
|
-
objectDelta = r.readVarInt();
|
|
669
|
-
objectId = resolveObjectId(groupIdPresent, objectDelta, prevObjectId);
|
|
670
|
-
} else if (first) {
|
|
671
|
-
return {
|
|
672
|
-
ok: false,
|
|
673
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
674
|
-
"CONSTRAINT_VIOLATION",
|
|
675
|
-
"First fetch object must include objectId",
|
|
676
|
-
r.offset
|
|
677
|
-
)
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
if (objectId > MAX_U64) {
|
|
681
|
-
return {
|
|
682
|
-
ok: false,
|
|
683
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
684
|
-
"CONSTRAINT_VIOLATION",
|
|
685
|
-
"computed Object ID exceeds 2^64 - 1",
|
|
686
|
-
r.offset
|
|
687
|
-
)
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
if (priorityPresent) {
|
|
691
|
-
prevPriority = r.readUint8();
|
|
692
|
-
}
|
|
693
|
-
let objectProperties;
|
|
694
|
-
if (propsPresent) {
|
|
695
|
-
const propsLen = Number(r.readVarInt());
|
|
696
|
-
if (propsLen > 0) {
|
|
697
|
-
objectProperties = decodeObjectProperties(r, propsLen);
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
payloadLength = Number(r.readVarInt());
|
|
701
|
-
payloadByteOffset = r.offset;
|
|
702
|
-
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
703
|
-
const obj = {
|
|
704
|
-
type: "object",
|
|
705
|
-
byteOffset,
|
|
706
|
-
payloadByteOffset,
|
|
707
|
-
serializationFlags: flags,
|
|
708
|
-
groupId,
|
|
709
|
-
subgroupId,
|
|
710
|
-
objectId,
|
|
711
|
-
publisherPriority: prevPriority,
|
|
712
|
-
payloadLength,
|
|
713
|
-
payload,
|
|
714
|
-
extensionData
|
|
715
|
-
};
|
|
716
|
-
if (groupDelta !== void 0)
|
|
717
|
-
obj.groupIdDelta = groupDelta;
|
|
718
|
-
if (objectDelta !== void 0)
|
|
719
|
-
obj.objectIdDelta = objectDelta;
|
|
720
|
-
if (objectProperties)
|
|
721
|
-
obj.objectProperties = objectProperties;
|
|
722
|
-
objects.push(obj);
|
|
723
|
-
prevGroupId = groupId;
|
|
724
|
-
prevSubgroupId = subgroupId;
|
|
725
|
-
prevObjectId = objectId;
|
|
726
|
-
first = false;
|
|
715
|
+
objects.push(readFetchObject(r, 0, st));
|
|
727
716
|
}
|
|
728
717
|
return {
|
|
729
718
|
ok: true,
|
|
@@ -731,7 +720,7 @@ function decodeFetchStream(bytes) {
|
|
|
731
720
|
bytesRead: r.offset
|
|
732
721
|
};
|
|
733
722
|
} catch (e) {
|
|
734
|
-
if (e instanceof
|
|
723
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
735
724
|
throw e;
|
|
736
725
|
}
|
|
737
726
|
}
|
|
@@ -749,132 +738,125 @@ function decodeDataStream(streamType, bytes) {
|
|
|
749
738
|
}
|
|
750
739
|
}
|
|
751
740
|
}
|
|
741
|
+
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); }
|
|
742
|
+
__init() {this.buf = new Uint8Array(0)}
|
|
743
|
+
/** Bytes written into `buf`. */
|
|
744
|
+
__init2() {this.len = 0}
|
|
745
|
+
/** Consumed prefix of `buf`; `base + offset` is the position in the stream. */
|
|
746
|
+
__init3() {this.offset = 0}
|
|
747
|
+
/** Absolute position of `buf[0]` within the stream. */
|
|
748
|
+
__init4() {this.base = 0}
|
|
749
|
+
get unread() {
|
|
750
|
+
return this.len - this.offset;
|
|
751
|
+
}
|
|
752
|
+
append(chunk) {
|
|
753
|
+
if (this.len + chunk.length > this.buf.length) {
|
|
754
|
+
const live = this.len - this.offset;
|
|
755
|
+
const needed = live + chunk.length;
|
|
756
|
+
let cap = Math.max(4096, this.buf.length);
|
|
757
|
+
while (cap < needed * 2) cap *= 2;
|
|
758
|
+
const next = new Uint8Array(cap);
|
|
759
|
+
next.set(this.buf.subarray(this.offset, this.len), 0);
|
|
760
|
+
this.buf = next;
|
|
761
|
+
this.base += this.offset;
|
|
762
|
+
this.len = live;
|
|
763
|
+
this.offset = 0;
|
|
764
|
+
}
|
|
765
|
+
this.buf.set(chunk, this.len);
|
|
766
|
+
this.len += chunk.length;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* The written bytes, for a reader positioned at `offset`. Bounded by `len`
|
|
770
|
+
* rather than by capacity, so `BufferReader.remaining` counts real bytes and
|
|
771
|
+
* not the spare room after them.
|
|
772
|
+
*/
|
|
773
|
+
written() {
|
|
774
|
+
return this.buf.subarray(0, this.len);
|
|
775
|
+
}
|
|
776
|
+
}, _class);
|
|
752
777
|
function createSubgroupStreamDecoder() {
|
|
753
|
-
|
|
754
|
-
let
|
|
778
|
+
const b = new StreamBuffer();
|
|
779
|
+
let header = null;
|
|
755
780
|
let headerEmitted = false;
|
|
756
781
|
let prevObjectId = -1n;
|
|
757
|
-
let
|
|
758
|
-
|
|
782
|
+
let isFirst = true;
|
|
783
|
+
function emitHeader(controller, h, subgroupId) {
|
|
784
|
+
controller.enqueue({
|
|
785
|
+
type: "subgroup_header",
|
|
786
|
+
headerType: h.streamType,
|
|
787
|
+
trackAlias: h.trackAlias,
|
|
788
|
+
groupId: h.groupId,
|
|
789
|
+
subgroupId,
|
|
790
|
+
publisherPriority: h.publisherPriority,
|
|
791
|
+
...h.endOfGroup ? { endOfGroup: true } : {},
|
|
792
|
+
...h.firstObjectFlag ? { firstObject: true } : {}
|
|
793
|
+
});
|
|
794
|
+
headerEmitted = true;
|
|
795
|
+
}
|
|
759
796
|
return new TransformStream({
|
|
760
797
|
transform(chunk, controller) {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
}
|
|
765
|
-
const newBuffer = new Uint8Array(buffer.length + chunk.length);
|
|
766
|
-
newBuffer.set(buffer, 0);
|
|
767
|
-
newBuffer.set(chunk, buffer.length);
|
|
768
|
-
buffer = newBuffer;
|
|
769
|
-
if (!headerEmitted) {
|
|
798
|
+
b.append(chunk);
|
|
799
|
+
const view = b.written();
|
|
800
|
+
if (header === null) {
|
|
770
801
|
try {
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
if (flagsError !== null) {
|
|
775
|
-
controller.error(new (0, _chunk4XLYCT5Qcjs.DecodeError)("CONSTRAINT_VIOLATION", flagsError, 0));
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
const streamType = Number(typeFlags);
|
|
779
|
-
_propertiesPresent = (streamType & 1) !== 0;
|
|
780
|
-
const subgroupMode = (streamType & 6) >> 1;
|
|
781
|
-
const hasSubgroupField = subgroupMode === 2;
|
|
782
|
-
const hasPriority = (streamType & 32) === 0;
|
|
783
|
-
const trackAlias = r.readVarInt();
|
|
784
|
-
const groupId = r.readVarInt();
|
|
785
|
-
let subgroupId = 0n;
|
|
786
|
-
if (hasSubgroupField) {
|
|
787
|
-
subgroupId = r.readVarInt();
|
|
788
|
-
}
|
|
789
|
-
let publisherPriority = 128;
|
|
790
|
-
if (hasPriority) {
|
|
791
|
-
publisherPriority = r.readUint8();
|
|
792
|
-
}
|
|
793
|
-
controller.enqueue({
|
|
794
|
-
type: "subgroup_header",
|
|
795
|
-
trackAlias,
|
|
796
|
-
groupId,
|
|
797
|
-
subgroupId,
|
|
798
|
-
publisherPriority
|
|
799
|
-
});
|
|
800
|
-
headerEmitted = true;
|
|
801
|
-
offset += r.offset;
|
|
802
|
+
const hr = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
|
|
803
|
+
header = readSubgroupHeader(hr);
|
|
804
|
+
b.offset = hr.offset;
|
|
802
805
|
} catch (e) {
|
|
803
|
-
if (e instanceof
|
|
806
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
804
807
|
return;
|
|
805
808
|
}
|
|
806
809
|
controller.error(e);
|
|
807
810
|
return;
|
|
808
811
|
}
|
|
812
|
+
if (!header.subgroupIsFirstObjId) emitHeader(controller, header, header.subgroupId);
|
|
809
813
|
}
|
|
810
|
-
|
|
814
|
+
const h = header;
|
|
815
|
+
if (h === null) return;
|
|
816
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
|
|
817
|
+
while (r.remaining > 0) {
|
|
818
|
+
const start = r.offset;
|
|
819
|
+
let obj;
|
|
811
820
|
try {
|
|
812
|
-
|
|
813
|
-
const delta = r.readVarInt();
|
|
814
|
-
let objectId;
|
|
815
|
-
if (firstObject) {
|
|
816
|
-
objectId = delta;
|
|
817
|
-
firstObject = false;
|
|
818
|
-
} else {
|
|
819
|
-
objectId = prevObjectId + 1n + delta;
|
|
820
|
-
}
|
|
821
|
-
let extensionData = new Uint8Array(0);
|
|
822
|
-
if (_propertiesPresent) {
|
|
823
|
-
const extLen = Number(r.readVarInt());
|
|
824
|
-
extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
825
|
-
}
|
|
826
|
-
const payloadLength = Number(r.readVarInt());
|
|
827
|
-
const payloadByteOffset = r.offset;
|
|
828
|
-
const payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
829
|
-
controller.enqueue({
|
|
830
|
-
type: "object",
|
|
831
|
-
objectId,
|
|
832
|
-
objectIdDelta: delta,
|
|
833
|
-
payloadLength,
|
|
834
|
-
payload,
|
|
835
|
-
extensionData,
|
|
836
|
-
byteOffset: 0,
|
|
837
|
-
payloadByteOffset
|
|
838
|
-
});
|
|
839
|
-
offset += r.offset;
|
|
840
|
-
prevObjectId = objectId;
|
|
821
|
+
obj = readSubgroupObject(r, h.propertiesPresent, isFirst, prevObjectId, b.base);
|
|
841
822
|
} catch (e) {
|
|
842
|
-
if (e instanceof
|
|
843
|
-
|
|
823
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
824
|
+
b.offset = start;
|
|
825
|
+
return;
|
|
844
826
|
}
|
|
845
827
|
controller.error(e);
|
|
846
828
|
return;
|
|
847
829
|
}
|
|
830
|
+
if (!headerEmitted) emitHeader(controller, h, obj.objectId);
|
|
831
|
+
isFirst = false;
|
|
832
|
+
b.offset = r.offset;
|
|
833
|
+
prevObjectId = obj.objectId;
|
|
834
|
+
controller.enqueue(obj);
|
|
848
835
|
}
|
|
849
836
|
},
|
|
850
837
|
flush(controller) {
|
|
851
|
-
if (
|
|
852
|
-
|
|
838
|
+
if (header !== null && !headerEmitted) emitHeader(controller, header, 0n);
|
|
839
|
+
if (b.unread > 0) {
|
|
840
|
+
controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
853
841
|
}
|
|
854
842
|
}
|
|
855
843
|
});
|
|
856
844
|
}
|
|
857
845
|
function createFetchStreamDecoder() {
|
|
858
|
-
|
|
859
|
-
let offset = 0;
|
|
846
|
+
const b = new StreamBuffer();
|
|
860
847
|
let headerEmitted = false;
|
|
848
|
+
const st = newFetchObjectState();
|
|
861
849
|
return new TransformStream({
|
|
862
850
|
transform(chunk, controller) {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
offset = 0;
|
|
866
|
-
}
|
|
867
|
-
const newBuffer = new Uint8Array(buffer.length + chunk.length);
|
|
868
|
-
newBuffer.set(buffer, 0);
|
|
869
|
-
newBuffer.set(chunk, buffer.length);
|
|
870
|
-
buffer = newBuffer;
|
|
851
|
+
b.append(chunk);
|
|
852
|
+
const view = b.written();
|
|
871
853
|
if (!headerEmitted) {
|
|
872
854
|
try {
|
|
873
|
-
const
|
|
874
|
-
const streamType =
|
|
855
|
+
const r2 = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
|
|
856
|
+
const streamType = r2.readVarInt();
|
|
875
857
|
if (streamType !== FETCH_STREAM_TYPE) {
|
|
876
858
|
controller.error(
|
|
877
|
-
new (0,
|
|
859
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
878
860
|
"CONSTRAINT_VIOLATION",
|
|
879
861
|
`Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
|
|
880
862
|
0
|
|
@@ -882,149 +864,96 @@ function createFetchStreamDecoder() {
|
|
|
882
864
|
);
|
|
883
865
|
return;
|
|
884
866
|
}
|
|
885
|
-
const requestId =
|
|
867
|
+
const requestId = r2.readVarInt();
|
|
886
868
|
controller.enqueue({ type: "fetch_header", requestId });
|
|
887
869
|
headerEmitted = true;
|
|
888
|
-
offset
|
|
870
|
+
b.offset = r2.offset;
|
|
889
871
|
} catch (e) {
|
|
890
|
-
if (e instanceof
|
|
872
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
891
873
|
return;
|
|
892
874
|
}
|
|
893
875
|
controller.error(e);
|
|
894
876
|
return;
|
|
895
877
|
}
|
|
896
878
|
}
|
|
897
|
-
|
|
879
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
|
|
880
|
+
while (r.remaining > 0) {
|
|
881
|
+
const start = r.offset;
|
|
882
|
+
let obj;
|
|
898
883
|
try {
|
|
899
|
-
|
|
900
|
-
const flags = Number(r.readVarInt());
|
|
901
|
-
if (flags >= 128) {
|
|
902
|
-
if (!FETCH_END_OF_RANGE_MARKERS.has(flags)) {
|
|
903
|
-
controller.error(
|
|
904
|
-
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
905
|
-
"CONSTRAINT_VIOLATION",
|
|
906
|
-
`0x${flags.toString(16)} is neither a flag combination below 128 nor one of the three End of Range markers`,
|
|
907
|
-
0
|
|
908
|
-
)
|
|
909
|
-
);
|
|
910
|
-
return;
|
|
911
|
-
}
|
|
912
|
-
r.readVarInt();
|
|
913
|
-
const objectDelta = r.readVarInt();
|
|
914
|
-
const markerPayloadLength = Number(r.readVarInt());
|
|
915
|
-
const markerPayloadByteOffset = r.offset;
|
|
916
|
-
controller.enqueue({
|
|
917
|
-
type: "object",
|
|
918
|
-
objectId: objectDelta,
|
|
919
|
-
objectIdDelta: objectDelta,
|
|
920
|
-
payloadLength: markerPayloadLength,
|
|
921
|
-
payload: new Uint8Array(0),
|
|
922
|
-
extensionData: new Uint8Array(0),
|
|
923
|
-
byteOffset: 0,
|
|
924
|
-
payloadByteOffset: markerPayloadByteOffset
|
|
925
|
-
});
|
|
926
|
-
offset += r.offset;
|
|
927
|
-
continue;
|
|
928
|
-
}
|
|
929
|
-
const objectIdPresent = (flags & 4) !== 0;
|
|
930
|
-
const groupIdPresent = (flags & 8) !== 0;
|
|
931
|
-
const priorityPresent = (flags & 16) !== 0;
|
|
932
|
-
const extensionsPresent = (flags & 32) !== 0;
|
|
933
|
-
const subgroupEncoding = flags & 3;
|
|
934
|
-
const datagramMode = (flags & 64) !== 0;
|
|
935
|
-
if (groupIdPresent) r.readVarInt();
|
|
936
|
-
if (!datagramMode && subgroupEncoding === 3) r.readVarInt();
|
|
937
|
-
let objectId = 0n;
|
|
938
|
-
let objectIdDelta;
|
|
939
|
-
if (objectIdPresent) {
|
|
940
|
-
objectIdDelta = r.readVarInt();
|
|
941
|
-
objectId = objectIdDelta;
|
|
942
|
-
}
|
|
943
|
-
if (priorityPresent) r.readUint8();
|
|
944
|
-
let extensionData = new Uint8Array(0);
|
|
945
|
-
if (extensionsPresent) {
|
|
946
|
-
const extLen = Number(r.readVarInt());
|
|
947
|
-
extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
948
|
-
}
|
|
949
|
-
const payloadLength = Number(r.readVarInt());
|
|
950
|
-
const payloadByteOffset = r.offset;
|
|
951
|
-
const payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
952
|
-
const event = {
|
|
953
|
-
type: "object",
|
|
954
|
-
objectId,
|
|
955
|
-
payloadLength,
|
|
956
|
-
payload,
|
|
957
|
-
extensionData,
|
|
958
|
-
byteOffset: 0,
|
|
959
|
-
payloadByteOffset
|
|
960
|
-
};
|
|
961
|
-
if (objectIdDelta !== void 0)
|
|
962
|
-
event.objectIdDelta = objectIdDelta;
|
|
963
|
-
controller.enqueue(event);
|
|
964
|
-
offset += r.offset;
|
|
884
|
+
obj = readFetchObject(r, b.base, st);
|
|
965
885
|
} catch (e) {
|
|
966
|
-
if (e instanceof
|
|
967
|
-
|
|
886
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
887
|
+
b.offset = start;
|
|
888
|
+
return;
|
|
968
889
|
}
|
|
969
890
|
controller.error(e);
|
|
970
891
|
return;
|
|
971
892
|
}
|
|
893
|
+
b.offset = r.offset;
|
|
894
|
+
controller.enqueue(obj);
|
|
972
895
|
}
|
|
973
896
|
},
|
|
974
897
|
flush(controller) {
|
|
975
|
-
if (
|
|
976
|
-
controller.error(new (0,
|
|
898
|
+
if (b.unread > 0) {
|
|
899
|
+
controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
977
900
|
}
|
|
978
901
|
}
|
|
979
902
|
});
|
|
980
903
|
}
|
|
981
904
|
function createDataStreamDecoder() {
|
|
982
|
-
let
|
|
983
|
-
let
|
|
984
|
-
let
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
if (
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
const decoder = createSubgroupStreamDecoder();
|
|
1000
|
-
inner = decoder;
|
|
1001
|
-
} else if (firstByte === 5) {
|
|
1002
|
-
const decoder = createFetchStreamDecoder();
|
|
1003
|
-
inner = decoder;
|
|
1004
|
-
} else {
|
|
1005
|
-
controller.error(
|
|
1006
|
-
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
1007
|
-
"CONSTRAINT_VIOLATION",
|
|
1008
|
-
`Unknown data stream type: 0x${firstByte.toString(16)}`,
|
|
1009
|
-
0
|
|
1010
|
-
)
|
|
1011
|
-
);
|
|
1012
|
-
return;
|
|
905
|
+
let writer = null;
|
|
906
|
+
let pump = Promise.resolve();
|
|
907
|
+
let broken = false;
|
|
908
|
+
function attach(inner, controller) {
|
|
909
|
+
writer = inner.writable.getWriter();
|
|
910
|
+
const reader = inner.readable.getReader();
|
|
911
|
+
pump = (async () => {
|
|
912
|
+
try {
|
|
913
|
+
for (; ; ) {
|
|
914
|
+
const { done, value } = await reader.read();
|
|
915
|
+
if (done) break;
|
|
916
|
+
controller.enqueue(value);
|
|
917
|
+
}
|
|
918
|
+
} catch (e) {
|
|
919
|
+
if (!broken) {
|
|
920
|
+
broken = true;
|
|
921
|
+
controller.error(e);
|
|
1013
922
|
}
|
|
1014
923
|
}
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
924
|
+
})();
|
|
925
|
+
}
|
|
926
|
+
async function feed(bytes) {
|
|
927
|
+
if (writer === null || broken || bytes.length === 0) return;
|
|
928
|
+
try {
|
|
929
|
+
await writer.write(bytes);
|
|
930
|
+
} catch (e2) {
|
|
931
|
+
broken = true;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
return new TransformStream({
|
|
935
|
+
async transform(chunk, controller) {
|
|
936
|
+
if (broken) return;
|
|
937
|
+
if (writer !== null) {
|
|
938
|
+
await feed(chunk);
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
if (chunk.length === 0) return;
|
|
942
|
+
const firstByte = chunk[0];
|
|
1021
943
|
if (isValidSubgroupType(firstByte)) {
|
|
1022
|
-
|
|
944
|
+
attach(
|
|
945
|
+
createSubgroupStreamDecoder(),
|
|
946
|
+
controller
|
|
947
|
+
);
|
|
1023
948
|
} else if (firstByte === 5) {
|
|
1024
|
-
|
|
949
|
+
attach(
|
|
950
|
+
createFetchStreamDecoder(),
|
|
951
|
+
controller
|
|
952
|
+
);
|
|
1025
953
|
} else {
|
|
954
|
+
broken = true;
|
|
1026
955
|
controller.error(
|
|
1027
|
-
new (0,
|
|
956
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1028
957
|
"CONSTRAINT_VIOLATION",
|
|
1029
958
|
`Unknown data stream type: 0x${firstByte.toString(16)}`,
|
|
1030
959
|
0
|
|
@@ -1032,31 +961,15 @@ function createDataStreamDecoder() {
|
|
|
1032
961
|
);
|
|
1033
962
|
return;
|
|
1034
963
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
type: "subgroup_header",
|
|
1043
|
-
trackAlias: stream.trackAlias,
|
|
1044
|
-
groupId: stream.groupId,
|
|
1045
|
-
subgroupId: stream.subgroupId,
|
|
1046
|
-
publisherPriority: stream.publisherPriority
|
|
1047
|
-
});
|
|
1048
|
-
for (const obj of stream.objects) {
|
|
1049
|
-
controller.enqueue(obj);
|
|
1050
|
-
}
|
|
1051
|
-
} else if (stream.type === "fetch") {
|
|
1052
|
-
controller.enqueue({
|
|
1053
|
-
type: "fetch_header",
|
|
1054
|
-
requestId: stream.requestId
|
|
1055
|
-
});
|
|
1056
|
-
for (const obj of stream.objects) {
|
|
1057
|
-
controller.enqueue(obj);
|
|
1058
|
-
}
|
|
964
|
+
await feed(chunk);
|
|
965
|
+
},
|
|
966
|
+
async flush() {
|
|
967
|
+
if (writer === null) return;
|
|
968
|
+
try {
|
|
969
|
+
await writer.close();
|
|
970
|
+
} catch (e3) {
|
|
1059
971
|
}
|
|
972
|
+
await pump;
|
|
1060
973
|
}
|
|
1061
974
|
});
|
|
1062
975
|
}
|
|
@@ -1079,12 +992,12 @@ function encodeSetupOptions(opts, writer) {
|
|
|
1079
992
|
}
|
|
1080
993
|
});
|
|
1081
994
|
}
|
|
1082
|
-
|
|
995
|
+
for (const token of _nullishCoalesce(opts.authorization_token, () => ( []))) {
|
|
1083
996
|
entries.push({
|
|
1084
997
|
type: SETUP_OPT_AUTHORIZATION_TOKEN,
|
|
1085
998
|
encode: (w) => {
|
|
1086
|
-
const tmpW = new (0,
|
|
1087
|
-
encodeAuthorizationToken(
|
|
999
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(64);
|
|
1000
|
+
encodeAuthorizationToken(token, tmpW);
|
|
1088
1001
|
const raw = tmpW.finish();
|
|
1089
1002
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
1090
1003
|
w.writeBytes(raw);
|
|
@@ -1136,11 +1049,11 @@ function encodeSetupOptions(opts, writer) {
|
|
|
1136
1049
|
type: id,
|
|
1137
1050
|
encode: (w) => {
|
|
1138
1051
|
if (id % 2n === 0n) {
|
|
1139
|
-
const raw =
|
|
1140
|
-
const tmpReader = new (0,
|
|
1052
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1053
|
+
const tmpReader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(raw);
|
|
1141
1054
|
w.writeVarInt(tmpReader.readVarInt());
|
|
1142
1055
|
} else {
|
|
1143
|
-
const raw =
|
|
1056
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1144
1057
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
1145
1058
|
w.writeBytes(raw);
|
|
1146
1059
|
}
|
|
@@ -1173,13 +1086,13 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
1173
1086
|
} else if (optType === SETUP_OPT_MAX_REQUEST_UPDATES) {
|
|
1174
1087
|
result.max_request_updates = value;
|
|
1175
1088
|
} else {
|
|
1176
|
-
const tmpWriter = new (0,
|
|
1089
|
+
const tmpWriter = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(16);
|
|
1177
1090
|
tmpWriter.writeVarInt(value);
|
|
1178
1091
|
const raw = tmpWriter.finish();
|
|
1179
1092
|
unknown.push({
|
|
1180
1093
|
id: `0x${optType.toString(16)}`,
|
|
1181
1094
|
length: raw.byteLength,
|
|
1182
|
-
raw_hex:
|
|
1095
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, raw)
|
|
1183
1096
|
});
|
|
1184
1097
|
}
|
|
1185
1098
|
} else {
|
|
@@ -1188,7 +1101,9 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
1188
1101
|
if (optType === SETUP_OPT_PATH) {
|
|
1189
1102
|
result.path = textDecoder.decode(bytes);
|
|
1190
1103
|
} else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
|
|
1191
|
-
|
|
1104
|
+
const token = decodeAuthorizationToken(new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes));
|
|
1105
|
+
noteAuthTokenValue(reader.offset - length, length, token);
|
|
1106
|
+
result.authorization_token = [..._nullishCoalesce(result.authorization_token, () => ( [])), token];
|
|
1192
1107
|
} else if (optType === SETUP_OPT_AUTHORITY) {
|
|
1193
1108
|
result.authority = textDecoder.decode(bytes);
|
|
1194
1109
|
} else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
|
|
@@ -1197,7 +1112,7 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
1197
1112
|
unknown.push({
|
|
1198
1113
|
id: `0x${optType.toString(16)}`,
|
|
1199
1114
|
length,
|
|
1200
|
-
raw_hex:
|
|
1115
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, bytes)
|
|
1201
1116
|
});
|
|
1202
1117
|
}
|
|
1203
1118
|
}
|
|
@@ -1217,6 +1132,11 @@ function encodeAuthorizationToken(token, w) {
|
|
|
1217
1132
|
w.writeBytes(tv);
|
|
1218
1133
|
}
|
|
1219
1134
|
}
|
|
1135
|
+
function noteAuthTokenValue(valueStart, valueLength, token) {
|
|
1136
|
+
const value = token.token_value;
|
|
1137
|
+
if (value === void 0 || value.byteLength === 0) return;
|
|
1138
|
+
_chunk5IMHJIAZcjs.recordAuthValueSpan.call(void 0, valueStart + valueLength - value.byteLength, value.byteLength);
|
|
1139
|
+
}
|
|
1220
1140
|
function decodeAuthorizationToken(r) {
|
|
1221
1141
|
const alias_type = r.readVarInt();
|
|
1222
1142
|
const aliasType = Number(alias_type);
|
|
@@ -1276,7 +1196,7 @@ function encodeRangeFilter(filter, hasProperty, w) {
|
|
|
1276
1196
|
w.writeVarInt(0n);
|
|
1277
1197
|
return;
|
|
1278
1198
|
}
|
|
1279
|
-
const tmpW = new (0,
|
|
1199
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
|
|
1280
1200
|
tmpW.writeUint8(Number(_nullishCoalesce(filter.set_id, () => ( 0n))));
|
|
1281
1201
|
if (hasProperty) {
|
|
1282
1202
|
tmpW.writeVarInt(_nullishCoalesce(filter.property_type, () => ( 0n)));
|
|
@@ -1323,7 +1243,7 @@ function encodeLocationFilter(f, w) {
|
|
|
1323
1243
|
w.writeVarInt(0n);
|
|
1324
1244
|
return;
|
|
1325
1245
|
}
|
|
1326
|
-
const tmpW = new (0,
|
|
1246
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(48);
|
|
1327
1247
|
if (f.start_group !== void 0) tmpW.writeVarInt(f.start_group);
|
|
1328
1248
|
if (f.start_object !== void 0) tmpW.writeVarInt(f.start_object);
|
|
1329
1249
|
if (f.end_group_delta !== void 0) tmpW.writeVarInt(f.end_group_delta);
|
|
@@ -1338,14 +1258,14 @@ function decodeLocationFilter(reader) {
|
|
|
1338
1258
|
if (length === 0) {
|
|
1339
1259
|
return { removed: true };
|
|
1340
1260
|
}
|
|
1341
|
-
const r = new (0,
|
|
1261
|
+
const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(valueBytes);
|
|
1342
1262
|
const fields = [];
|
|
1343
1263
|
while (r.remaining > 0) {
|
|
1344
1264
|
let value;
|
|
1345
1265
|
try {
|
|
1346
1266
|
value = r.readVarInt();
|
|
1347
|
-
} catch (
|
|
1348
|
-
throw new (0,
|
|
1267
|
+
} catch (e4) {
|
|
1268
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1349
1269
|
"CONSTRAINT_VIOLATION",
|
|
1350
1270
|
"a LOCATION_FILTER field must not extend past the parameter's Length",
|
|
1351
1271
|
reader.offset
|
|
@@ -1353,7 +1273,7 @@ function decodeLocationFilter(reader) {
|
|
|
1353
1273
|
}
|
|
1354
1274
|
fields.push(value);
|
|
1355
1275
|
if (fields.length > 4) {
|
|
1356
|
-
throw new (0,
|
|
1276
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1357
1277
|
"CONSTRAINT_VIOLATION",
|
|
1358
1278
|
"a LOCATION_FILTER value may hold at most four vi64 fields",
|
|
1359
1279
|
reader.offset
|
|
@@ -1367,7 +1287,7 @@ function decodeLocationFilter(reader) {
|
|
|
1367
1287
|
if (fields.length >= 4) filter.end_object = fields[3];
|
|
1368
1288
|
if (filter.start_group !== void 0 && filter.end_group_delta !== void 0) {
|
|
1369
1289
|
if (filter.start_group + filter.end_group_delta > MAX_U642) {
|
|
1370
|
-
throw new (0,
|
|
1290
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1371
1291
|
"CONSTRAINT_VIOLATION",
|
|
1372
1292
|
"StartGroup + EndGroupDelta exceeds 2^64 - 1",
|
|
1373
1293
|
reader.offset
|
|
@@ -1399,24 +1319,24 @@ var PARAMETER_SCOPE = /* @__PURE__ */ new Map([
|
|
|
1399
1319
|
[PARAM_SUBGROUP_DELIVERY_TIMEOUT, /* @__PURE__ */ new Set(["subscribe", "publish", "request_update"])],
|
|
1400
1320
|
// 0x08 EXPIRES (10.2.16) — the one parameter that still names PUBLISH_OK.
|
|
1401
1321
|
[PARAM_EXPIRES, /* @__PURE__ */ new Set(["subscribe_ok", "publish", "request_ok"])],
|
|
1402
|
-
// 0x09 LARGEST_OBJECT (10.2.17) —
|
|
1322
|
+
// 0x09 LARGEST_OBJECT (10.2.17) — PUBLISH_STATE_NOTIFY here; draft-19 (10.2.16) omits it.
|
|
1403
1323
|
[
|
|
1404
1324
|
PARAM_LARGEST_OBJECT,
|
|
1405
1325
|
/* @__PURE__ */ new Set(["subscribe_ok", "publish", "request_ok", "publish_state_notify"])
|
|
1406
1326
|
],
|
|
1407
1327
|
// 0x0A FILL_TIMEOUT (10.2.5) — FETCH, or nested inside FILL_PARAMETERS.
|
|
1408
1328
|
[PARAM_FILL_TIMEOUT, /* @__PURE__ */ new Set(["fetch", FILL_SCOPE])],
|
|
1409
|
-
// 0x10 FORWARD (10.2.18) —
|
|
1329
|
+
// 0x10 FORWARD (10.2.18) — PUBLISH_STATE_NOTIFY here where draft-19 (10.2.17) lists PUBLISH_OK.
|
|
1410
1330
|
[
|
|
1411
1331
|
PARAM_FORWARD,
|
|
1412
1332
|
/* @__PURE__ */ new Set(["subscribe", "request_update", "publish", "subscribe_tracks", "publish_state_notify"])
|
|
1413
1333
|
],
|
|
1414
|
-
// 0x20 SUBSCRIBER_PRIORITY (10.2.7) —
|
|
1334
|
+
// 0x20 SUBSCRIBER_PRIORITY (10.2.7) — PUBLISH here where draft-19 lists PUBLISH_OK.
|
|
1415
1335
|
[
|
|
1416
1336
|
PARAM_SUBSCRIBER_PRIORITY,
|
|
1417
1337
|
/* @__PURE__ */ new Set(["subscribe", "publish", "fetch", "request_update", FILL_SCOPE])
|
|
1418
1338
|
],
|
|
1419
|
-
// 0x21 LOCATION_FILTER (10.2.9) —
|
|
1339
|
+
// 0x21 LOCATION_FILTER (10.2.9) — PUBLISH and PUBLISH_STATE_NOTIFY here where draft-19 lists PUBLISH_OK.
|
|
1420
1340
|
[
|
|
1421
1341
|
PARAM_LOCATION_FILTER,
|
|
1422
1342
|
/* @__PURE__ */ new Set([
|
|
@@ -1428,12 +1348,12 @@ var PARAMETER_SCOPE = /* @__PURE__ */ new Map([
|
|
|
1428
1348
|
FILL_SCOPE
|
|
1429
1349
|
])
|
|
1430
1350
|
],
|
|
1431
|
-
// 0x22 GROUP_ORDER (10.2.8) —
|
|
1351
|
+
// 0x22 GROUP_ORDER (10.2.8) — PUBLISH and FILL_PARAMETERS nesting here; draft-19 has neither.
|
|
1432
1352
|
[PARAM_GROUP_ORDER, /* @__PURE__ */ new Set(["subscribe", "publish", "subscribe_tracks", "fetch", FILL_SCOPE])],
|
|
1433
1353
|
// 0x23 FILL_PARAMETERS (10.2.15) — NEW. Subscriptions only, and never nested
|
|
1434
1354
|
// in itself: a FETCH already is a fetch, so it has nothing to fill.
|
|
1435
1355
|
[PARAM_FILL_PARAMETERS, /* @__PURE__ */ new Set(["subscribe", "request_update"])],
|
|
1436
|
-
// 0x25-0x28 range filters (5.1.4) —
|
|
1356
|
+
// 0x25-0x28 range filters (5.1.4) — permitted inside FILL_PARAMETERS (Table 6).
|
|
1437
1357
|
[
|
|
1438
1358
|
PARAM_SUBGROUP_FILTER,
|
|
1439
1359
|
/* @__PURE__ */ new Set(["fetch", "subscribe", "subscribe_tracks", "request_update", FILL_SCOPE])
|
|
@@ -1450,11 +1370,11 @@ var PARAMETER_SCOPE = /* @__PURE__ */ new Map([
|
|
|
1450
1370
|
PARAM_OBJECT_PROPERTY_FILTER,
|
|
1451
1371
|
/* @__PURE__ */ new Set(["fetch", "subscribe", "subscribe_tracks", "request_update", FILL_SCOPE])
|
|
1452
1372
|
],
|
|
1453
|
-
// 0x29 TRACK_PROPERTY_FILTER (10.2.14) —
|
|
1454
|
-
//
|
|
1455
|
-
// upstream has to strip it rather than trip this rule.
|
|
1373
|
+
// 0x29 TRACK_PROPERTY_FILTER (10.2.14) — NOT permitted inside
|
|
1374
|
+
// FILL_PARAMETERS: Table 6 omits it. A relay forwarding a downstream
|
|
1375
|
+
// FILL_PARAMETERS upstream has to strip it rather than trip this rule.
|
|
1456
1376
|
[PARAM_TRACK_PROPERTY_FILTER, /* @__PURE__ */ new Set(["subscribe_tracks", "request_update"])],
|
|
1457
|
-
// 0x32 NEW_GROUP_REQUEST (10.2.19) —
|
|
1377
|
+
// 0x32 NEW_GROUP_REQUEST (10.2.19) — draft-19 (10.2.18) also lists PUBLISH_OK.
|
|
1458
1378
|
[PARAM_NEW_GROUP_REQUEST, /* @__PURE__ */ new Set(["subscribe", "request_update"])],
|
|
1459
1379
|
// 0x34 TRACK_NAMESPACE_PREFIX (10.2.20) — REQUEST_UPDATE for a namespace subscription.
|
|
1460
1380
|
[PARAM_TRACK_NAMESPACE_PREFIX, /* @__PURE__ */ new Set(["request_update"])],
|
|
@@ -1469,12 +1389,12 @@ function encodeParams(params, writer) {
|
|
|
1469
1389
|
encode: (w) => w.writeVarInt(params.object_delivery_timeout)
|
|
1470
1390
|
});
|
|
1471
1391
|
}
|
|
1472
|
-
|
|
1392
|
+
for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
|
|
1473
1393
|
entries.push({
|
|
1474
1394
|
type: PARAM_AUTHORIZATION_TOKEN,
|
|
1475
1395
|
encode: (w) => {
|
|
1476
|
-
const tmpW = new (0,
|
|
1477
|
-
encodeAuthorizationToken(
|
|
1396
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(64);
|
|
1397
|
+
encodeAuthorizationToken(token, tmpW);
|
|
1478
1398
|
const raw = tmpW.finish();
|
|
1479
1399
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
1480
1400
|
w.writeBytes(raw);
|
|
@@ -1546,7 +1466,7 @@ function encodeParams(params, writer) {
|
|
|
1546
1466
|
entries.push({
|
|
1547
1467
|
type: PARAM_FILL_PARAMETERS,
|
|
1548
1468
|
encode: (w) => {
|
|
1549
|
-
const tmpW = new (0,
|
|
1469
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(64);
|
|
1550
1470
|
encodeParams(params.fill_parameters, tmpW);
|
|
1551
1471
|
const raw = tmpW.finish();
|
|
1552
1472
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -1554,34 +1474,34 @@ function encodeParams(params, writer) {
|
|
|
1554
1474
|
}
|
|
1555
1475
|
});
|
|
1556
1476
|
}
|
|
1557
|
-
|
|
1477
|
+
for (const filter of _nullishCoalesce(params.subgroup_filter, () => ( []))) {
|
|
1558
1478
|
entries.push({
|
|
1559
1479
|
type: PARAM_SUBGROUP_FILTER,
|
|
1560
|
-
encode: (w) => encodeRangeFilter(
|
|
1480
|
+
encode: (w) => encodeRangeFilter(filter, false, w)
|
|
1561
1481
|
});
|
|
1562
1482
|
}
|
|
1563
|
-
|
|
1483
|
+
for (const filter of _nullishCoalesce(params.objectid_filter, () => ( []))) {
|
|
1564
1484
|
entries.push({
|
|
1565
1485
|
type: PARAM_OBJECTID_FILTER,
|
|
1566
|
-
encode: (w) => encodeRangeFilter(
|
|
1486
|
+
encode: (w) => encodeRangeFilter(filter, false, w)
|
|
1567
1487
|
});
|
|
1568
1488
|
}
|
|
1569
|
-
|
|
1489
|
+
for (const filter of _nullishCoalesce(params.priority_filter, () => ( []))) {
|
|
1570
1490
|
entries.push({
|
|
1571
1491
|
type: PARAM_PRIORITY_FILTER,
|
|
1572
|
-
encode: (w) => encodeRangeFilter(
|
|
1492
|
+
encode: (w) => encodeRangeFilter(filter, false, w)
|
|
1573
1493
|
});
|
|
1574
1494
|
}
|
|
1575
|
-
|
|
1495
|
+
for (const filter of _nullishCoalesce(params.object_property_filter, () => ( []))) {
|
|
1576
1496
|
entries.push({
|
|
1577
1497
|
type: PARAM_OBJECT_PROPERTY_FILTER,
|
|
1578
|
-
encode: (w) => encodeRangeFilter(
|
|
1498
|
+
encode: (w) => encodeRangeFilter(filter, true, w)
|
|
1579
1499
|
});
|
|
1580
1500
|
}
|
|
1581
|
-
|
|
1501
|
+
for (const filter of _nullishCoalesce(params.track_property_filter, () => ( []))) {
|
|
1582
1502
|
entries.push({
|
|
1583
1503
|
type: PARAM_TRACK_PROPERTY_FILTER,
|
|
1584
|
-
encode: (w) => encodeRangeFilter(
|
|
1504
|
+
encode: (w) => encodeRangeFilter(filter, true, w)
|
|
1585
1505
|
});
|
|
1586
1506
|
}
|
|
1587
1507
|
if (params.new_group_request !== void 0) {
|
|
@@ -1614,7 +1534,7 @@ function encodeParams(params, writer) {
|
|
|
1614
1534
|
entries.push({
|
|
1615
1535
|
type: id,
|
|
1616
1536
|
encode: (w) => {
|
|
1617
|
-
const raw =
|
|
1537
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1618
1538
|
w.writeBytes(raw);
|
|
1619
1539
|
}
|
|
1620
1540
|
});
|
|
@@ -1639,7 +1559,7 @@ function decodeParams(reader, messageType) {
|
|
|
1639
1559
|
prevType = paramType;
|
|
1640
1560
|
const scope = PARAMETER_SCOPE.get(paramType);
|
|
1641
1561
|
if (scope !== void 0 && !scope.has(messageType)) {
|
|
1642
|
-
throw new (0,
|
|
1562
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1643
1563
|
"CONSTRAINT_VIOLATION",
|
|
1644
1564
|
`Message Parameter 0x${paramType.toString(16)} may not appear in ${messageType}`,
|
|
1645
1565
|
reader.offset
|
|
@@ -1650,7 +1570,9 @@ function decodeParams(reader, messageType) {
|
|
|
1650
1570
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
1651
1571
|
const length = Number(reader.readVarInt());
|
|
1652
1572
|
const bytes = reader.readBytes(length);
|
|
1653
|
-
|
|
1573
|
+
const token = decodeAuthorizationToken(new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes));
|
|
1574
|
+
noteAuthTokenValue(reader.offset - length, length, token);
|
|
1575
|
+
result.authorization_token = [..._nullishCoalesce(result.authorization_token, () => ( [])), token];
|
|
1654
1576
|
} else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
|
|
1655
1577
|
result.rendezvous_timeout = reader.readVarInt();
|
|
1656
1578
|
} else if (paramType === PARAM_SUBGROUP_DELIVERY_TIMEOUT) {
|
|
@@ -1674,15 +1596,21 @@ function decodeParams(reader, messageType) {
|
|
|
1674
1596
|
} else if (paramType === PARAM_FILL_PARAMETERS) {
|
|
1675
1597
|
result.fill_parameters = decodeFillParameters(reader);
|
|
1676
1598
|
} else if (paramType === PARAM_SUBGROUP_FILTER) {
|
|
1677
|
-
result.subgroup_filter = decodeRangeFilter(reader, false);
|
|
1599
|
+
result.subgroup_filter = [..._nullishCoalesce(result.subgroup_filter, () => ( [])), decodeRangeFilter(reader, false)];
|
|
1678
1600
|
} else if (paramType === PARAM_OBJECTID_FILTER) {
|
|
1679
|
-
result.objectid_filter = decodeRangeFilter(reader, false);
|
|
1601
|
+
result.objectid_filter = [..._nullishCoalesce(result.objectid_filter, () => ( [])), decodeRangeFilter(reader, false)];
|
|
1680
1602
|
} else if (paramType === PARAM_PRIORITY_FILTER) {
|
|
1681
|
-
result.priority_filter = decodeRangeFilter(reader, false);
|
|
1603
|
+
result.priority_filter = [..._nullishCoalesce(result.priority_filter, () => ( [])), decodeRangeFilter(reader, false)];
|
|
1682
1604
|
} else if (paramType === PARAM_OBJECT_PROPERTY_FILTER) {
|
|
1683
|
-
result.object_property_filter =
|
|
1605
|
+
result.object_property_filter = [
|
|
1606
|
+
..._nullishCoalesce(result.object_property_filter, () => ( [])),
|
|
1607
|
+
decodeRangeFilter(reader, true)
|
|
1608
|
+
];
|
|
1684
1609
|
} else if (paramType === PARAM_TRACK_PROPERTY_FILTER) {
|
|
1685
|
-
result.track_property_filter =
|
|
1610
|
+
result.track_property_filter = [
|
|
1611
|
+
..._nullishCoalesce(result.track_property_filter, () => ( [])),
|
|
1612
|
+
decodeRangeFilter(reader, true)
|
|
1613
|
+
];
|
|
1686
1614
|
} else if (paramType === PARAM_NEW_GROUP_REQUEST) {
|
|
1687
1615
|
result.new_group_request = reader.readVarInt();
|
|
1688
1616
|
} else if (paramType === PARAM_TRACK_NAMESPACE_PREFIX) {
|
|
@@ -1690,7 +1618,7 @@ function decodeParams(reader, messageType) {
|
|
|
1690
1618
|
} else if (paramType === PARAM_INCLUDE_PROPERTIES) {
|
|
1691
1619
|
const value = BigInt(reader.readUint8());
|
|
1692
1620
|
if (value !== 0n && value !== 1n) {
|
|
1693
|
-
throw new (0,
|
|
1621
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1694
1622
|
"CONSTRAINT_VIOLATION",
|
|
1695
1623
|
`INCLUDE_PROPERTIES accepts only 0 or 1, got ${value}`,
|
|
1696
1624
|
reader.offset
|
|
@@ -1698,7 +1626,7 @@ function decodeParams(reader, messageType) {
|
|
|
1698
1626
|
}
|
|
1699
1627
|
result.include_properties = value;
|
|
1700
1628
|
} else {
|
|
1701
|
-
throw new (0,
|
|
1629
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1702
1630
|
"INVALID_PARAMETER",
|
|
1703
1631
|
`Unknown Message Parameter type 0x${paramType.toString(16)}`,
|
|
1704
1632
|
reader.offset
|
|
@@ -1710,10 +1638,10 @@ function decodeParams(reader, messageType) {
|
|
|
1710
1638
|
function decodeFillParameters(reader) {
|
|
1711
1639
|
const length = Number(reader.readVarInt());
|
|
1712
1640
|
const valueBytes = reader.readBytes(length);
|
|
1713
|
-
const nested = new (0,
|
|
1714
|
-
const params = decodeParams(nested, FILL_SCOPE);
|
|
1641
|
+
const nested = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(valueBytes);
|
|
1642
|
+
const params = _chunk5IMHJIAZcjs.withoutAuthValueSpans.call(void 0, () => decodeParams(nested, FILL_SCOPE));
|
|
1715
1643
|
if (nested.remaining > 0) {
|
|
1716
|
-
throw new (0,
|
|
1644
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1717
1645
|
"CONSTRAINT_VIOLATION",
|
|
1718
1646
|
`FILL_PARAMETERS has ${nested.remaining} trailing byte(s) after its parameter block`,
|
|
1719
1647
|
reader.offset
|
|
@@ -1783,11 +1711,11 @@ function encodeTrackProperties(props, writer) {
|
|
|
1783
1711
|
type: id,
|
|
1784
1712
|
encode: (w) => {
|
|
1785
1713
|
if (id % 2n === 0n) {
|
|
1786
|
-
const raw =
|
|
1787
|
-
const tmpReader = new (0,
|
|
1714
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1715
|
+
const tmpReader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(raw);
|
|
1788
1716
|
w.writeVarInt(tmpReader.readVarInt());
|
|
1789
1717
|
} else {
|
|
1790
|
-
const raw =
|
|
1718
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1791
1719
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
1792
1720
|
w.writeBytes(raw);
|
|
1793
1721
|
}
|
|
@@ -1826,13 +1754,13 @@ function decodeTrackProperties(reader, payloadEnd) {
|
|
|
1826
1754
|
} else if (propType === TPROP_DYNAMIC_GROUPS) {
|
|
1827
1755
|
result.dynamic_groups = value;
|
|
1828
1756
|
} else {
|
|
1829
|
-
const tmpWriter = new (0,
|
|
1757
|
+
const tmpWriter = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(16);
|
|
1830
1758
|
tmpWriter.writeVarInt(value);
|
|
1831
1759
|
const raw = tmpWriter.finish();
|
|
1832
1760
|
unknown.push({
|
|
1833
1761
|
id: `0x${propType.toString(16)}`,
|
|
1834
1762
|
length: raw.byteLength,
|
|
1835
|
-
raw_hex:
|
|
1763
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, raw)
|
|
1836
1764
|
});
|
|
1837
1765
|
}
|
|
1838
1766
|
} else {
|
|
@@ -1844,7 +1772,7 @@ function decodeTrackProperties(reader, payloadEnd) {
|
|
|
1844
1772
|
unknown.push({
|
|
1845
1773
|
id: `0x${propType.toString(16)}`,
|
|
1846
1774
|
length,
|
|
1847
|
-
raw_hex:
|
|
1775
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, bytes)
|
|
1848
1776
|
});
|
|
1849
1777
|
}
|
|
1850
1778
|
}
|
|
@@ -2135,13 +2063,13 @@ function encodeMessage(message) {
|
|
|
2135
2063
|
if (typeId === void 0) {
|
|
2136
2064
|
throw new Error(`Unknown message type: ${message.type}`);
|
|
2137
2065
|
}
|
|
2138
|
-
const payloadWriter = new (0,
|
|
2066
|
+
const payloadWriter = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
|
|
2139
2067
|
encodePayload(message, payloadWriter);
|
|
2140
2068
|
const payload = payloadWriter.finishView();
|
|
2141
2069
|
if (payload.byteLength > 65535) {
|
|
2142
2070
|
throw new Error(`Payload too large for 16-bit length: ${payload.byteLength}`);
|
|
2143
2071
|
}
|
|
2144
|
-
const writer = new (0,
|
|
2072
|
+
const writer = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(payload.byteLength + 16);
|
|
2145
2073
|
writer.writeVarInt(typeId);
|
|
2146
2074
|
writer.writeUint8(payload.byteLength >> 8 & 255);
|
|
2147
2075
|
writer.writeUint8(payload.byteLength & 255);
|
|
@@ -2196,13 +2124,13 @@ function encodePayload(msg, w) {
|
|
|
2196
2124
|
}
|
|
2197
2125
|
function decodeMessage(bytes) {
|
|
2198
2126
|
try {
|
|
2199
|
-
const reader = new (0,
|
|
2127
|
+
const reader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
|
|
2200
2128
|
const typeId = reader.readVarInt();
|
|
2201
2129
|
const lenHi = reader.readUint8();
|
|
2202
2130
|
const lenLo = reader.readUint8();
|
|
2203
2131
|
const payloadLength = lenHi << 8 | lenLo;
|
|
2204
2132
|
const payloadBytes = reader.readBytes(payloadLength);
|
|
2205
|
-
const payloadReader = new (0,
|
|
2133
|
+
const payloadReader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(payloadBytes);
|
|
2206
2134
|
let message;
|
|
2207
2135
|
if (typeId === MSG_SETUP) {
|
|
2208
2136
|
message = decodeSetupPayload(payloadReader, payloadLength);
|
|
@@ -2245,7 +2173,7 @@ function decodeMessage(bytes) {
|
|
|
2245
2173
|
} else {
|
|
2246
2174
|
return {
|
|
2247
2175
|
ok: false,
|
|
2248
|
-
error: new (0,
|
|
2176
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
2249
2177
|
"UNKNOWN_MESSAGE_TYPE",
|
|
2250
2178
|
`Unknown message type ID: 0x${typeId.toString(16)}`,
|
|
2251
2179
|
0
|
|
@@ -2254,7 +2182,7 @@ function decodeMessage(bytes) {
|
|
|
2254
2182
|
}
|
|
2255
2183
|
return { ok: true, value: message, bytesRead: reader.offset };
|
|
2256
2184
|
} catch (e) {
|
|
2257
|
-
if (e instanceof
|
|
2185
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) {
|
|
2258
2186
|
return { ok: false, error: e };
|
|
2259
2187
|
}
|
|
2260
2188
|
throw e;
|
|
@@ -2289,7 +2217,7 @@ function createStreamDecoder() {
|
|
|
2289
2217
|
flush(controller) {
|
|
2290
2218
|
if (offset < buffer.length) {
|
|
2291
2219
|
controller.error(
|
|
2292
|
-
new (0,
|
|
2220
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete message data", 0)
|
|
2293
2221
|
);
|
|
2294
2222
|
}
|
|
2295
2223
|
}
|
|
@@ -2313,6 +2241,20 @@ function createDraft20Codec() {
|
|
|
2313
2241
|
createDataStreamDecoder
|
|
2314
2242
|
};
|
|
2315
2243
|
}
|
|
2244
|
+
function redactAuthTokens(bytes) {
|
|
2245
|
+
let payloadStart;
|
|
2246
|
+
try {
|
|
2247
|
+
const probe = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
|
|
2248
|
+
probe.readVarInt();
|
|
2249
|
+
probe.readUint8();
|
|
2250
|
+
probe.readUint8();
|
|
2251
|
+
payloadStart = probe.offset;
|
|
2252
|
+
} catch (e5) {
|
|
2253
|
+
return { bytes, redacted: 0, incomplete: false, decoded: false };
|
|
2254
|
+
}
|
|
2255
|
+
return _chunk5IMHJIAZcjs.redactWith.call(void 0, bytes, payloadStart, () => decodeMessage(bytes).ok);
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2316
2258
|
|
|
2317
2259
|
|
|
2318
2260
|
|
|
@@ -2359,4 +2301,4 @@ function createDraft20Codec() {
|
|
|
2359
2301
|
|
|
2360
2302
|
|
|
2361
2303
|
|
|
2362
|
-
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_SKIPPED = MSG_PUBLISH_SKIPPED; 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_STATE_NOTIFY = MSG_PUBLISH_STATE_NOTIFY; 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_MAX_FILTER_RANGES = SETUP_OPT_MAX_FILTER_RANGES; exports.SETUP_OPT_MOQT_IMPLEMENTATION = SETUP_OPT_MOQT_IMPLEMENTATION; exports.SETUP_OPT_MAX_REQUEST_UPDATES = SETUP_OPT_MAX_REQUEST_UPDATES; 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.UNKNOWN_STREAM_COUNT = UNKNOWN_STREAM_COUNT; exports.encodeMessage = encodeMessage; exports.decodeMessage = decodeMessage; exports.createStreamDecoder = createStreamDecoder; exports.createDraft20Codec = createDraft20Codec;
|
|
2304
|
+
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_SKIPPED = MSG_PUBLISH_SKIPPED; 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_STATE_NOTIFY = MSG_PUBLISH_STATE_NOTIFY; 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_MAX_FILTER_RANGES = SETUP_OPT_MAX_FILTER_RANGES; exports.SETUP_OPT_MOQT_IMPLEMENTATION = SETUP_OPT_MOQT_IMPLEMENTATION; exports.SETUP_OPT_MAX_REQUEST_UPDATES = SETUP_OPT_MAX_REQUEST_UPDATES; 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.UNKNOWN_STREAM_COUNT = UNKNOWN_STREAM_COUNT; exports.encodeMessage = encodeMessage; exports.decodeMessage = decodeMessage; exports.createStreamDecoder = createStreamDecoder; exports.createDraft20Codec = createDraft20Codec; exports.redactAuthTokens = redactAuthTokens;
|