@blockcast/mmt-container 0.5.0-main.ed11aec88d91 → 0.5.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/dist/browser-runtime.js +150 -21
- package/dist/browser-runtime.js.map +2 -2
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js.map +2 -2
- 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 +31 -1
- package/dist/mmtp-container-parser.no-modules.js.map +2 -2
- package/dist/mmtp-decode-pipeline.js +31 -1
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-router.d.ts +11 -0
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +54 -1
- package/dist/mmtp-router.js.map +2 -2
- package/dist/multicast-manager.d.ts +25 -1
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +92 -2
- package/dist/multicast-manager.js.map +2 -2
- package/dist/no-modules.js +31 -1
- package/dist/no-modules.js.map +2 -2
- package/dist/repair-fetch.d.ts +41 -10
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +58 -19
- 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 -6
- package/src/fec-manager.ts +3 -0
- package/src/index.ts +1 -0
- package/src/mmtp-container-parser.ts +48 -0
- package/src/mmtp-router.ts +27 -0
- package/src/multicast-manager.ts +68 -0
- package/src/repair-fetch.ts +131 -31
- 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/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.
|
|
@@ -345,7 +353,12 @@ export type RepairSkipReason =
|
|
|
345
353
|
* when multicast already delivered the whole group the relay could serve
|
|
346
354
|
* only duplicates (BLO-50082).
|
|
347
355
|
*/
|
|
348
|
-
| 'group-cannot-complete'
|
|
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';
|
|
349
362
|
/**
|
|
350
363
|
* Which term set a FETCH's deadline (BLO-33597): the multicast wait, the
|
|
351
364
|
* player's presentation delay past the block anchor, the keyframe budget past
|
|
@@ -429,12 +442,30 @@ export interface RepairFetchHost {
|
|
|
429
442
|
readonly budgetMs: number;
|
|
430
443
|
readonly priority?: RepairPriority;
|
|
431
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;
|
|
432
455
|
/**
|
|
433
456
|
* A FETCH the scheduler admitted and handed to the transport (optional):
|
|
434
457
|
* every attempt, a retry or a reprioritised restart included.
|
|
435
458
|
*/
|
|
436
459
|
noteRepairFetchSent?(priority: RepairPriority, sbn: number, packetId: number, catalogTrackName: string | undefined, measurement: RepairSendMeasurement): void;
|
|
437
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';
|
|
438
469
|
/**
|
|
439
470
|
* Wire the D-28 repair-fetch scheduler onto a MulticastManager.
|
|
440
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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Q,EAAE,cAAc,EACxB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,WAAW,EAAE,qBAAqB,GACjC,IAAI,CAAA;CACR;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GACxB,WAAW,GACX,eAAe,GACf,SAAS,GACT,UAAU,GACV,OAAO,GACP,UAAU,GACV,MAAM,CAAA;AAgDV;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,sBAAsB,GAAG,MAAM,IAAI,CA+tB7F"}
|
package/dist/repair-fetch.js
CHANGED
|
@@ -114,6 +114,34 @@ function wireRepairFetch(mc, opts) {
|
|
|
114
114
|
run.stopped = reason;
|
|
115
115
|
run.controller.abort();
|
|
116
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
|
+
);
|
|
117
145
|
};
|
|
118
146
|
const readKeyframeBudget = (packetId, catalogTrackName) => {
|
|
119
147
|
const reader = opts.keyframeRepairBudgetMs;
|
|
@@ -138,31 +166,22 @@ function wireRepairFetch(mc, opts) {
|
|
|
138
166
|
const rttMs = readRtt();
|
|
139
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";
|
|
140
168
|
if (reason === null) return rttMs;
|
|
141
|
-
|
|
142
|
-
releaseHold(entry);
|
|
143
|
-
clearEntry(entry);
|
|
144
|
-
mc.noteRepairSkipped(
|
|
145
|
-
reason,
|
|
146
|
-
{ rttMs, budgetMs, priority: entry.priority },
|
|
147
|
-
entry.sbn,
|
|
148
|
-
entry.packetId,
|
|
149
|
-
entry.catalogTrackName
|
|
150
|
-
);
|
|
169
|
+
skip(entry, reason, rttMs, budgetMs);
|
|
151
170
|
return null;
|
|
152
171
|
};
|
|
153
172
|
const retire = (entry) => {
|
|
154
173
|
if (entries.get(entry.key) === entry) entries.delete(entry.key);
|
|
155
174
|
if (entry.expiry !== void 0) clearTimeout(entry.expiry);
|
|
156
175
|
};
|
|
157
|
-
const
|
|
176
|
+
const outstandingBelow = (priority) => {
|
|
158
177
|
for (const entry of entries.values()) {
|
|
159
|
-
if (entry.priority <
|
|
178
|
+
if (entry.priority < priority) return true;
|
|
160
179
|
}
|
|
161
180
|
return false;
|
|
162
181
|
};
|
|
163
|
-
const
|
|
182
|
+
const preemptBestEffort = () => {
|
|
164
183
|
for (const entry of entries.values()) {
|
|
165
|
-
if (entry.priority
|
|
184
|
+
if (entry.priority === 0 || !entry.running) continue;
|
|
166
185
|
stop(entry, "preempted");
|
|
167
186
|
note("repair-preempted", entry);
|
|
168
187
|
}
|
|
@@ -182,8 +201,13 @@ function wireRepairFetch(mc, opts) {
|
|
|
182
201
|
};
|
|
183
202
|
const start = (entry, counted = true) => {
|
|
184
203
|
const now = performance.now();
|
|
204
|
+
if (moot(entry)) {
|
|
205
|
+
skip(entry, "moot-rap", readRtt(), entry.deadlineAt - now);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
185
208
|
const rttMs = admit(entry, now);
|
|
186
209
|
if (rttMs === null) return;
|
|
210
|
+
if (entry.priority === 0) preemptBestEffort();
|
|
187
211
|
if (counted) entry.attempts++;
|
|
188
212
|
mc.noteRepairFetchSent?.(entry.priority, entry.sbn, entry.packetId, entry.catalogTrackName, {
|
|
189
213
|
rttMs,
|
|
@@ -227,9 +251,13 @@ function wireRepairFetch(mc, opts) {
|
|
|
227
251
|
queued.push(entry);
|
|
228
252
|
}
|
|
229
253
|
for (const entry of queued) {
|
|
230
|
-
if (entry.priority
|
|
254
|
+
if (entry.priority === 0) start(entry);
|
|
231
255
|
}
|
|
232
|
-
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;
|
|
233
261
|
queued.filter((entry) => entry.priority === 2).sort((a, b) => a.deadlineAt - b.deadlineAt || a.order - b.order).forEach((entry) => start(entry));
|
|
234
262
|
};
|
|
235
263
|
const symbolCounts = (sbn, packetId, catalogTrackName) => {
|
|
@@ -357,7 +385,6 @@ function wireRepairFetch(mc, opts) {
|
|
|
357
385
|
stop(entry2, "reprioritized");
|
|
358
386
|
start(entry2, false);
|
|
359
387
|
}
|
|
360
|
-
preemptDeltas();
|
|
361
388
|
dispatch();
|
|
362
389
|
return;
|
|
363
390
|
}
|
|
@@ -489,7 +516,6 @@ function wireRepairFetch(mc, opts) {
|
|
|
489
516
|
};
|
|
490
517
|
entries.set(key, entry);
|
|
491
518
|
noteBudget(entry, deadline.extensionMs);
|
|
492
|
-
if (entry.priority < 2) preemptDeltas();
|
|
493
519
|
dispatch();
|
|
494
520
|
});
|
|
495
521
|
const rangeFor = (loss, repairTrack) => {
|
|
@@ -565,15 +591,28 @@ function wireRepairFetch(mc, opts) {
|
|
|
565
591
|
}
|
|
566
592
|
entries.set(entry.key, entry);
|
|
567
593
|
entry.expiry = setTimeout(dispatch, Math.max(0, entry.deadlineAt - performance.now()) + 1);
|
|
568
|
-
preemptDeltas();
|
|
569
594
|
dispatch();
|
|
570
595
|
});
|
|
571
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
|
+
});
|
|
572
610
|
return () => {
|
|
573
611
|
disposed = true;
|
|
574
612
|
mc.setUnicastRepair?.(false);
|
|
575
613
|
removeResetObserver();
|
|
576
614
|
removeLifecycleObserver();
|
|
615
|
+
removeRapObserver?.();
|
|
577
616
|
for (const entry of [...entries.values()]) {
|
|
578
617
|
clearEntry(entry);
|
|
579
618
|
if (entry.running) releaseHold(entry);
|