@blockcast/mmt-container 0.4.1 → 0.5.0-main.34c7b9c2cfa0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/browser-runtime.js +3769 -364
- package/dist/browser-runtime.js.map +4 -4
- package/dist/cmcd-producer.d.ts +5 -1
- package/dist/cmcd-producer.d.ts.map +1 -1
- package/dist/cmcd-producer.js.map +2 -2
- package/dist/delivery-catalog.js +18 -2
- package/dist/delivery-catalog.js.map +2 -2
- package/dist/fec-manager.d.ts +21 -16
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +197 -80
- package/dist/fec-manager.js.map +3 -3
- package/dist/held-layer-admission.d.ts +58 -0
- package/dist/held-layer-admission.d.ts.map +1 -0
- package/dist/held-layer-admission.js +105 -0
- package/dist/held-layer-admission.js.map +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +2 -2
- package/dist/mmtp-container-parser.d.ts +10 -0
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +31 -1
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +2713 -1024
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +31 -1
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-fec-session.d.ts +36 -3
- package/dist/mmtp-fec-session.d.ts.map +1 -1
- package/dist/mmtp-fec-session.js +114 -5
- package/dist/mmtp-fec-session.js.map +3 -3
- package/dist/mmtp-router.d.ts +96 -29
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +522 -205
- package/dist/mmtp-router.js.map +2 -2
- package/dist/multicast-auth-catalog.d.ts +10 -2
- package/dist/multicast-auth-catalog.d.ts.map +1 -1
- package/dist/multicast-auth-catalog.js +422 -22
- package/dist/multicast-auth-catalog.js.map +4 -4
- package/dist/multicast-manager.d.ts +78 -11
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +3663 -333
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +4 -1
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +20 -3
- package/dist/multicast-transport.js.map +2 -2
- package/dist/no-modules.d.ts +1 -2
- package/dist/no-modules.d.ts.map +1 -1
- package/dist/no-modules.js +2699 -1008
- package/dist/no-modules.js.map +4 -4
- package/dist/repair-fetch.d.ts +50 -10
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +62 -20
- package/dist/repair-fetch.js.map +2 -2
- package/dist/wasm-mmtp-container-parser.js +31 -1
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +7 -15
- package/src/cmcd-producer.ts +6 -1
- package/src/fec-manager.ts +147 -131
- package/src/held-layer-admission.ts +161 -0
- package/src/index.ts +6 -9
- package/src/mmtp-container-parser.ts +48 -0
- package/src/mmtp-fec-session.ts +76 -3
- package/src/mmtp-router.ts +637 -274
- package/src/multicast-auth-catalog.ts +81 -8
- package/src/multicast-manager.ts +274 -49
- package/src/multicast-transport.ts +6 -2
- package/src/no-modules.ts +1 -6
- package/src/repair-fetch.ts +154 -34
- package/test-vectors/catalog/negative/multicast-auth-padded-key.json +0 -1
- package/test-vectors/catalog/negative/multicast-auth-reused-track-format.json +0 -1
- package/test-vectors/catalog/negative/multicast-auth-root-dotted-key.json +0 -1
- package/test-vectors/catalog/negative/multicast-auth-trailing-pad-bits.json +0 -1
- package/test-vectors/repair-policy-v1.json +113 -0
- package/dist/manifest-auth-plan.d.ts +0 -31
- package/dist/manifest-auth-plan.d.ts.map +0 -1
- package/dist/manifest-auth-plan.js +0 -426
- package/dist/manifest-auth-plan.js.map +0 -7
- package/dist/source-auth.d.ts +0 -2
- package/dist/source-auth.d.ts.map +0 -1
- package/dist/source-auth.js +0 -3912
- package/dist/source-auth.js.map +0 -7
- package/src/manifest-auth-plan.ts +0 -55
- package/src/source-auth.ts +0 -1
- package/test-vectors/generate-source-auth-fixture.mjs +0 -114
- package/test-vectors/source-auth-v1.json +0 -61
package/dist/repair-fetch.d.ts
CHANGED
|
@@ -22,15 +22,23 @@
|
|
|
22
22
|
* everything.
|
|
23
23
|
*
|
|
24
24
|
* Priority (from the block's class, see `repairPriorityForClass`):
|
|
25
|
-
* - P0 (keyframe / unknown)
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
25
|
+
* - P0 (keyframe / unknown) dispatches as soon as it is enqueued, with no
|
|
26
|
+
* cap. Each has its own fail deadline, and a cap would turn a
|
|
27
|
+
* recoverable protected block into a stall; their number is already
|
|
28
|
+
* bounded by the blocks one fail window can hold. A P0 block that lies
|
|
29
|
+
* below a RAP the receiver already holds complete is not requested at
|
|
30
|
+
* all (`moot-rap`), and a P0 FETCH still running when such a RAP
|
|
31
|
+
* arrives is cancelled (`repair-stopped`, `moot`): the receiver resumes
|
|
32
|
+
* from that RAP (draft-ramadan-moq-fec §11.4.2).
|
|
33
|
+
* - P1 (audio) dispatches, uncapped, while no P0 is queued or in flight;
|
|
34
|
+
* P2 (delta) only while no P0/P1 is, earliest absolute fail deadline
|
|
35
|
+
* first (§11.4.5 item 3).
|
|
36
|
+
* - Only a P0 FETCH the scheduler actually sends aborts the in-flight P1
|
|
37
|
+
* and P2 FETCHes (`repair-preempted`), which return to the queue while
|
|
38
|
+
* their blocks are unresolved: a keyframe request that is refused, moot
|
|
39
|
+
* or otherwise never sent cancels nothing (§11.4.5 item 3), and an audio
|
|
40
|
+
* request never preempts. A P2 that never ran before its block resolved
|
|
41
|
+
* is reported as `repair-deferred`.
|
|
34
42
|
* - A block reclassified to a higher class while its P2 fetch is in flight
|
|
35
43
|
* is re-issued at once under the new class's wire priority: the running
|
|
36
44
|
* FETCH is aborted (FETCH_CANCEL) and a new one sent.
|
|
@@ -338,7 +346,19 @@ export type RepairSkipReason =
|
|
|
338
346
|
/** The player gave no usable presentation delay for the block's stream. */
|
|
339
347
|
| 'presentation-delay-unavailable'
|
|
340
348
|
/** A lost SS_ID in an undelimited span had no §7.5 anchor to extend it from. */
|
|
341
|
-
| 'range-no-anchor'
|
|
349
|
+
| 'range-no-anchor'
|
|
350
|
+
/**
|
|
351
|
+
* The block lost more sources than its repair group carries symbols
|
|
352
|
+
* (sources + RSB_length < K'): no FETCH of the group can complete it, and
|
|
353
|
+
* when multicast already delivered the whole group the relay could serve
|
|
354
|
+
* only duplicates (BLO-50082).
|
|
355
|
+
*/
|
|
356
|
+
| 'group-cannot-complete'
|
|
357
|
+
/**
|
|
358
|
+
* The keyframe-bearing block lies below a RAP the receiver already holds
|
|
359
|
+
* complete, so its repair would be moot (draft-ramadan-moq-fec §11.4.2).
|
|
360
|
+
*/
|
|
361
|
+
| 'moot-rap';
|
|
342
362
|
/**
|
|
343
363
|
* Which term set a FETCH's deadline (BLO-33597): the multicast wait, the
|
|
344
364
|
* player's presentation delay past the block anchor, the keyframe budget past
|
|
@@ -407,6 +427,8 @@ export interface RepairFetchHost {
|
|
|
407
427
|
closeIsoHoles?(packetId: number, catalogTrackName: string | undefined, start: number, length: number): void;
|
|
408
428
|
clearRepairForBlock(sbn: number, packetId: number, catalogTrackName?: string): void;
|
|
409
429
|
processRepairFromMoQ(packet: Uint8Array, ownerPacketId?: number, catalogTrackName?: string): void;
|
|
430
|
+
/** This scheduler can request unicast repair: protected flows keep pending entries for it (optional). */
|
|
431
|
+
setUnicastRepair?(enabled: boolean): void;
|
|
410
432
|
noteRepairScheduling(type: 'repair-preempted' | 'repair-deferred', sbn: number, packetId: number, catalogTrackName?: string): void;
|
|
411
433
|
/** A request whose wire priority the catalog could not supply. */
|
|
412
434
|
noteRepairPriority(action: 'omitted' | 'declined', reason: RepairPriorityReason, blockClass: BlockClass, sbn: number, packetId: number, catalogTrackName?: string): void;
|
|
@@ -420,12 +442,30 @@ export interface RepairFetchHost {
|
|
|
420
442
|
readonly budgetMs: number;
|
|
421
443
|
readonly priority?: RepairPriority;
|
|
422
444
|
}, sbn: number, packetId: number, catalogTrackName?: string): void;
|
|
445
|
+
/** A running FETCH the scheduler stopped, and why (optional). */
|
|
446
|
+
noteRepairStopped?(reason: RepairStopReason, sbn: number, packetId: number, catalogTrackName?: string): void;
|
|
447
|
+
/**
|
|
448
|
+
* Whether a complete RAP above SS_ID `ssId` already reached the stream
|
|
449
|
+
* (optional; absent, none ever has). Under the bc-provenance profile only
|
|
450
|
+
* an admitted RAP counts (multicast-01 §7.2.7).
|
|
451
|
+
*/
|
|
452
|
+
rapCompleteAbove?(packetId: number, catalogTrackName: string | undefined, ssId: number): boolean;
|
|
453
|
+
/** Observe each complete RAP reaching a stream (optional; called synchronously). */
|
|
454
|
+
addRapCompleteObserver?(observer: (packetId: number, catalogTrackName: string | undefined, ssId: number) => void): () => void;
|
|
423
455
|
/**
|
|
424
456
|
* A FETCH the scheduler admitted and handed to the transport (optional):
|
|
425
457
|
* every attempt, a retry or a reprioritised restart included.
|
|
426
458
|
*/
|
|
427
459
|
noteRepairFetchSent?(priority: RepairPriority, sbn: number, packetId: number, catalogTrackName: string | undefined, measurement: RepairSendMeasurement): void;
|
|
428
460
|
}
|
|
461
|
+
/**
|
|
462
|
+
* Why the scheduler ended a running FETCH (the transport cancels it on the
|
|
463
|
+
* wire): preempted by a sent keyframe FETCH, reissued at a new class's
|
|
464
|
+
* priority, past its deadline, its block resolved, track reset or a newer
|
|
465
|
+
* request for the block, dispose, or `moot` (a RAP above the block arrived
|
|
466
|
+
* complete first, draft-ramadan-moq-fec §11.4.2).
|
|
467
|
+
*/
|
|
468
|
+
export type RepairStopReason = 'preempted' | 'reprioritized' | 'expired' | 'resolved' | 'reset' | 'disposed' | 'moot';
|
|
429
469
|
/**
|
|
430
470
|
* Wire the D-28 repair-fetch scheduler onto a MulticastManager.
|
|
431
471
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repair-fetch.d.ts","sourceRoot":"","sources":["../src/repair-fetch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"repair-fetch.d.ts","sourceRoot":"","sources":["../src/repair-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AAEH,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAgC,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACxF,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAMrE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,QAA0B,CAAA;AAEhE,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CACvC;AAED;;;;;;;8DAO8D;AAC9D,MAAM,MAAM,mBAAmB,GAAG,CAChC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,MAAM,KACtB,YAAY,GAAG,IAAI,CAAA;AAExB,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;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Fetch(mc, opts) {
|
|
|
84
84
|
if (opts.rangeTransport !== void 0 && (typeof opts.repairEpochReference !== "function" || !mc.onUndelimitedLoss || !mc.closeIsoHoles)) {
|
|
85
85
|
throw new Error("[RepairFetch] rangeTransport needs repairEpochReference and a host that reports undelimited losses");
|
|
86
86
|
}
|
|
87
|
+
mc.setUnicastRepair?.(true);
|
|
87
88
|
const entries = /* @__PURE__ */ new Map();
|
|
88
89
|
const warnedNoTarget = /* @__PURE__ */ new Set();
|
|
89
90
|
let disposed = false;
|
|
@@ -113,6 +114,34 @@ function wireRepairFetch(mc, opts) {
|
|
|
113
114
|
run.stopped = reason;
|
|
114
115
|
run.controller.abort();
|
|
115
116
|
if (reason === "preempted") releaseHold(entry);
|
|
117
|
+
mc.noteRepairStopped?.(reason, entry.sbn, entry.packetId, entry.catalogTrackName);
|
|
118
|
+
};
|
|
119
|
+
const lastSsId = (entry) => {
|
|
120
|
+
if (entry.range) return entry.sbn + entry.range.holeLength - 1;
|
|
121
|
+
const length = symbolCounts(entry.sbn, entry.packetId, entry.catalogTrackName)?.authoredLength;
|
|
122
|
+
return length === void 0 ? void 0 : entry.sbn + length - 1;
|
|
123
|
+
};
|
|
124
|
+
const moot = (entry) => {
|
|
125
|
+
if (entry.priority !== 0) return false;
|
|
126
|
+
const last = lastSsId(entry);
|
|
127
|
+
if (last === void 0) return false;
|
|
128
|
+
try {
|
|
129
|
+
return mc.rapCompleteAbove?.(entry.packetId, entry.catalogTrackName, last) === true;
|
|
130
|
+
} catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const skip = (entry, reason, rttMs, budgetMs) => {
|
|
135
|
+
retire(entry);
|
|
136
|
+
releaseHold(entry);
|
|
137
|
+
clearEntry(entry);
|
|
138
|
+
mc.noteRepairSkipped(
|
|
139
|
+
reason,
|
|
140
|
+
{ rttMs, budgetMs, priority: entry.priority },
|
|
141
|
+
entry.sbn,
|
|
142
|
+
entry.packetId,
|
|
143
|
+
entry.catalogTrackName
|
|
144
|
+
);
|
|
116
145
|
};
|
|
117
146
|
const readKeyframeBudget = (packetId, catalogTrackName) => {
|
|
118
147
|
const reader = opts.keyframeRepairBudgetMs;
|
|
@@ -135,32 +164,24 @@ function wireRepairFetch(mc, opts) {
|
|
|
135
164
|
const admit = (entry, now) => {
|
|
136
165
|
const budgetMs = entry.deadlineAt - now;
|
|
137
166
|
const rttMs = readRtt();
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
clearEntry(entry);
|
|
142
|
-
mc.noteRepairSkipped(
|
|
143
|
-
rttMs === null ? "rtt-unmeasured" : "rtt-exceeds-budget",
|
|
144
|
-
{ rttMs, budgetMs, priority: entry.priority },
|
|
145
|
-
entry.sbn,
|
|
146
|
-
entry.packetId,
|
|
147
|
-
entry.catalogTrackName
|
|
148
|
-
);
|
|
167
|
+
const reason = !entry.range && !groupCanComplete(entry.sbn, entry.packetId, entry.catalogTrackName) ? "group-cannot-complete" : rttMs === null ? "rtt-unmeasured" : rttMs < budgetMs ? null : "rtt-exceeds-budget";
|
|
168
|
+
if (reason === null) return rttMs;
|
|
169
|
+
skip(entry, reason, rttMs, budgetMs);
|
|
149
170
|
return null;
|
|
150
171
|
};
|
|
151
172
|
const retire = (entry) => {
|
|
152
173
|
if (entries.get(entry.key) === entry) entries.delete(entry.key);
|
|
153
174
|
if (entry.expiry !== void 0) clearTimeout(entry.expiry);
|
|
154
175
|
};
|
|
155
|
-
const
|
|
176
|
+
const outstandingBelow = (priority) => {
|
|
156
177
|
for (const entry of entries.values()) {
|
|
157
|
-
if (entry.priority <
|
|
178
|
+
if (entry.priority < priority) return true;
|
|
158
179
|
}
|
|
159
180
|
return false;
|
|
160
181
|
};
|
|
161
|
-
const
|
|
182
|
+
const preemptBestEffort = () => {
|
|
162
183
|
for (const entry of entries.values()) {
|
|
163
|
-
if (entry.priority
|
|
184
|
+
if (entry.priority === 0 || !entry.running) continue;
|
|
164
185
|
stop(entry, "preempted");
|
|
165
186
|
note("repair-preempted", entry);
|
|
166
187
|
}
|
|
@@ -180,8 +201,13 @@ function wireRepairFetch(mc, opts) {
|
|
|
180
201
|
};
|
|
181
202
|
const start = (entry, counted = true) => {
|
|
182
203
|
const now = performance.now();
|
|
204
|
+
if (moot(entry)) {
|
|
205
|
+
skip(entry, "moot-rap", readRtt(), entry.deadlineAt - now);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
183
208
|
const rttMs = admit(entry, now);
|
|
184
209
|
if (rttMs === null) return;
|
|
210
|
+
if (entry.priority === 0) preemptBestEffort();
|
|
185
211
|
if (counted) entry.attempts++;
|
|
186
212
|
mc.noteRepairFetchSent?.(entry.priority, entry.sbn, entry.packetId, entry.catalogTrackName, {
|
|
187
213
|
rttMs,
|
|
@@ -225,9 +251,13 @@ function wireRepairFetch(mc, opts) {
|
|
|
225
251
|
queued.push(entry);
|
|
226
252
|
}
|
|
227
253
|
for (const entry of queued) {
|
|
228
|
-
if (entry.priority
|
|
254
|
+
if (entry.priority === 0) start(entry);
|
|
229
255
|
}
|
|
230
|
-
if (
|
|
256
|
+
if (outstandingBelow(1)) return;
|
|
257
|
+
for (const entry of queued) {
|
|
258
|
+
if (entry.priority === 1) start(entry);
|
|
259
|
+
}
|
|
260
|
+
if (outstandingBelow(2)) return;
|
|
231
261
|
queued.filter((entry) => entry.priority === 2).sort((a, b) => a.deadlineAt - b.deadlineAt || a.order - b.order).forEach((entry) => start(entry));
|
|
232
262
|
};
|
|
233
263
|
const symbolCounts = (sbn, packetId, catalogTrackName) => {
|
|
@@ -355,7 +385,6 @@ function wireRepairFetch(mc, opts) {
|
|
|
355
385
|
stop(entry2, "reprioritized");
|
|
356
386
|
start(entry2, false);
|
|
357
387
|
}
|
|
358
|
-
preemptDeltas();
|
|
359
388
|
dispatch();
|
|
360
389
|
return;
|
|
361
390
|
}
|
|
@@ -487,7 +516,6 @@ function wireRepairFetch(mc, opts) {
|
|
|
487
516
|
};
|
|
488
517
|
entries.set(key, entry);
|
|
489
518
|
noteBudget(entry, deadline.extensionMs);
|
|
490
|
-
if (entry.priority < 2) preemptDeltas();
|
|
491
519
|
dispatch();
|
|
492
520
|
});
|
|
493
521
|
const rangeFor = (loss, repairTrack) => {
|
|
@@ -563,14 +591,28 @@ function wireRepairFetch(mc, opts) {
|
|
|
563
591
|
}
|
|
564
592
|
entries.set(entry.key, entry);
|
|
565
593
|
entry.expiry = setTimeout(dispatch, Math.max(0, entry.deadlineAt - performance.now()) + 1);
|
|
566
|
-
preemptDeltas();
|
|
567
594
|
dispatch();
|
|
568
595
|
});
|
|
569
596
|
}
|
|
597
|
+
const removeRapObserver = mc.addRapCompleteObserver?.((packetId) => {
|
|
598
|
+
queueMicrotask(() => {
|
|
599
|
+
if (disposed) return;
|
|
600
|
+
for (const entry of [...entries.values()]) {
|
|
601
|
+
if (entry.packetId !== packetId || !entry.running || !moot(entry)) continue;
|
|
602
|
+
stop(entry, "moot");
|
|
603
|
+
retire(entry);
|
|
604
|
+
releaseHold(entry);
|
|
605
|
+
clearEntry(entry);
|
|
606
|
+
}
|
|
607
|
+
dispatch();
|
|
608
|
+
});
|
|
609
|
+
});
|
|
570
610
|
return () => {
|
|
571
611
|
disposed = true;
|
|
612
|
+
mc.setUnicastRepair?.(false);
|
|
572
613
|
removeResetObserver();
|
|
573
614
|
removeLifecycleObserver();
|
|
615
|
+
removeRapObserver?.();
|
|
574
616
|
for (const entry of [...entries.values()]) {
|
|
575
617
|
clearEntry(entry);
|
|
576
618
|
if (entry.running) releaseHold(entry);
|