@blockcast/mmt-container 2.2.0-main.da2e7cd1dd5d → 2.2.0-main.ef09fa701ea8
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 +1447 -179
- package/dist/browser-runtime.js.map +3 -3
- package/dist/cmaf-block-assembler.js +92 -1
- package/dist/cmaf-block-assembler.js.map +2 -2
- package/dist/codec-utils.d.ts.map +1 -1
- package/dist/codec-utils.js +92 -1
- package/dist/codec-utils.js.map +2 -2
- package/dist/delivery-catalog.js +2 -1
- package/dist/delivery-catalog.js.map +2 -2
- package/dist/delta-fallback-config.js.map +1 -1
- package/dist/fec-manager.d.ts +105 -14
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +502 -58
- package/dist/fec-manager.js.map +2 -2
- package/dist/fec-worker-setup.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.d.ts +48 -13
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +97 -25
- package/dist/iso-block-locator.js.map +2 -2
- package/dist/iso-bmff-timing.d.ts +10 -1
- package/dist/iso-bmff-timing.d.ts.map +1 -1
- package/dist/iso-bmff-timing.js +36 -2
- package/dist/iso-bmff-timing.js.map +2 -2
- package/dist/media-router.js.map +1 -1
- package/dist/mmtp-container-parser.d.ts +104 -12
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +308 -27
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +310 -30
- package/dist/mmtp-container-parser.no-modules.js.map +3 -3
- package/dist/mmtp-decode-pipeline.js +307 -27
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-router.d.ts +36 -8
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +675 -75
- package/dist/mmtp-router.js.map +3 -3
- package/dist/multicast-manager.d.ts +26 -3
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +1267 -152
- package/dist/multicast-manager.js.map +3 -3
- package/dist/multicast-transport.js +4 -3
- package/dist/multicast-transport.js.map +2 -2
- package/dist/no-modules.js +307 -27
- package/dist/no-modules.js.map +3 -3
- package/dist/repair-fetch.d.ts +38 -8
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +286 -27
- package/dist/repair-fetch.js.map +3 -3
- package/dist/track-session.d.ts.map +1 -1
- package/dist/track-session.js +1 -0
- package/dist/track-session.js.map +2 -2
- package/dist/wasm-mmtp-container-parser.js +307 -27
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +5 -5
- package/src/codec-utils.ts +121 -1
- package/src/fec-manager.ts +571 -32
- package/src/index.ts +3 -0
- package/src/iso-block-locator.ts +133 -31
- package/src/iso-bmff-timing.ts +40 -1
- package/src/mmtp-container-parser.ts +341 -32
- package/src/mmtp-router.ts +600 -55
- package/src/multicast-manager.ts +136 -16
- package/src/repair-fetch.ts +366 -50
- package/src/track-session.ts +3 -0
package/dist/fec-manager.js
CHANGED
|
@@ -327,6 +327,15 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
327
327
|
this.#heldEvicted = 0;
|
|
328
328
|
/** Pending holes (see `deferIncompleteGaps`): unstated, sources still held. */
|
|
329
329
|
this.#holes = [];
|
|
330
|
+
/** Holes the horizon passed while pending: sources held until closed. */
|
|
331
|
+
this.#expired = [];
|
|
332
|
+
/** Of `#expired`, those `takeExpiredHoles` has not handed out yet. */
|
|
333
|
+
this.#newlyExpired = [];
|
|
334
|
+
/**
|
|
335
|
+
* Spans closed from expired holes: behind the horizon, so kept only for
|
|
336
|
+
* `locate` while their sources are fed, until the next retirement.
|
|
337
|
+
*/
|
|
338
|
+
this.#closedBehind = [];
|
|
330
339
|
/**
|
|
331
340
|
* Keep a gap that is missing a source as a pending hole rather than a span,
|
|
332
341
|
* so a repair FETCHed for it (draft-ramadan-moq-fec §7.5) can still state
|
|
@@ -348,7 +357,11 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
348
357
|
#retentionBlocks;
|
|
349
358
|
#heldEvicted;
|
|
350
359
|
#newest;
|
|
360
|
+
#newestSource;
|
|
351
361
|
#holes;
|
|
362
|
+
#expired;
|
|
363
|
+
#newlyExpired;
|
|
364
|
+
#closedBehind;
|
|
352
365
|
static #checkedRetention(retentionBlocks) {
|
|
353
366
|
if (!Number.isSafeInteger(retentionBlocks) || retentionBlocks <= 0) {
|
|
354
367
|
throw new Error(
|
|
@@ -385,6 +398,21 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
385
398
|
observe(position) {
|
|
386
399
|
if (this.#newest === void 0 || serial32Precedes(this.#newest, position)) this.#newest = position;
|
|
387
400
|
}
|
|
401
|
+
/**
|
|
402
|
+
* The newest source SS_ID noted with `noteSource` (RFC 1982 order). Unlike
|
|
403
|
+
* `newest`, a repair never moves it: a repair can run ahead of its sources,
|
|
404
|
+
* a source cannot run ahead of the sources sent before it except by
|
|
405
|
+
* reordering.
|
|
406
|
+
*/
|
|
407
|
+
get newestSource() {
|
|
408
|
+
return this.#newestSource;
|
|
409
|
+
}
|
|
410
|
+
/** Note a received source's SS_ID; true when it is the newest one yet. */
|
|
411
|
+
noteSource(ssId) {
|
|
412
|
+
if (this.#newestSource !== void 0 && !serial32Precedes(this.#newestSource, ssId)) return false;
|
|
413
|
+
this.#newestSource = ssId;
|
|
414
|
+
return true;
|
|
415
|
+
}
|
|
388
416
|
/** Held sources evicted by `heldCapacity` (never by the horizon itself). */
|
|
389
417
|
get heldEvicted() {
|
|
390
418
|
return this.#heldEvicted;
|
|
@@ -403,17 +431,29 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
403
431
|
}
|
|
404
432
|
/** The known block or span containing `ssId`, with its ESI. */
|
|
405
433
|
locate(ssId) {
|
|
406
|
-
for (
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
434
|
+
for (const blocks of [this.#blocks, this.#closedBehind]) {
|
|
435
|
+
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
436
|
+
const block = blocks[i];
|
|
437
|
+
if (isoBlockContains(block.start, block.length, ssId)) {
|
|
438
|
+
return { block, esi: serial32Distance(block.start, ssId) };
|
|
439
|
+
}
|
|
410
440
|
}
|
|
411
441
|
}
|
|
412
442
|
return null;
|
|
413
443
|
}
|
|
414
|
-
/** Number of pending
|
|
444
|
+
/** Number of holes not closed yet, pending or past the horizon. */
|
|
415
445
|
get holeCount() {
|
|
416
|
-
return this.#holes.length;
|
|
446
|
+
return this.#holes.length + this.#expired.length;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* The pending holes the horizon has passed since the last call, in the
|
|
450
|
+
* order it passed them. Each is no longer pending: no repair states a block
|
|
451
|
+
* in it (that repair is `stale`, as for a span the horizon retired) and the
|
|
452
|
+
* release gate does not wait for it. Its owner must close it
|
|
453
|
+
* (`closeHolesWithin`), which turns it into a span that is not kept here.
|
|
454
|
+
*/
|
|
455
|
+
takeExpiredHoles() {
|
|
456
|
+
return this.#newlyExpired.splice(0);
|
|
417
457
|
}
|
|
418
458
|
/** The stated block (never a span) ending exactly at `end`. */
|
|
419
459
|
blockEndingAt(end) {
|
|
@@ -469,9 +509,11 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
469
509
|
/**
|
|
470
510
|
* Apply one repair symbol's `(SS_Start, SSB_length)`. The first repair of a
|
|
471
511
|
* block states its range and places every held source in it; later repair
|
|
472
|
-
* symbols of the same block change nothing. A range
|
|
473
|
-
*
|
|
474
|
-
*
|
|
512
|
+
* symbols of the same block change nothing. A repair whose range is exactly
|
|
513
|
+
* a repair-less span states that span's one block. A range that contradicts
|
|
514
|
+
* a known block (a different length, or an overlap with another block or
|
|
515
|
+
* with part of a span) fails closed: the repair symbol is dropped and no
|
|
516
|
+
* block changes.
|
|
475
517
|
* A newly stated block retires behind its SS_Start (see the class note).
|
|
476
518
|
* A block so far past `newest` that stating it would retire the position
|
|
477
519
|
* `newest` is refused as `ahead`. When `newest` is a placed block's SS_Start
|
|
@@ -490,7 +532,16 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
490
532
|
const known = this.blockAt(start);
|
|
491
533
|
if (known !== void 0) {
|
|
492
534
|
if (known.span) {
|
|
493
|
-
|
|
535
|
+
if (known.length === length) {
|
|
536
|
+
const block2 = { start, length, span: false };
|
|
537
|
+
this.#blocks[this.#blocks.indexOf(known)] = block2;
|
|
538
|
+
return { status: "placed", block: block2, placed: [] };
|
|
539
|
+
}
|
|
540
|
+
return length < known.length ? {
|
|
541
|
+
status: "overlap",
|
|
542
|
+
reason: `repair block ${start}+${length} is only the first block of repair-less span ${known.start}+${known.length}`,
|
|
543
|
+
ofSpan: known
|
|
544
|
+
} : { status: "overlap", reason: `repair block ${start}+${length} runs past repair-less span ${known.start}+${known.length}` };
|
|
494
545
|
}
|
|
495
546
|
if (known.length !== length) {
|
|
496
547
|
return {
|
|
@@ -558,18 +609,28 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
558
609
|
return span === void 0 ? { status: "placed", block, placed } : { status: "placed", block, placed, span };
|
|
559
610
|
}
|
|
560
611
|
/**
|
|
561
|
-
* Turn every
|
|
562
|
-
*
|
|
563
|
-
*
|
|
612
|
+
* Turn every hole inside `[start, start + length)` into a repair-less span,
|
|
613
|
+
* claiming its held sources: its range FETCH ended, so nothing more will
|
|
614
|
+
* state its blocks. A hole the horizon passed (`takeExpiredHoles`) leaves a
|
|
615
|
+
* span that is not kept among the blocks, as the horizon would retire it at
|
|
616
|
+
* once; only `locate` finds it, until the next retirement, so its sources
|
|
617
|
+
* can be fed. Returns the spans, in SS_ID order.
|
|
564
618
|
*/
|
|
565
619
|
closeHolesWithin(start, length) {
|
|
566
620
|
const closed = [];
|
|
567
|
-
for (const
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
621
|
+
for (const holes of [this.#holes, this.#expired]) {
|
|
622
|
+
for (const hole of [...holes]) {
|
|
623
|
+
if (!isoBlockContains(start, length, hole.start)) continue;
|
|
624
|
+
holes.splice(holes.indexOf(hole), 1);
|
|
625
|
+
const spanBlock = { start: hole.start, length: hole.length, span: true };
|
|
626
|
+
closed.push({ block: spanBlock, placed: this.#claim(spanBlock) });
|
|
627
|
+
if (holes === this.#holes) {
|
|
628
|
+
this.#blocks.push(spanBlock);
|
|
629
|
+
} else {
|
|
630
|
+
this.#closedBehind.push(spanBlock);
|
|
631
|
+
if (this.#newlyExpired.includes(hole)) this.#newlyExpired.splice(this.#newlyExpired.indexOf(hole), 1);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
573
634
|
}
|
|
574
635
|
return closed.sort((x, y) => serial32Distance(start, x.block.start) - serial32Distance(start, y.block.start));
|
|
575
636
|
}
|
|
@@ -583,15 +644,17 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
583
644
|
return void 0;
|
|
584
645
|
}
|
|
585
646
|
/**
|
|
586
|
-
* Retire every block and span whose last SS_ID, and every held source
|
|
587
|
-
* lies more than `retentionBlocks` blocks behind
|
|
588
|
-
* lower-bound metric (`isoBlocksBehindLowerBound`)
|
|
589
|
-
* horizon uses
|
|
647
|
+
* Retire every block and span whose last SS_ID, and every held source
|
|
648
|
+
* outside a hole, lies more than `retentionBlocks` blocks behind
|
|
649
|
+
* `position`, with the shared lower-bound metric (`isoBlocksBehindLowerBound`)
|
|
650
|
+
* every ISO interleave horizon uses; a pending hole so far behind expires
|
|
651
|
+
* (`takeExpiredHoles`). Returns the retired block starts.
|
|
590
652
|
*/
|
|
591
653
|
retireBehind(position) {
|
|
592
654
|
this.observe(position);
|
|
593
655
|
const horizon = this.#retentionBlocks;
|
|
594
656
|
const retired = [];
|
|
657
|
+
this.#closedBehind.length = 0;
|
|
595
658
|
for (let i = this.#blocks.length - 1; i >= 0; i--) {
|
|
596
659
|
const block = this.#blocks[i];
|
|
597
660
|
const last = serial32Add(block.start, block.length - 1);
|
|
@@ -603,10 +666,15 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
603
666
|
for (let i = this.#holes.length - 1; i >= 0; i--) {
|
|
604
667
|
const hole = this.#holes[i];
|
|
605
668
|
const last = serial32Add(hole.start, hole.length - 1);
|
|
606
|
-
if (isoBlocksBehindLowerBound(last, position, this.#kMax)
|
|
669
|
+
if (isoBlocksBehindLowerBound(last, position, this.#kMax) <= horizon) continue;
|
|
670
|
+
this.#holes.splice(i, 1);
|
|
671
|
+
this.#expired.push(hole);
|
|
672
|
+
this.#newlyExpired.push(hole);
|
|
607
673
|
}
|
|
608
674
|
for (const ssId of [...this.#held.keys()]) {
|
|
609
|
-
if (isoBlocksBehindLowerBound(ssId, position, this.#kMax) > horizon) this.#
|
|
675
|
+
if (isoBlocksBehindLowerBound(ssId, position, this.#kMax) > horizon && !this.#holes.some((hole) => isoBlockContains(hole.start, hole.length, ssId)) && !this.#expired.some((hole) => isoBlockContains(hole.start, hole.length, ssId))) {
|
|
676
|
+
this.#held.delete(ssId);
|
|
677
|
+
}
|
|
610
678
|
}
|
|
611
679
|
return retired;
|
|
612
680
|
}
|
|
@@ -614,9 +682,13 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
614
682
|
reset() {
|
|
615
683
|
this.#blocks.length = 0;
|
|
616
684
|
this.#holes.length = 0;
|
|
685
|
+
this.#expired.length = 0;
|
|
686
|
+
this.#newlyExpired.length = 0;
|
|
687
|
+
this.#closedBehind.length = 0;
|
|
617
688
|
this.#held.clear();
|
|
618
689
|
this.#coverageEnd = void 0;
|
|
619
690
|
this.#newest = void 0;
|
|
691
|
+
this.#newestSource = void 0;
|
|
620
692
|
}
|
|
621
693
|
#claim(block) {
|
|
622
694
|
const placed = [];
|
|
@@ -1081,6 +1153,7 @@ var WORKER_ERROR_LOG_CAP = 5;
|
|
|
1081
1153
|
var WORKER_ERROR_KIND_CAP = 32;
|
|
1082
1154
|
var WORKER_ERROR_OVERFLOW_KIND = "other";
|
|
1083
1155
|
var STARTUP_REPAIR_WAIT_SOURCE_BOUNDARIES = 2;
|
|
1156
|
+
var NOT_TAKEN = Object.freeze({ taken: false, recovered: null });
|
|
1084
1157
|
function isMulticastSymbolDelivery(value) {
|
|
1085
1158
|
return value === "datagram" || value === "ordered-relay";
|
|
1086
1159
|
}
|
|
@@ -1174,10 +1247,18 @@ var FECManager = class _FECManager {
|
|
|
1174
1247
|
// 'pending' forever, which would park every later frame of its stream in
|
|
1175
1248
|
// the in-order release gate. Each entry owns its handle; the callback
|
|
1176
1249
|
// checks it still owns the key, so a settled or reset key is never touched.
|
|
1250
|
+
/**
|
|
1251
|
+
* Per owed Worker cleanup: the bound on its acknowledgement, when its block
|
|
1252
|
+
* was due, and when its cleanup was asked for (see `onCleanupComplete`).
|
|
1253
|
+
*/
|
|
1177
1254
|
this.#pendingWorkerCleanupBounds = /* @__PURE__ */ new Map();
|
|
1178
1255
|
// Source symbol count per track-scoped block — marks complete when K symbols arrive.
|
|
1179
1256
|
this.#blockSourceCounts = /* @__PURE__ */ new Map();
|
|
1180
1257
|
this.#blockSourceEsis = /* @__PURE__ */ new Map();
|
|
1258
|
+
// Source ESIs per block that another FEC instance rebuilt and fed in
|
|
1259
|
+
// (feedRebuiltSourceSymbol). Kept apart from #blockSourceEsis: they are
|
|
1260
|
+
// not network arrivals and never make a block clean.
|
|
1261
|
+
this.#blockRebuiltEsis = /* @__PURE__ */ new Map();
|
|
1181
1262
|
// Authored SSB_length per block (ISO/IEC 23008-1 §C.5.3), learned from the
|
|
1182
1263
|
// first repair symbol. The FFmpeg moq_mmt publisher closes a block every D
|
|
1183
1264
|
// media units, usually before it holds K symbols; under iso-ssbg1-v1
|
|
@@ -1186,10 +1267,14 @@ var FECManager = class _FECManager {
|
|
|
1186
1267
|
// SSB_length source arrivals and recoverable from SSB_length received
|
|
1187
1268
|
// symbols; waiting for K fails every one of them.
|
|
1188
1269
|
this.#blockAuthoredLengths = /* @__PURE__ */ new Map();
|
|
1270
|
+
// Keys whose authored length is a repair-less span's (#openIsoSpan), until
|
|
1271
|
+
// a repair states the block there or the span resolves.
|
|
1272
|
+
this.#isoSpanKeys = /* @__PURE__ */ new Set();
|
|
1189
1273
|
this.#ssbLengthConflictCount = 0;
|
|
1190
1274
|
this.#blockRepairRsIds = /* @__PURE__ */ new Map();
|
|
1191
1275
|
// RSB_length per block (C.5.3 Repair FEC Payload ID): how many repair
|
|
1192
|
-
// symbols its repair group carries
|
|
1276
|
+
// symbols its repair group carries; 0 for a repair-less span no repair can
|
|
1277
|
+
// state (#openIsoSpan). Same lifecycle as #blockRepairRsIds.
|
|
1193
1278
|
this.#blockRsbLengths = /* @__PURE__ */ new Map();
|
|
1194
1279
|
/** fec-01 6.3.9 anchor state per stream key, one entry per held layer. */
|
|
1195
1280
|
this.#heldLayerStates = /* @__PURE__ */ new Map();
|
|
@@ -1383,7 +1468,10 @@ var FECManager = class _FECManager {
|
|
|
1383
1468
|
// arrives via onBlockRecovered callback.
|
|
1384
1469
|
this.onBlockStarted = null;
|
|
1385
1470
|
this.onBlockComplete = null;
|
|
1386
|
-
/**
|
|
1471
|
+
/**
|
|
1472
|
+
* A block reached its fail bound. `blockClass` is its class at failure.
|
|
1473
|
+
* `span` is set when what failed is a repair-less span starting at `sbn`.
|
|
1474
|
+
*/
|
|
1387
1475
|
this.onBlockFailed = null;
|
|
1388
1476
|
/**
|
|
1389
1477
|
* Fired once per stream when its Worker decoder stops being routable.
|
|
@@ -1425,12 +1513,24 @@ var FECManager = class _FECManager {
|
|
|
1425
1513
|
* for it, which it must be.
|
|
1426
1514
|
*/
|
|
1427
1515
|
this.#onUndelimitedLoss = null;
|
|
1516
|
+
/** Set with the loss handler: true takes an expired hole to close (`closeIsoHoles`). */
|
|
1517
|
+
this.#onIsoHoleExpired = null;
|
|
1428
1518
|
/** A block every symbol of which vanished was created by SBN evidence. */
|
|
1429
1519
|
this.onBlockVanished = null;
|
|
1430
1520
|
/** A block reached a terminal state (completed, recovered, or failed). */
|
|
1431
1521
|
this.onBlockResolved = null;
|
|
1432
1522
|
/** A stream's SBN went backwards (or jumped implausibly): the source restarted. */
|
|
1433
1523
|
this.onSourceDiscontinuity = null;
|
|
1524
|
+
/**
|
|
1525
|
+
* The span and tolerance the catalog states for a keyframe overlay
|
|
1526
|
+
* installed over a source track (draft-ramadan-moq-mmt-02 7.4.1: the
|
|
1527
|
+
* overlay instance's own interleaveDepthMs and reorderToleranceMs), or
|
|
1528
|
+
* undefined while none is installed. A stated block only a late source
|
|
1529
|
+
* can complete, and a frame whose gap may hide a RAP behind a span only a
|
|
1530
|
+
* late source can fill, also wait for that overlay's repair
|
|
1531
|
+
* (#overlayLateWaitMs).
|
|
1532
|
+
*/
|
|
1533
|
+
this.keyframeOverlayTiming = null;
|
|
1434
1534
|
// Worker-path callbacks — async recovery and stats from FecWorkerClient.
|
|
1435
1535
|
/**
|
|
1436
1536
|
* A recovered source symbol. Return false when admission refused the
|
|
@@ -1467,7 +1567,9 @@ var FECManager = class _FECManager {
|
|
|
1467
1567
|
#pendingWorkerCleanupBounds;
|
|
1468
1568
|
#blockSourceCounts;
|
|
1469
1569
|
#blockSourceEsis;
|
|
1570
|
+
#blockRebuiltEsis;
|
|
1470
1571
|
#blockAuthoredLengths;
|
|
1572
|
+
#isoSpanKeys;
|
|
1471
1573
|
#ssbLengthConflictCount;
|
|
1472
1574
|
#blockRepairRsIds;
|
|
1473
1575
|
#blockRsbLengths;
|
|
@@ -1534,6 +1636,7 @@ var FECManager = class _FECManager {
|
|
|
1534
1636
|
#decoderUnavailableEvents;
|
|
1535
1637
|
#repairSymbolSizeMismatchCount;
|
|
1536
1638
|
#onUndelimitedLoss;
|
|
1639
|
+
#onIsoHoleExpired;
|
|
1537
1640
|
#encodeTrackName(catalogTrackName) {
|
|
1538
1641
|
let encoded = this.#encodedTrackNames.get(catalogTrackName);
|
|
1539
1642
|
if (encoded === void 0) {
|
|
@@ -2005,7 +2108,10 @@ var FECManager = class _FECManager {
|
|
|
2005
2108
|
timer.handle = null;
|
|
2006
2109
|
this.#requestRepair(sbn, packetId, catalogTrackName);
|
|
2007
2110
|
};
|
|
2008
|
-
timer.handle = setTimeout(
|
|
2111
|
+
timer.handle = setTimeout(
|
|
2112
|
+
onFire,
|
|
2113
|
+
this.#receiptAtMs === void 0 ? Math.max(0, deadlineMs - performance.now()) : this.#receiptTimerDelayMs(deadlineMs, 0)
|
|
2114
|
+
);
|
|
2009
2115
|
this.#repairDeadlines.set(key, timer);
|
|
2010
2116
|
}
|
|
2011
2117
|
#requestRepair(sbn, packetId, catalogTrackName, settledByOrder = false) {
|
|
@@ -2149,8 +2255,14 @@ var FECManager = class _FECManager {
|
|
|
2149
2255
|
* Vanished blocks are not enumerated here: their starts are unknown until a
|
|
2150
2256
|
* repair states them. The SS_IDs between two stated blocks become one
|
|
2151
2257
|
* repair-less span when the later block's repair arrives (placeIsoRepair).
|
|
2258
|
+
*
|
|
2259
|
+
* A `held` source arrived before its block was known and is fed only now
|
|
2260
|
+
* that a repair, a span or a closed hole placed it: how far its block start
|
|
2261
|
+
* then lies behind the frontier measures how long the receiver held it, not
|
|
2262
|
+
* where the stream was, so only its SS_ID and packet_sequence_number judge
|
|
2263
|
+
* it (BLO-52085).
|
|
2152
2264
|
*/
|
|
2153
|
-
#noteSbnSeen(sbn, packetId, catalogTrackName, symbol, packetSequenceNumber, ssId = sbn) {
|
|
2265
|
+
#noteSbnSeen(sbn, packetId, catalogTrackName, symbol, packetSequenceNumber, ssId = sbn, held = false) {
|
|
2154
2266
|
const streamKey = this.#streamKey(packetId, catalogTrackName);
|
|
2155
2267
|
const now = performance.now();
|
|
2156
2268
|
const previous = (symbol === "source" ? this.#sourceFrontiers : this.#highestSbn).get(streamKey);
|
|
@@ -2189,7 +2301,7 @@ var FECManager = class _FECManager {
|
|
|
2189
2301
|
return sent <= 2147483647 && serial32Distance(from.ssId, to.ssId) <= sent + config.k;
|
|
2190
2302
|
};
|
|
2191
2303
|
if (!this.#blockPrecedes(previous.sbn, sbn)) {
|
|
2192
|
-
if (symbol === "source" && window !== null && this.#blockPrecedes(sbn, previous.sbn) && (this.#blocksBehind(sbn, previous.sbn, packetId) > this.#isoRetentionBlocks(packetId) || psn !== void 0 && anchor !== void 0 && serial32Precedes(ssId, anchor.ssId) && psn !== anchor.psn && !sentInOrder({ ssId, psn }, anchor))) {
|
|
2304
|
+
if (symbol === "source" && window !== null && this.#blockPrecedes(sbn, previous.sbn) && (!held && this.#blocksBehind(sbn, previous.sbn, packetId) > this.#isoRetentionBlocks(packetId) || psn !== void 0 && anchor !== void 0 && serial32Precedes(ssId, anchor.ssId) && psn !== anchor.psn && !sentInOrder({ ssId, psn }, anchor))) {
|
|
2193
2305
|
discontinuity();
|
|
2194
2306
|
return;
|
|
2195
2307
|
}
|
|
@@ -2451,17 +2563,21 @@ var FECManager = class _FECManager {
|
|
|
2451
2563
|
this.#blockWaitDeadlinesMs.delete(key);
|
|
2452
2564
|
this.#repairHoldUntilMs.delete(key);
|
|
2453
2565
|
this.#traceLifecycle("timeout-queued", sbn, packetId, catalogTrackName);
|
|
2454
|
-
this.#finalizeExpiredBlock(sbn, packetId, catalogTrackName);
|
|
2566
|
+
this.#finalizeExpiredBlock(sbn, packetId, catalogTrackName, currentDeadlineMs ?? firedAtMs);
|
|
2455
2567
|
};
|
|
2456
|
-
timer.handle = setTimeout(
|
|
2568
|
+
timer.handle = setTimeout(
|
|
2569
|
+
onFire,
|
|
2570
|
+
this.#receiptAtMs === void 0 ? Math.max(1, Math.ceil(deadlineMs - nowMs)) : this.#receiptTimerDelayMs(deadlineMs, 1)
|
|
2571
|
+
);
|
|
2457
2572
|
this.#activeBlocks.set(key, timer);
|
|
2458
2573
|
this.#indexBlockKey(key, sbn, packetId);
|
|
2459
2574
|
}
|
|
2460
2575
|
/**
|
|
2461
2576
|
* Hand a block whose delivery is over to its decoder for finalization: the
|
|
2462
|
-
* datagram deadline fired, or the ordered relay moved past it.
|
|
2577
|
+
* datagram deadline fired, or the ordered relay moved past it. `dueAtMs`
|
|
2578
|
+
* is when it was due: its deadline, or now.
|
|
2463
2579
|
*/
|
|
2464
|
-
#finalizeExpiredBlock(sbn, packetId, catalogTrackName) {
|
|
2580
|
+
#finalizeExpiredBlock(sbn, packetId, catalogTrackName, dueAtMs = performance.now()) {
|
|
2465
2581
|
const key = this.#blockKey(sbn, packetId, catalogTrackName);
|
|
2466
2582
|
if (this.#materializedBlocks.has(key) && !this.#blockPathCounts.has(key)) {
|
|
2467
2583
|
this.#failBlock(sbn, packetId, catalogTrackName);
|
|
@@ -2477,7 +2593,7 @@ var FECManager = class _FECManager {
|
|
|
2477
2593
|
if (workerClient) {
|
|
2478
2594
|
this.#pendingWorkerCleanups.add(key);
|
|
2479
2595
|
this.#pendingWorkerCleanupClients.set(key, workerClient);
|
|
2480
|
-
this.#boundOwedCleanup(key, packetId, workerClient);
|
|
2596
|
+
this.#boundOwedCleanup(key, packetId, workerClient, dueAtMs);
|
|
2481
2597
|
workerClient.cleanup(sbn);
|
|
2482
2598
|
} else {
|
|
2483
2599
|
const decoder = this.#decoderForPacket(packetId, catalogTrackName)?.client;
|
|
@@ -2789,7 +2905,9 @@ var FECManager = class _FECManager {
|
|
|
2789
2905
|
}
|
|
2790
2906
|
resetMap(this.#blockSourceCounts);
|
|
2791
2907
|
resetMap(this.#blockSourceEsis);
|
|
2908
|
+
resetMap(this.#blockRebuiltEsis);
|
|
2792
2909
|
resetMap(this.#blockAuthoredLengths);
|
|
2910
|
+
resetSet(this.#isoSpanKeys);
|
|
2793
2911
|
resetMap(this.#blockRepairRsIds);
|
|
2794
2912
|
resetMap(this.#blockRsbLengths);
|
|
2795
2913
|
resetMap(this.#heldLayerStates);
|
|
@@ -2913,7 +3031,9 @@ var FECManager = class _FECManager {
|
|
|
2913
3031
|
dropMap(this.#pendingWorkerCleanupClients);
|
|
2914
3032
|
dropMap(this.#blockSourceCounts);
|
|
2915
3033
|
dropMap(this.#blockSourceEsis);
|
|
3034
|
+
dropMap(this.#blockRebuiltEsis);
|
|
2916
3035
|
dropMap(this.#blockAuthoredLengths);
|
|
3036
|
+
dropSet(this.#isoSpanKeys);
|
|
2917
3037
|
dropMap(this.#blockRepairRsIds);
|
|
2918
3038
|
dropMap(this.#blockRsbLengths);
|
|
2919
3039
|
dropMap(this.#blockPathCounts);
|
|
@@ -3075,6 +3195,9 @@ var FECManager = class _FECManager {
|
|
|
3075
3195
|
this.#unindexBlockKey(key);
|
|
3076
3196
|
}
|
|
3077
3197
|
}
|
|
3198
|
+
if (isSourceSymbol && source === "multicast") {
|
|
3199
|
+
this.#noteMulticastSource(this.#isoLocatorFor(packetId, catalogTrackName), sbn + esi >>> 0, packetId, catalogTrackName);
|
|
3200
|
+
}
|
|
3078
3201
|
return true;
|
|
3079
3202
|
}
|
|
3080
3203
|
#observeBlockCatalogTrackName(blockKey, sbn, packetId, catalogTrackName) {
|
|
@@ -3184,8 +3307,10 @@ var FECManager = class _FECManager {
|
|
|
3184
3307
|
}
|
|
3185
3308
|
/**
|
|
3186
3309
|
* An open block's accepted sources, distinct repair RS_IDs, authored K'
|
|
3187
|
-
* (SSB_length) and RSB_length (each undefined until a repair stated it
|
|
3188
|
-
*
|
|
3310
|
+
* (SSB_length) and RSB_length (each undefined until a repair stated it; a
|
|
3311
|
+
* repair-less span states its length, and RSB_length 0 when it is longer
|
|
3312
|
+
* than K, since no repair can reach it). Undefined for a block that is not
|
|
3313
|
+
* open.
|
|
3189
3314
|
*/
|
|
3190
3315
|
blockSymbolCounts(sbn, packetId, catalogTrackName) {
|
|
3191
3316
|
const key = this.#blockKey(sbn, packetId, catalogTrackName);
|
|
@@ -3253,8 +3378,9 @@ var FECManager = class _FECManager {
|
|
|
3253
3378
|
return true;
|
|
3254
3379
|
}
|
|
3255
3380
|
/**
|
|
3256
|
-
* Drop a block's repair hold: its FETCH ended without delivering
|
|
3257
|
-
*
|
|
3381
|
+
* Drop a block's repair hold: its FETCH ended without delivering, or brought
|
|
3382
|
+
* back only a repair that cannot complete it. The block falls back to its
|
|
3383
|
+
* multicast wait, which may already have passed.
|
|
3258
3384
|
*/
|
|
3259
3385
|
releaseRepairHold(sbn, packetId, catalogTrackName) {
|
|
3260
3386
|
const key = this.#blockKey(sbn, packetId, catalogTrackName);
|
|
@@ -3300,7 +3426,7 @@ var FECManager = class _FECManager {
|
|
|
3300
3426
|
}
|
|
3301
3427
|
const trackConfig = this.#trackConfigs.get(packetId);
|
|
3302
3428
|
if (trackConfig === void 0) return void 0;
|
|
3303
|
-
return Math.max(1, trackConfig
|
|
3429
|
+
return Math.max(1, this.#repairGraceMs(trackConfig, this.#multicastWaitMs(trackConfig)));
|
|
3304
3430
|
}
|
|
3305
3431
|
/** True once configureTrack/setFecDecoder/setFecWorker configured this packetId. */
|
|
3306
3432
|
// -----------------------------------------------------------------------
|
|
@@ -3392,6 +3518,8 @@ var FECManager = class _FECManager {
|
|
|
3392
3518
|
const locator = this.#growingIsoLocatorFor(packetId, catalogTrackName);
|
|
3393
3519
|
const evictedBefore = locator.heldEvicted;
|
|
3394
3520
|
const held = locator.hold(ssId, source);
|
|
3521
|
+
this.#settleExpiredIsoHoles(locator, packetId, catalogTrackName);
|
|
3522
|
+
if (held && source.source === "multicast") this.#noteMulticastSource(locator, ssId, packetId, catalogTrackName);
|
|
3395
3523
|
const evicted = locator.heldEvicted - evictedBefore;
|
|
3396
3524
|
if (evicted > 0) {
|
|
3397
3525
|
const before = this.#isoHeldEvictedCount;
|
|
@@ -3412,17 +3540,20 @@ var FECManager = class _FECManager {
|
|
|
3412
3540
|
* contradicts a known block is refused (counted) and must be dropped.
|
|
3413
3541
|
*/
|
|
3414
3542
|
placeIsoRepair(packetId, catalogTrackName, ssStart, ssbLength) {
|
|
3415
|
-
const
|
|
3543
|
+
const locator = this.#growingIsoLocatorFor(packetId, catalogTrackName);
|
|
3544
|
+
const placement = locator.placeRepair(ssStart, ssbLength);
|
|
3545
|
+
this.#settleExpiredIsoHoles(locator, packetId, catalogTrackName);
|
|
3416
3546
|
if (placement.status !== "placed") {
|
|
3417
3547
|
this.#isoRepairRefusedCount++;
|
|
3418
3548
|
if (this.#isoRepairRefusedCount <= 5 || this.#isoRepairRefusedCount % 100 === 0) {
|
|
3419
3549
|
console.warn(`[FECManager] packetId=${packetId} iso-ssbg1-v1 repair refused (${placement.status}): ${placement.reason}`);
|
|
3420
3550
|
}
|
|
3551
|
+
if (placement.ofSpan !== void 0) this.releaseRepairHold(placement.ofSpan.start, packetId, catalogTrackName);
|
|
3421
3552
|
return placement;
|
|
3422
3553
|
}
|
|
3554
|
+
this.#isoSpanKeys.delete(this.#blockKey(placement.block.start, packetId, catalogTrackName));
|
|
3423
3555
|
if (placement.span !== void 0) this.#openIsoSpan(placement.span, packetId, catalogTrackName);
|
|
3424
3556
|
if (placement.hole !== void 0) {
|
|
3425
|
-
const locator = this.#isoLocatorFor(packetId, catalogTrackName);
|
|
3426
3557
|
const hole = placement.hole.block;
|
|
3427
3558
|
const previous = locator.blockEndingAt(hole.start);
|
|
3428
3559
|
const loss = {
|
|
@@ -3443,17 +3574,29 @@ var FECManager = class _FECManager {
|
|
|
3443
3574
|
* `handler`, instead of a repair-less span; null restores spans. Set by the
|
|
3444
3575
|
* range repair scheduler; applies to every stream from its next gap. The
|
|
3445
3576
|
* handler and the deferral are one setting, so no hole is ever created with
|
|
3446
|
-
* nobody to close it.
|
|
3577
|
+
* nobody to close it. `onExpired` is told of each pending hole the stream
|
|
3578
|
+
* runs past the locator's horizon (BLO-52085): returning true, it closes
|
|
3579
|
+
* the hole (`closeIsoHoles`), so the span it leaves still fails and is
|
|
3580
|
+
* reported; otherwise the hole is discarded with its sources.
|
|
3447
3581
|
*/
|
|
3448
|
-
setUndelimitedLossHandler(handler) {
|
|
3582
|
+
setUndelimitedLossHandler(handler, onExpired = null) {
|
|
3449
3583
|
this.#onUndelimitedLoss = handler;
|
|
3584
|
+
this.#onIsoHoleExpired = handler === null ? null : onExpired;
|
|
3450
3585
|
this.#deferIsoGaps = handler !== null;
|
|
3451
3586
|
for (const locator of this.#isoLocators.values()) locator.deferIncompleteGaps = this.#deferIsoGaps;
|
|
3452
3587
|
}
|
|
3588
|
+
/** Hand each hole the locator's horizon passed to its owner, or discard it (setUndelimitedLossHandler). */
|
|
3589
|
+
#settleExpiredIsoHoles(locator, packetId, catalogTrackName) {
|
|
3590
|
+
for (const hole of locator.takeExpiredHoles()) {
|
|
3591
|
+
const expired = { packetId, catalogTrackName, holeStart: hole.start, holeLength: hole.length };
|
|
3592
|
+
if (this.#onIsoHoleExpired?.(expired) !== true) locator.closeHolesWithin(hole.start, hole.length);
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3453
3595
|
/**
|
|
3454
|
-
* The range repair for a hole ended: every hole
|
|
3455
|
-
*
|
|
3456
|
-
* with the held sources they placed, for the caller to feed
|
|
3596
|
+
* The range repair for a hole ended: every hole inside `[start, start +
|
|
3597
|
+
* length)`, pending or expired, becomes a repair-less span. Returns those
|
|
3598
|
+
* spans with the held sources they placed, for the caller to feed
|
|
3599
|
+
* (MmtpRouter).
|
|
3457
3600
|
*/
|
|
3458
3601
|
closeIsoHoles(packetId, catalogTrackName, start, length) {
|
|
3459
3602
|
const locator = this.#isoLocators.get(this.#streamKey(packetId, catalogTrackName));
|
|
@@ -3469,10 +3612,25 @@ var FECManager = class _FECManager {
|
|
|
3469
3612
|
* its placed sources exactly as on the wire (feedRepairSymbol). A span every
|
|
3470
3613
|
* SS_ID of which vanished resolves through its deadline like any vanished
|
|
3471
3614
|
* block.
|
|
3615
|
+
*
|
|
3616
|
+
* A span longer than K holds more than one block (SSB_length <= K), and the
|
|
3617
|
+
* locator states no block inside a span, only one exactly its range
|
|
3618
|
+
* (IsoBlockLocator.placeRepair): no repair, multicast or FETCHed, can ever
|
|
3619
|
+
* reach it. Its repair group is empty, so the repair scheduler FETCHes no
|
|
3620
|
+
* Group of it (group-cannot-complete). Every span still keeps its whole
|
|
3621
|
+
* wait (#lateSourceWaitMs): failing it early released the frames behind it
|
|
3622
|
+
* past a keyframe the overlay was still rebuilding (BLO-52085). The release
|
|
3623
|
+
* gate lets those frames go once only a late source can fill the gap
|
|
3624
|
+
* before them, as long after they arrived as the gap's decision allows
|
|
3625
|
+
* (isoRepairlessWaitMs).
|
|
3472
3626
|
*/
|
|
3473
3627
|
#openIsoSpan(span, packetId, catalogTrackName) {
|
|
3474
3628
|
const key = this.#blockKey(span.block.start, packetId, catalogTrackName);
|
|
3475
|
-
if (!this.#blockAuthoredLengths.has(key))
|
|
3629
|
+
if (!this.#blockAuthoredLengths.has(key)) {
|
|
3630
|
+
this.#blockAuthoredLengths.set(key, span.block.length);
|
|
3631
|
+
this.#isoSpanKeys.add(key);
|
|
3632
|
+
if (span.block.length > this.#isoLocatorFor(packetId, catalogTrackName).kMax) this.#blockRsbLengths.set(key, 0);
|
|
3633
|
+
}
|
|
3476
3634
|
if (span.placed.length === 0) this.#materializeBlock(span.block.start, packetId, catalogTrackName, true);
|
|
3477
3635
|
}
|
|
3478
3636
|
/**
|
|
@@ -3510,6 +3668,62 @@ var FECManager = class _FECManager {
|
|
|
3510
3668
|
}
|
|
3511
3669
|
return lost;
|
|
3512
3670
|
}
|
|
3671
|
+
/**
|
|
3672
|
+
* The release gate's wait, from a frame's arrival, for the SS_IDs strictly
|
|
3673
|
+
* between two released frames' SS_IDs once only a late source can still
|
|
3674
|
+
* fill them, else undefined. That is when every one missing (neither
|
|
3675
|
+
* arrived nor held) lies in a repair-less span longer than K, which no
|
|
3676
|
+
* repair can state a block of (#openIsoSpan), or in a stated block its
|
|
3677
|
+
* own repair group cannot complete every SS_ID of which it misses lies
|
|
3678
|
+
* between them (so the gap's decision covers all it lost), and a multicast
|
|
3679
|
+
* source at or past `toSsId` arrived, so each is lost or reordered behind
|
|
3680
|
+
* it (a MoQ source shows nothing: MoQ streams overtake one another). The
|
|
3681
|
+
* span or block itself keeps its own wait.
|
|
3682
|
+
*
|
|
3683
|
+
* The wait is the late-symbol allowance, unless `rapMayHide`: the gap may
|
|
3684
|
+
* hold a RAP packet an installed keyframe overlay can still rebuild (its
|
|
3685
|
+
* decision stalls, or it ends at a RAP that may lie past a whole MPU).
|
|
3686
|
+
* Then the frame waits as a stated block its group cannot complete does
|
|
3687
|
+
* (#overlayLateWaitMs): the allowance alone with no overlay installed, the
|
|
3688
|
+
* overlay's span plus the larger of the allowance and its tolerance, or,
|
|
3689
|
+
* for an overlay that states no span, the span's whole wait (undefined).
|
|
3690
|
+
* So does `rapNext` (the gap ends at the RAP that opens the next MPU) when
|
|
3691
|
+
* the gap holds a stated block's loss.
|
|
3692
|
+
*/
|
|
3693
|
+
isoRepairlessWaitMs(packetId, catalogTrackName, fromSsId, toSsId, rapMayHide = false, rapNext = false) {
|
|
3694
|
+
const config = this.#trackConfigs.get(packetId);
|
|
3695
|
+
if (config === void 0 || !_FECManager.#hasCatalogTiming(config)) return void 0;
|
|
3696
|
+
const locator = this.#isoLocators.get(this.#streamKey(packetId, catalogTrackName));
|
|
3697
|
+
if (locator === void 0 || !locator.coversBetween(fromSsId, toSsId)) return void 0;
|
|
3698
|
+
const newestSource = locator.newestSource;
|
|
3699
|
+
if (newestSource === void 0 || serial32Precedes(newestSource, toSsId)) return void 0;
|
|
3700
|
+
let repairless = false;
|
|
3701
|
+
let stated = false;
|
|
3702
|
+
for (const block of locator.blocksBetween(fromSsId, toSsId)) {
|
|
3703
|
+
const key = this.#blockKey(block.start, packetId, catalogTrackName);
|
|
3704
|
+
if (this.#completedBlocks.has(key)) continue;
|
|
3705
|
+
if (block.span && block.length > locator.kMax) {
|
|
3706
|
+
repairless = true;
|
|
3707
|
+
continue;
|
|
3708
|
+
}
|
|
3709
|
+
const received = this.#blockSourceEsis.get(key);
|
|
3710
|
+
const rebuilt = this.#blockRebuiltEsis.get(key);
|
|
3711
|
+
let missesInGap = false;
|
|
3712
|
+
let missesOutside = false;
|
|
3713
|
+
for (let esi = 0; esi < block.length; esi++) {
|
|
3714
|
+
const ssId = serial32Add(block.start, esi);
|
|
3715
|
+
if (received?.has(esi) || locator.isHeld(ssId)) continue;
|
|
3716
|
+
if (serial32Precedes(fromSsId, ssId) && serial32Precedes(ssId, toSsId)) missesInGap = true;
|
|
3717
|
+
else if (!rebuilt?.has(esi)) missesOutside = true;
|
|
3718
|
+
}
|
|
3719
|
+
if (!missesInGap) continue;
|
|
3720
|
+
if (missesOutside || block.span || !this.#groupCannotComplete(key)) return void 0;
|
|
3721
|
+
repairless = stated = true;
|
|
3722
|
+
}
|
|
3723
|
+
if (!repairless) return void 0;
|
|
3724
|
+
const waitMs = rapMayHide || stated && rapNext ? this.#overlayLateWaitMs(packetId, catalogTrackName, config) : this.#multicastWaitMs(config) - config.interleaveDepthMs;
|
|
3725
|
+
return waitMs === void 0 ? void 0 : Math.max(0, waitMs);
|
|
3726
|
+
}
|
|
3513
3727
|
/**
|
|
3514
3728
|
* iso-ssbg1-v1 block location: repair symbols it refused, oversize sources,
|
|
3515
3729
|
* the sources held now for a block no repair has stated yet, and the held
|
|
@@ -3813,11 +4027,14 @@ var FECManager = class _FECManager {
|
|
|
3813
4027
|
});
|
|
3814
4028
|
client.onCleanupComplete((sbn) => {
|
|
3815
4029
|
if (this.#releasedWorkerClients.has(client)) return;
|
|
3816
|
-
const
|
|
4030
|
+
const owed = [...this.#pendingWorkerCleanups].filter((key) => this.#pendingWorkerCleanupClients.get(key) === client);
|
|
4031
|
+
const cleanupKeys = owed.filter((key) => {
|
|
3817
4032
|
const block = this.#parseBlockKey(key);
|
|
3818
|
-
return block.packetId === packetId && block.sbn === sbn
|
|
4033
|
+
return block.packetId === packetId && block.sbn === sbn;
|
|
3819
4034
|
});
|
|
3820
|
-
|
|
4035
|
+
const askedAtMs = Math.max(...cleanupKeys.map((key) => this.#pendingWorkerCleanupBounds.get(key)?.askedAtMs ?? -Infinity));
|
|
4036
|
+
const due = owed.filter((key) => !cleanupKeys.includes(key) && (this.#pendingWorkerCleanupBounds.get(key)?.dueAtMs ?? Infinity) <= askedAtMs);
|
|
4037
|
+
for (const key of [...cleanupKeys, ...due]) this.#settleOwedCleanup(key, "cleanup-ack");
|
|
3821
4038
|
});
|
|
3822
4039
|
client.onError((msg, code) => {
|
|
3823
4040
|
const requestedKind = code ?? msg;
|
|
@@ -3887,9 +4104,11 @@ var FECManager = class _FECManager {
|
|
|
3887
4104
|
* fail deadline already passed, so failing it is the decision that deadline
|
|
3888
4105
|
* made. A late ack then finds nothing owed and is a no-op.
|
|
3889
4106
|
*/
|
|
3890
|
-
#boundOwedCleanup(key, packetId, client) {
|
|
4107
|
+
#boundOwedCleanup(key, packetId, client, dueAtMs) {
|
|
3891
4108
|
this.#clearOwedCleanupBound(key);
|
|
3892
4109
|
const bound = {
|
|
4110
|
+
dueAtMs,
|
|
4111
|
+
askedAtMs: performance.now(),
|
|
3893
4112
|
handle: setTimeout(() => {
|
|
3894
4113
|
if (this.#pendingWorkerCleanupBounds.get(key) !== bound) return;
|
|
3895
4114
|
this.#pendingWorkerCleanupBounds.delete(key);
|
|
@@ -3987,7 +4206,15 @@ var FECManager = class _FECManager {
|
|
|
3987
4206
|
this.#isoSourceOversizeCount++;
|
|
3988
4207
|
return null;
|
|
3989
4208
|
}
|
|
3990
|
-
|
|
4209
|
+
return this.#feedDecoderSource(packetId, ssId, symbolData, catalogTrackName, located.block.start);
|
|
4210
|
+
}
|
|
4211
|
+
/**
|
|
4212
|
+
* Hand one placed source symbol to the stream's decoder: its Worker, which
|
|
4213
|
+
* answers through onFrame (null here), or its synchronous decoder, whose
|
|
4214
|
+
* recovered block is returned. `sbn` is the SS_Start of the block a repair
|
|
4215
|
+
* stated for `ssId`.
|
|
4216
|
+
*/
|
|
4217
|
+
#feedDecoderSource(packetId, ssId, symbolData, catalogTrackName, sbn) {
|
|
3991
4218
|
const blockKey = this.#blockKey(sbn, packetId, catalogTrackName);
|
|
3992
4219
|
const syncBlockOwner = this.#syncDecoderBlockOwners.get(blockKey);
|
|
3993
4220
|
const workerClient = this.#routableWorkerForPacket(packetId, catalogTrackName);
|
|
@@ -4016,6 +4243,74 @@ var FECManager = class _FECManager {
|
|
|
4016
4243
|
}
|
|
4017
4244
|
return recovered;
|
|
4018
4245
|
}
|
|
4246
|
+
/**
|
|
4247
|
+
* Feed a source symbol of this stream that another FEC instance over the
|
|
4248
|
+
* same packets rebuilt: a keyframe overlay recovery whose base SS_ID the
|
|
4249
|
+
* caller determined (draft-ramadan-moq-mmt-02 7.1, 7.4.4; joint decoding,
|
|
4250
|
+
* BLO-52085). It joins its block's decoder as a received source would, so
|
|
4251
|
+
* it reduces the erasures the block still has to solve, but it is not a
|
|
4252
|
+
* network arrival: no transport accounting, no classification evidence,
|
|
4253
|
+
* no deadline refresh, and it never makes a block clean.
|
|
4254
|
+
*
|
|
4255
|
+
* Only a block a repair stated takes one (a repair-less span has no
|
|
4256
|
+
* decoder block). A block that is terminal, or already holds that source,
|
|
4257
|
+
* does not. The symbol is the exact protected packet, unpadded, as
|
|
4258
|
+
* feedSourceSymbol takes it.
|
|
4259
|
+
*
|
|
4260
|
+
* `recovered` is the block the synchronous decoder completed with it; the
|
|
4261
|
+
* caller routes it and completes the block, as for any recovery. When
|
|
4262
|
+
* every source of the block is then present, received or rebuilt, and no
|
|
4263
|
+
* decoder returned it (a Worker answers asynchronously, and reports such a
|
|
4264
|
+
* block as clean on its own side), the block is completed here as
|
|
4265
|
+
* recovered, with nothing left to route.
|
|
4266
|
+
*/
|
|
4267
|
+
feedRebuiltSourceSymbol(packetId, ssId, symbolData, catalogTrackName) {
|
|
4268
|
+
if (!this.#hasBlockProfile(packetId)) return NOT_TAKEN;
|
|
4269
|
+
const located = this.#isoLocatorFor(packetId, catalogTrackName).locate(ssId);
|
|
4270
|
+
if (located === null || located.block.span) return NOT_TAKEN;
|
|
4271
|
+
if (!ssbg1FitsSymbol(symbolData.byteLength, this.#trackConfig(packetId).symbolSize)) return NOT_TAKEN;
|
|
4272
|
+
const sbn = located.block.start;
|
|
4273
|
+
const key = this.#blockKey(sbn, packetId, catalogTrackName);
|
|
4274
|
+
if (this.#completedBlocks.has(key) || this.#blockSourceEsis.get(key)?.has(located.esi)) return NOT_TAKEN;
|
|
4275
|
+
let rebuilt = this.#blockRebuiltEsis.get(key);
|
|
4276
|
+
if (rebuilt?.has(located.esi)) return NOT_TAKEN;
|
|
4277
|
+
if (rebuilt === void 0) {
|
|
4278
|
+
rebuilt = /* @__PURE__ */ new Set();
|
|
4279
|
+
this.#blockRebuiltEsis.set(key, rebuilt);
|
|
4280
|
+
}
|
|
4281
|
+
const config = this.#trackConfigs.get(packetId);
|
|
4282
|
+
const wasShort = config !== void 0 && this.#lateSourceWaitMs(key, sbn, packetId, catalogTrackName, config) !== void 0;
|
|
4283
|
+
rebuilt.add(located.esi);
|
|
4284
|
+
const recovered = this.#feedDecoderSource(packetId, ssId, symbolData, catalogTrackName, sbn);
|
|
4285
|
+
if (recovered === null && !this.#completeWhenSourcesPresent(key, sbn, located.block.length, packetId, catalogTrackName)) {
|
|
4286
|
+
if (wasShort && this.#activeBlocks.has(key) && this.#lateSourceWaitMs(key, sbn, packetId, catalogTrackName, config) === void 0) {
|
|
4287
|
+
this.#armBlockTimeout(sbn, packetId, catalogTrackName, this.#multicastWaitMs(config));
|
|
4288
|
+
}
|
|
4289
|
+
}
|
|
4290
|
+
return { taken: true, recovered };
|
|
4291
|
+
}
|
|
4292
|
+
/**
|
|
4293
|
+
* A block that holds every one of its `length` sources, received or
|
|
4294
|
+
* rebuilt by another instance, with at least one rebuilt, is recovered:
|
|
4295
|
+
* every packet of it was delivered, by its own arrival or by the instance
|
|
4296
|
+
* that rebuilt it, so nothing is routed. Returns whether it completed it.
|
|
4297
|
+
*/
|
|
4298
|
+
#completeWhenSourcesPresent(key, sbn, length, packetId, catalogTrackName) {
|
|
4299
|
+
const rebuilt = this.#blockRebuiltEsis.get(key);
|
|
4300
|
+
if (rebuilt === void 0 || this.#completedBlocks.has(key)) return false;
|
|
4301
|
+
let present = rebuilt.size;
|
|
4302
|
+
for (const esi of this.#blockSourceEsis.get(key) ?? []) if (!rebuilt.has(esi)) present++;
|
|
4303
|
+
if (present < length) return false;
|
|
4304
|
+
this.#traceLifecycle("recovered", sbn, packetId, catalogTrackName);
|
|
4305
|
+
this.countRecovery(packetId, sbn, catalogTrackName);
|
|
4306
|
+
this.cancelBlockTimeout(sbn, packetId, catalogTrackName);
|
|
4307
|
+
if (catalogTrackName === void 0) {
|
|
4308
|
+
this.onBlockComplete?.(sbn, packetId);
|
|
4309
|
+
} else {
|
|
4310
|
+
this.onBlockComplete?.(sbn, packetId, catalogTrackName);
|
|
4311
|
+
}
|
|
4312
|
+
return true;
|
|
4313
|
+
}
|
|
4019
4314
|
/**
|
|
4020
4315
|
* fec-01 4.5: a reed-solomon repair packet whose SSB_length + RSB_length
|
|
4021
4316
|
* exceeds 255, or whose RS_ID is not below RSB_length, is discarded with the
|
|
@@ -4218,8 +4513,115 @@ var FECManager = class _FECManager {
|
|
|
4218
4513
|
this.#completeCleanBlock(blockKey, sbn, packetId, catalogTrackName);
|
|
4219
4514
|
return null;
|
|
4220
4515
|
}
|
|
4516
|
+
if (recovered === null) this.#shortenUnrecoverableWait(blockKey, sbn, packetId, catalogTrackName);
|
|
4221
4517
|
return recovered;
|
|
4222
4518
|
}
|
|
4519
|
+
/**
|
|
4520
|
+
* A first-arrival multicast source, held or placed. A datagram flow keeps
|
|
4521
|
+
* its sources in send order, so one that moves the stream's newest source
|
|
4522
|
+
* position past a block leaves the sources that block still misses
|
|
4523
|
+
* reordered behind it at best: it shortens the wait of every block it
|
|
4524
|
+
* passed that only a late source can complete. MoQ is left out: its streams
|
|
4525
|
+
* can overtake one another, so a MoQ source shows nothing about the sources
|
|
4526
|
+
* sent before it.
|
|
4527
|
+
*/
|
|
4528
|
+
#noteMulticastSource(locator, ssId, packetId, catalogTrackName) {
|
|
4529
|
+
const previous = locator.newestSource;
|
|
4530
|
+
if (!locator.noteSource(ssId) || previous === void 0) return;
|
|
4531
|
+
for (const block of locator.blocksBetween(previous - 1 >>> 0, ssId)) {
|
|
4532
|
+
if (!serial32Precedes(serial32Add(block.start, block.length - 1), ssId)) continue;
|
|
4533
|
+
this.#shortenUnrecoverableWait(
|
|
4534
|
+
this.#blockKey(block.start, packetId, catalogTrackName),
|
|
4535
|
+
block.start,
|
|
4536
|
+
packetId,
|
|
4537
|
+
catalogTrackName
|
|
4538
|
+
);
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
4541
|
+
/**
|
|
4542
|
+
* The wait of a block that only a late source can complete (BLO-52085): a
|
|
4543
|
+
* repair stated it, its received sources plus every symbol its repair group
|
|
4544
|
+
* carries (RSB_length) are short of K' (the repair scheduler's
|
|
4545
|
+
* group-cannot-complete), and a later source of the stream has arrived, so
|
|
4546
|
+
* a source it misses is lost or reordered behind that one. The span, which
|
|
4547
|
+
* covers repair symbols paced after its sources, buys it nothing: it waits
|
|
4548
|
+
* the late-symbol allowance alone, the multicast wait less the span (the
|
|
4549
|
+
* catalog tolerance or the measured delivery gap). Undefined for any other
|
|
4550
|
+
* block. While a keyframe overlay is installed, the block waits for its
|
|
4551
|
+
* repair too (#overlayLateWaitMs). A repair-less span keeps its whole
|
|
4552
|
+
* wait, even one longer than K whose group is empty (#openIsoSpan): its
|
|
4553
|
+
* resolution is what releases the frames behind it, and failing it early
|
|
4554
|
+
* released them past a keyframe the overlay was still rebuilding, which
|
|
4555
|
+
* then arrived stale. The release gate lets them go instead
|
|
4556
|
+
* (isoRepairlessWaitMs).
|
|
4557
|
+
*/
|
|
4558
|
+
#lateSourceWaitMs(key, sbn, packetId, catalogTrackName, config) {
|
|
4559
|
+
if (this.#isoSpanKeys.has(key) || !this.#groupCannotComplete(key)) return void 0;
|
|
4560
|
+
const authoredLength = this.#blockAuthoredLengths.get(key);
|
|
4561
|
+
const newestSource = this.#isoLocators.get(this.#streamKey(packetId, catalogTrackName))?.newestSource;
|
|
4562
|
+
if (newestSource === void 0 || !serial32Precedes(serial32Add(sbn, authoredLength - 1), newestSource)) {
|
|
4563
|
+
return void 0;
|
|
4564
|
+
}
|
|
4565
|
+
return this.#overlayLateWaitMs(packetId, catalogTrackName, config);
|
|
4566
|
+
}
|
|
4567
|
+
/**
|
|
4568
|
+
* A repair stated the block, and its sources plus every symbol its repair
|
|
4569
|
+
* group carries (RSB_length) are short of its SSB_length.
|
|
4570
|
+
*/
|
|
4571
|
+
#groupCannotComplete(key) {
|
|
4572
|
+
const authoredLength = this.#blockAuthoredLengths.get(key);
|
|
4573
|
+
const rsbLength = this.#blockRsbLengths.get(key);
|
|
4574
|
+
if (authoredLength === void 0 || rsbLength === void 0) return false;
|
|
4575
|
+
let present = this.#blockSourceCounts.get(key) ?? 0;
|
|
4576
|
+
const received = this.#blockSourceEsis.get(key);
|
|
4577
|
+
for (const esi of this.#blockRebuiltEsis.get(key) ?? []) if (!received?.has(esi)) present++;
|
|
4578
|
+
return present + rsbLength < authoredLength;
|
|
4579
|
+
}
|
|
4580
|
+
/**
|
|
4581
|
+
* How long a loss only a late source or an installed keyframe overlay can
|
|
4582
|
+
* still fill waits once a later source passed it: the late-symbol
|
|
4583
|
+
* allowance alone (the multicast wait less the span) while no overlay is
|
|
4584
|
+
* installed. An installed one (keyframeOverlayTiming) may still rebuild a
|
|
4585
|
+
* RAP packet the loss took: a second FEC instance over the same packets
|
|
4586
|
+
* (draft-ramadan-moq-mmt-02 7.4), whose repair is paced across its own
|
|
4587
|
+
* span, unrelated to the base's. That packet can complete a stated block
|
|
4588
|
+
* (feedRebuiltSourceSymbol), or play behind a span; giving the loss up
|
|
4589
|
+
* first lets the release gate pass the keyframe, whose rebuild then lands
|
|
4590
|
+
* stale. The overlay repair of a packet the loss took goes out within the
|
|
4591
|
+
* overlay's span of that packet (fec-core-00 9.3), and the later source was
|
|
4592
|
+
* sent after it, so the loss waits that span plus the larger of the
|
|
4593
|
+
* allowance and the overlay's own tolerance. An overlay that states no
|
|
4594
|
+
* span (its block may then span keyframes), or one whose wait is not
|
|
4595
|
+
* shorter than the whole multicast wait, leaves the whole wait: undefined.
|
|
4596
|
+
*/
|
|
4597
|
+
#overlayLateWaitMs(packetId, catalogTrackName, config) {
|
|
4598
|
+
const waitMs = this.#multicastWaitMs(config);
|
|
4599
|
+
const allowanceMs = waitMs - config.interleaveDepthMs;
|
|
4600
|
+
const overlay = this.keyframeOverlayTiming?.(packetId, catalogTrackName);
|
|
4601
|
+
if (overlay === void 0) return allowanceMs;
|
|
4602
|
+
const overlaySpanMs = overlay.interleaveDepthMs ?? 0;
|
|
4603
|
+
const overlayWaitMs = overlaySpanMs + Math.max(allowanceMs, overlay.reorderToleranceMs ?? 0);
|
|
4604
|
+
return overlaySpanMs > 0 && overlayWaitMs < waitMs ? overlayWaitMs : void 0;
|
|
4605
|
+
}
|
|
4606
|
+
/**
|
|
4607
|
+
* Bring an open block's wait in to its late-source wait, when it has one.
|
|
4608
|
+
* Never later than it is armed: only a source can complete such a block,
|
|
4609
|
+
* so a repair of its group (paced across the span) must not keep it open.
|
|
4610
|
+
*/
|
|
4611
|
+
#shortenUnrecoverableWait(key, sbn, packetId, catalogTrackName) {
|
|
4612
|
+
if (!this.#activeBlocks.has(key)) return;
|
|
4613
|
+
const config = this.#trackConfigs.get(packetId);
|
|
4614
|
+
if (config === void 0) return;
|
|
4615
|
+
const waitMs = this.#lateSourceWaitMs(key, sbn, packetId, catalogTrackName, config);
|
|
4616
|
+
if (waitMs === void 0) return;
|
|
4617
|
+
const armedAtMs = this.#blockWaitDeadlinesMs.get(key);
|
|
4618
|
+
this.#armBlockTimeout(
|
|
4619
|
+
sbn,
|
|
4620
|
+
packetId,
|
|
4621
|
+
catalogTrackName,
|
|
4622
|
+
armedAtMs === void 0 ? waitMs : Math.min(waitMs, armedAtMs - this.#receiptNow())
|
|
4623
|
+
);
|
|
4624
|
+
}
|
|
4223
4625
|
/**
|
|
4224
4626
|
* Record a block's authored SSB_length from a repair symbol. Returns false,
|
|
4225
4627
|
* leaving the block unchanged, when the symbol contradicts the block: a
|
|
@@ -4317,12 +4719,13 @@ var FECManager = class _FECManager {
|
|
|
4317
4719
|
* the inactivity deadline on each symbol, records the symbol's in-band
|
|
4318
4720
|
* classification evidence, and marks the block clean when all of its
|
|
4319
4721
|
* authored source symbols arrived: the SSB_length a repair symbol declared,
|
|
4320
|
-
* otherwise K.
|
|
4722
|
+
* otherwise K. `held` marks a source held unplaced since it arrived and
|
|
4723
|
+
* placed only now (see #noteSbnSeen).
|
|
4321
4724
|
*
|
|
4322
4725
|
* Throws for a packetId that was never configured, so a classified block
|
|
4323
4726
|
* never reads the manager-global K or timeout.
|
|
4324
4727
|
*/
|
|
4325
|
-
trackBlock(sbn, packetId, catalogTrackName, esi, evidence) {
|
|
4728
|
+
trackBlock(sbn, packetId, catalogTrackName, esi, evidence, held = false) {
|
|
4326
4729
|
const trackConfig = this.#trackConfigs.get(packetId);
|
|
4327
4730
|
if (trackConfig === void 0) {
|
|
4328
4731
|
throw new Error(
|
|
@@ -4338,7 +4741,8 @@ var FECManager = class _FECManager {
|
|
|
4338
4741
|
catalogTrackName,
|
|
4339
4742
|
"source",
|
|
4340
4743
|
evidence.packetSequenceNumber,
|
|
4341
|
-
Number.isInteger(esi) ? sbn + esi >>> 0 : sbn
|
|
4744
|
+
Number.isInteger(esi) ? sbn + esi >>> 0 : sbn,
|
|
4745
|
+
held
|
|
4342
4746
|
);
|
|
4343
4747
|
const authoredLength = this.#blockAuthoredLengths.get(key) ?? k;
|
|
4344
4748
|
if (Number.isInteger(esi) && esi >= authoredLength) {
|
|
@@ -4374,6 +4778,15 @@ var FECManager = class _FECManager {
|
|
|
4374
4778
|
this.#completeCleanBlock(key, sbn, packetId, catalogTrackName);
|
|
4375
4779
|
return;
|
|
4376
4780
|
}
|
|
4781
|
+
if (this.#blockRebuiltEsis.has(key) && this.#completeWhenSourcesPresent(
|
|
4782
|
+
key,
|
|
4783
|
+
sbn,
|
|
4784
|
+
this.#isoLocatorFor(packetId, catalogTrackName).blockAt(sbn)?.length ?? authoredLength,
|
|
4785
|
+
packetId,
|
|
4786
|
+
catalogTrackName
|
|
4787
|
+
)) {
|
|
4788
|
+
return;
|
|
4789
|
+
}
|
|
4377
4790
|
this.noteBlockActivity(sbn, packetId, catalogTrackName, true);
|
|
4378
4791
|
}
|
|
4379
4792
|
#completeCleanBlock(key, sbn, packetId, catalogTrackName) {
|
|
@@ -4382,7 +4795,9 @@ var FECManager = class _FECManager {
|
|
|
4382
4795
|
this.cancelBlockTimeout(sbn, packetId, catalogTrackName);
|
|
4383
4796
|
this.#blockSourceCounts.delete(key);
|
|
4384
4797
|
this.#blockSourceEsis.delete(key);
|
|
4798
|
+
this.#blockRebuiltEsis.delete(key);
|
|
4385
4799
|
this.#blockAuthoredLengths.delete(key);
|
|
4800
|
+
this.#isoSpanKeys.delete(key);
|
|
4386
4801
|
this.#blockRepairRsIds.delete(key);
|
|
4387
4802
|
this.#blockRsbLengths.delete(key);
|
|
4388
4803
|
this.#markTerminal(key, sbn, packetId, true);
|
|
@@ -4413,6 +4828,19 @@ var FECManager = class _FECManager {
|
|
|
4413
4828
|
#receiptNow() {
|
|
4414
4829
|
return this.#receiptAtMs ?? performance.now();
|
|
4415
4830
|
}
|
|
4831
|
+
/**
|
|
4832
|
+
* The whole-ms delay of a timer for `deadlineMs` armed inside a receipt
|
|
4833
|
+
* scope: counted from the receipt time, as the timer of a symbol fed when
|
|
4834
|
+
* it was received was, less the whole ms since. So it fires on the tick
|
|
4835
|
+
* that timer would have, never later than a delay counted from now, and
|
|
4836
|
+
* its handler still re-arms a timer that fires before its deadline.
|
|
4837
|
+
* Counted from now, a deadline set from the receipt time is rounded up
|
|
4838
|
+
* from another fraction of a ms (BLO-52085).
|
|
4839
|
+
*/
|
|
4840
|
+
#receiptTimerDelayMs(deadlineMs, minMs) {
|
|
4841
|
+
const receivedAtMs = this.#receiptAtMs;
|
|
4842
|
+
return Math.max(minMs, Math.ceil(deadlineMs - receivedAtMs) - Math.ceil(performance.now() - receivedAtMs));
|
|
4843
|
+
}
|
|
4416
4844
|
/**
|
|
4417
4845
|
* A held packet admitted late arms from its (earlier) receipt time; that
|
|
4418
4846
|
* never pulls in a deadline later activity already armed. Outside a
|
|
@@ -4448,10 +4876,20 @@ var FECManager = class _FECManager {
|
|
|
4448
4876
|
this.#repairDeadlineMs(trackConfig)
|
|
4449
4877
|
);
|
|
4450
4878
|
}
|
|
4451
|
-
this.#
|
|
4879
|
+
if (!sourceProgress && this.#lateSourceWaitMs(key, sbn, packetId, catalogTrackName, trackConfig) !== void 0) {
|
|
4880
|
+
this.#shortenUnrecoverableWait(key, sbn, packetId, catalogTrackName);
|
|
4881
|
+
return;
|
|
4882
|
+
}
|
|
4883
|
+
this.#armBlockTimeout(
|
|
4884
|
+
sbn,
|
|
4885
|
+
packetId,
|
|
4886
|
+
catalogTrackName,
|
|
4887
|
+
this.#lateSourceWaitMs(key, sbn, packetId, catalogTrackName, trackConfig) ?? timeoutMs
|
|
4888
|
+
);
|
|
4452
4889
|
}
|
|
4453
4890
|
#failBlock(sbn, packetId, catalogTrackName) {
|
|
4454
4891
|
const key = this.#blockKey(sbn, packetId, catalogTrackName);
|
|
4892
|
+
const span = this.#isoSpanKeys.delete(key) ? { length: this.#blockAuthoredLengths.get(key) ?? 0, sources: this.#blockSourceCounts.get(key) ?? 0 } : void 0;
|
|
4455
4893
|
this.#traceLifecycle("failed", sbn, packetId, catalogTrackName);
|
|
4456
4894
|
this.#clearRepairDeadline(key);
|
|
4457
4895
|
this.#clearBlockTimer(key);
|
|
@@ -4461,6 +4899,7 @@ var FECManager = class _FECManager {
|
|
|
4461
4899
|
}
|
|
4462
4900
|
this.#blockSourceCounts.delete(key);
|
|
4463
4901
|
this.#blockSourceEsis.delete(key);
|
|
4902
|
+
this.#blockRebuiltEsis.delete(key);
|
|
4464
4903
|
this.#blockAuthoredLengths.delete(key);
|
|
4465
4904
|
this.#blockRepairRsIds.delete(key);
|
|
4466
4905
|
this.#blockRsbLengths.delete(key);
|
|
@@ -4470,7 +4909,8 @@ var FECManager = class _FECManager {
|
|
|
4470
4909
|
this.#markPathBlockComplete(sbn, packetId, catalogTrackName);
|
|
4471
4910
|
this.#fecStats.blocksFailed++;
|
|
4472
4911
|
this.#statsForPacket(packetId).blocksFailed++;
|
|
4473
|
-
this.onBlockFailed?.(sbn, packetId, catalogTrackName, blockClass);
|
|
4912
|
+
if (span === void 0) this.onBlockFailed?.(sbn, packetId, catalogTrackName, blockClass);
|
|
4913
|
+
else this.onBlockFailed?.(sbn, packetId, catalogTrackName, blockClass, span);
|
|
4474
4914
|
this.onBlockResolved?.(sbn, packetId, catalogTrackName);
|
|
4475
4915
|
}
|
|
4476
4916
|
/**
|
|
@@ -4499,7 +4939,9 @@ var FECManager = class _FECManager {
|
|
|
4499
4939
|
this.#retireBlockClass(key, block.sbn, block.packetId, block.catalogTrackName);
|
|
4500
4940
|
this.#blockSourceCounts.delete(key);
|
|
4501
4941
|
this.#blockSourceEsis.delete(key);
|
|
4942
|
+
this.#blockRebuiltEsis.delete(key);
|
|
4502
4943
|
this.#blockAuthoredLengths.delete(key);
|
|
4944
|
+
this.#isoSpanKeys.delete(key);
|
|
4503
4945
|
this.#blockRepairRsIds.delete(key);
|
|
4504
4946
|
this.#blockRsbLengths.delete(key);
|
|
4505
4947
|
this.#clearBlockTimer(key);
|
|
@@ -4590,7 +5032,9 @@ var FECManager = class _FECManager {
|
|
|
4590
5032
|
this.#blockKeysBySbn.clear();
|
|
4591
5033
|
this.#blockSourceCounts.clear();
|
|
4592
5034
|
this.#blockSourceEsis.clear();
|
|
5035
|
+
this.#blockRebuiltEsis.clear();
|
|
4593
5036
|
this.#blockAuthoredLengths.clear();
|
|
5037
|
+
this.#isoSpanKeys.clear();
|
|
4594
5038
|
this.#blockRepairRsIds.clear();
|
|
4595
5039
|
this.#blockRsbLengths.clear();
|
|
4596
5040
|
this.#heldLayerStates.clear();
|