@blockcast/mmt-container 2.2.0-main.2c4d96d3ffc2 → 2.2.0-main.34b53d33bace

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.
Files changed (60) hide show
  1. package/dist/browser-runtime.js +954 -157
  2. package/dist/browser-runtime.js.map +3 -3
  3. package/dist/cmaf-block-assembler.js +92 -1
  4. package/dist/cmaf-block-assembler.js.map +2 -2
  5. package/dist/codec-utils.d.ts.map +1 -1
  6. package/dist/codec-utils.js +92 -1
  7. package/dist/codec-utils.js.map +2 -2
  8. package/dist/delta-fallback-config.js.map +1 -1
  9. package/dist/fec-manager.d.ts +71 -14
  10. package/dist/fec-manager.d.ts.map +1 -1
  11. package/dist/fec-manager.js +300 -60
  12. package/dist/fec-manager.js.map +2 -2
  13. package/dist/fec-worker-setup.js.map +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js.map +2 -2
  17. package/dist/iso-block-locator.d.ts +39 -13
  18. package/dist/iso-block-locator.d.ts.map +1 -1
  19. package/dist/iso-block-locator.js +80 -25
  20. package/dist/iso-block-locator.js.map +2 -2
  21. package/dist/media-router.js.map +1 -1
  22. package/dist/mmtp-container-parser.d.ts +63 -10
  23. package/dist/mmtp-container-parser.d.ts.map +1 -1
  24. package/dist/mmtp-container-parser.js +218 -18
  25. package/dist/mmtp-container-parser.js.map +2 -2
  26. package/dist/mmtp-container-parser.no-modules.js +217 -19
  27. package/dist/mmtp-container-parser.no-modules.js.map +3 -3
  28. package/dist/mmtp-decode-pipeline.js +218 -18
  29. package/dist/mmtp-decode-pipeline.js.map +2 -2
  30. package/dist/mmtp-router.d.ts +22 -9
  31. package/dist/mmtp-router.d.ts.map +1 -1
  32. package/dist/mmtp-router.js +384 -51
  33. package/dist/mmtp-router.js.map +3 -3
  34. package/dist/multicast-manager.d.ts +26 -3
  35. package/dist/multicast-manager.d.ts.map +1 -1
  36. package/dist/multicast-manager.js +774 -130
  37. package/dist/multicast-manager.js.map +3 -3
  38. package/dist/multicast-transport.js +2 -2
  39. package/dist/multicast-transport.js.map +2 -2
  40. package/dist/no-modules.js +218 -18
  41. package/dist/no-modules.js.map +3 -3
  42. package/dist/repair-fetch.d.ts +38 -8
  43. package/dist/repair-fetch.d.ts.map +1 -1
  44. package/dist/repair-fetch.js +286 -27
  45. package/dist/repair-fetch.js.map +3 -3
  46. package/dist/track-session.d.ts.map +1 -1
  47. package/dist/track-session.js +1 -0
  48. package/dist/track-session.js.map +2 -2
  49. package/dist/wasm-mmtp-container-parser.js +218 -18
  50. package/dist/wasm-mmtp-container-parser.js.map +2 -2
  51. package/package.json +5 -5
  52. package/src/codec-utils.ts +121 -1
  53. package/src/fec-manager.ts +316 -34
  54. package/src/index.ts +2 -0
  55. package/src/iso-block-locator.ts +114 -31
  56. package/src/mmtp-container-parser.ts +238 -21
  57. package/src/mmtp-router.ts +271 -58
  58. package/src/multicast-manager.ts +136 -16
  59. package/src/repair-fetch.ts +366 -50
  60. package/src/track-session.ts +3 -0
@@ -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
@@ -350,6 +359,9 @@ var IsoBlockLocator = class _IsoBlockLocator {
350
359
  #newest;
351
360
  #newestSource;
352
361
  #holes;
362
+ #expired;
363
+ #newlyExpired;
364
+ #closedBehind;
353
365
  static #checkedRetention(retentionBlocks) {
354
366
  if (!Number.isSafeInteger(retentionBlocks) || retentionBlocks <= 0) {
355
367
  throw new Error(
@@ -419,17 +431,29 @@ var IsoBlockLocator = class _IsoBlockLocator {
419
431
  }
420
432
  /** The known block or span containing `ssId`, with its ESI. */
421
433
  locate(ssId) {
422
- for (let i = this.#blocks.length - 1; i >= 0; i--) {
423
- const block = this.#blocks[i];
424
- if (isoBlockContains(block.start, block.length, ssId)) {
425
- return { block, esi: serial32Distance(block.start, ssId) };
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
+ }
426
440
  }
427
441
  }
428
442
  return null;
429
443
  }
430
- /** Number of pending holes. */
444
+ /** Number of holes not closed yet, pending or past the horizon. */
431
445
  get holeCount() {
432
- 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);
433
457
  }
434
458
  /** The stated block (never a span) ending exactly at `end`. */
435
459
  blockEndingAt(end) {
@@ -485,9 +509,11 @@ var IsoBlockLocator = class _IsoBlockLocator {
485
509
  /**
486
510
  * Apply one repair symbol's `(SS_Start, SSB_length)`. The first repair of a
487
511
  * block states its range and places every held source in it; later repair
488
- * symbols of the same block change nothing. A range that contradicts a
489
- * known block (a different length, or an overlap with another block or a
490
- * span) fails closed: the repair symbol is dropped and no block changes.
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.
491
517
  * A newly stated block retires behind its SS_Start (see the class note).
492
518
  * A block so far past `newest` that stating it would retire the position
493
519
  * `newest` is refused as `ahead`. When `newest` is a placed block's SS_Start
@@ -506,7 +532,16 @@ var IsoBlockLocator = class _IsoBlockLocator {
506
532
  const known = this.blockAt(start);
507
533
  if (known !== void 0) {
508
534
  if (known.span) {
509
- return { status: "overlap", reason: `repair block ${start}+${length} falls inside a repair-less span` };
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}` };
510
545
  }
511
546
  if (known.length !== length) {
512
547
  return {
@@ -574,18 +609,28 @@ var IsoBlockLocator = class _IsoBlockLocator {
574
609
  return span === void 0 ? { status: "placed", block, placed } : { status: "placed", block, placed, span };
575
610
  }
576
611
  /**
577
- * Turn every pending hole inside `[start, start + length)` into a
578
- * repair-less span, claiming its held sources: its range FETCH ended, so
579
- * nothing more will state its blocks. Returns the spans, in SS_ID order.
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.
580
618
  */
581
619
  closeHolesWithin(start, length) {
582
620
  const closed = [];
583
- for (const hole of [...this.#holes]) {
584
- if (!isoBlockContains(start, length, hole.start)) continue;
585
- this.#holes.splice(this.#holes.indexOf(hole), 1);
586
- const spanBlock = { start: hole.start, length: hole.length, span: true };
587
- closed.push({ block: spanBlock, placed: this.#claim(spanBlock) });
588
- this.#blocks.push(spanBlock);
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
+ }
589
634
  }
590
635
  return closed.sort((x, y) => serial32Distance(start, x.block.start) - serial32Distance(start, y.block.start));
591
636
  }
@@ -599,15 +644,17 @@ var IsoBlockLocator = class _IsoBlockLocator {
599
644
  return void 0;
600
645
  }
601
646
  /**
602
- * Retire every block and span whose last SS_ID, and every held source,
603
- * lies more than `retentionBlocks` blocks behind `position`, with the shared
604
- * lower-bound metric (`isoBlocksBehindLowerBound`) every ISO interleave
605
- * horizon uses. Returns the retired block starts.
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.
606
652
  */
607
653
  retireBehind(position) {
608
654
  this.observe(position);
609
655
  const horizon = this.#retentionBlocks;
610
656
  const retired = [];
657
+ this.#closedBehind.length = 0;
611
658
  for (let i = this.#blocks.length - 1; i >= 0; i--) {
612
659
  const block = this.#blocks[i];
613
660
  const last = serial32Add(block.start, block.length - 1);
@@ -619,10 +666,15 @@ var IsoBlockLocator = class _IsoBlockLocator {
619
666
  for (let i = this.#holes.length - 1; i >= 0; i--) {
620
667
  const hole = this.#holes[i];
621
668
  const last = serial32Add(hole.start, hole.length - 1);
622
- if (isoBlocksBehindLowerBound(last, position, this.#kMax) > horizon) this.#holes.splice(i, 1);
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);
623
673
  }
624
674
  for (const ssId of [...this.#held.keys()]) {
625
- if (isoBlocksBehindLowerBound(ssId, position, this.#kMax) > horizon) this.#held.delete(ssId);
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
+ }
626
678
  }
627
679
  return retired;
628
680
  }
@@ -630,6 +682,9 @@ var IsoBlockLocator = class _IsoBlockLocator {
630
682
  reset() {
631
683
  this.#blocks.length = 0;
632
684
  this.#holes.length = 0;
685
+ this.#expired.length = 0;
686
+ this.#newlyExpired.length = 0;
687
+ this.#closedBehind.length = 0;
633
688
  this.#held.clear();
634
689
  this.#coverageEnd = void 0;
635
690
  this.#newest = void 0;
@@ -1192,6 +1247,10 @@ var FECManager = class _FECManager {
1192
1247
  // 'pending' forever, which would park every later frame of its stream in
1193
1248
  // the in-order release gate. Each entry owns its handle; the callback
1194
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
+ */
1195
1254
  this.#pendingWorkerCleanupBounds = /* @__PURE__ */ new Map();
1196
1255
  // Source symbol count per track-scoped block — marks complete when K symbols arrive.
1197
1256
  this.#blockSourceCounts = /* @__PURE__ */ new Map();
@@ -1208,10 +1267,14 @@ var FECManager = class _FECManager {
1208
1267
  // SSB_length source arrivals and recoverable from SSB_length received
1209
1268
  // symbols; waiting for K fails every one of them.
1210
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();
1211
1273
  this.#ssbLengthConflictCount = 0;
1212
1274
  this.#blockRepairRsIds = /* @__PURE__ */ new Map();
1213
1275
  // RSB_length per block (C.5.3 Repair FEC Payload ID): how many repair
1214
- // symbols its repair group carries. Same lifecycle as #blockRepairRsIds.
1276
+ // symbols its repair group carries; 0 for a repair-less span no repair can
1277
+ // state (#openIsoSpan). Same lifecycle as #blockRepairRsIds.
1215
1278
  this.#blockRsbLengths = /* @__PURE__ */ new Map();
1216
1279
  /** fec-01 6.3.9 anchor state per stream key, one entry per held layer. */
1217
1280
  this.#heldLayerStates = /* @__PURE__ */ new Map();
@@ -1405,7 +1468,10 @@ var FECManager = class _FECManager {
1405
1468
  // arrives via onBlockRecovered callback.
1406
1469
  this.onBlockStarted = null;
1407
1470
  this.onBlockComplete = null;
1408
- /** A block reached its fail bound. `blockClass` is its class at failure. */
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
+ */
1409
1475
  this.onBlockFailed = null;
1410
1476
  /**
1411
1477
  * Fired once per stream when its Worker decoder stops being routable.
@@ -1447,12 +1513,24 @@ var FECManager = class _FECManager {
1447
1513
  * for it, which it must be.
1448
1514
  */
1449
1515
  this.#onUndelimitedLoss = null;
1516
+ /** Set with the loss handler: true takes an expired hole to close (`closeIsoHoles`). */
1517
+ this.#onIsoHoleExpired = null;
1450
1518
  /** A block every symbol of which vanished was created by SBN evidence. */
1451
1519
  this.onBlockVanished = null;
1452
1520
  /** A block reached a terminal state (completed, recovered, or failed). */
1453
1521
  this.onBlockResolved = null;
1454
1522
  /** A stream's SBN went backwards (or jumped implausibly): the source restarted. */
1455
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;
1456
1534
  // Worker-path callbacks — async recovery and stats from FecWorkerClient.
1457
1535
  /**
1458
1536
  * A recovered source symbol. Return false when admission refused the
@@ -1491,6 +1569,7 @@ var FECManager = class _FECManager {
1491
1569
  #blockSourceEsis;
1492
1570
  #blockRebuiltEsis;
1493
1571
  #blockAuthoredLengths;
1572
+ #isoSpanKeys;
1494
1573
  #ssbLengthConflictCount;
1495
1574
  #blockRepairRsIds;
1496
1575
  #blockRsbLengths;
@@ -1557,6 +1636,7 @@ var FECManager = class _FECManager {
1557
1636
  #decoderUnavailableEvents;
1558
1637
  #repairSymbolSizeMismatchCount;
1559
1638
  #onUndelimitedLoss;
1639
+ #onIsoHoleExpired;
1560
1640
  #encodeTrackName(catalogTrackName) {
1561
1641
  let encoded = this.#encodedTrackNames.get(catalogTrackName);
1562
1642
  if (encoded === void 0) {
@@ -2028,7 +2108,10 @@ var FECManager = class _FECManager {
2028
2108
  timer.handle = null;
2029
2109
  this.#requestRepair(sbn, packetId, catalogTrackName);
2030
2110
  };
2031
- timer.handle = setTimeout(onFire, Math.max(0, deadlineMs - performance.now()));
2111
+ timer.handle = setTimeout(
2112
+ onFire,
2113
+ this.#receiptAtMs === void 0 ? Math.max(0, deadlineMs - performance.now()) : this.#receiptTimerDelayMs(deadlineMs, 0)
2114
+ );
2032
2115
  this.#repairDeadlines.set(key, timer);
2033
2116
  }
2034
2117
  #requestRepair(sbn, packetId, catalogTrackName, settledByOrder = false) {
@@ -2172,8 +2255,14 @@ var FECManager = class _FECManager {
2172
2255
  * Vanished blocks are not enumerated here: their starts are unknown until a
2173
2256
  * repair states them. The SS_IDs between two stated blocks become one
2174
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).
2175
2264
  */
2176
- #noteSbnSeen(sbn, packetId, catalogTrackName, symbol, packetSequenceNumber, ssId = sbn) {
2265
+ #noteSbnSeen(sbn, packetId, catalogTrackName, symbol, packetSequenceNumber, ssId = sbn, held = false) {
2177
2266
  const streamKey = this.#streamKey(packetId, catalogTrackName);
2178
2267
  const now = performance.now();
2179
2268
  const previous = (symbol === "source" ? this.#sourceFrontiers : this.#highestSbn).get(streamKey);
@@ -2212,7 +2301,7 @@ var FECManager = class _FECManager {
2212
2301
  return sent <= 2147483647 && serial32Distance(from.ssId, to.ssId) <= sent + config.k;
2213
2302
  };
2214
2303
  if (!this.#blockPrecedes(previous.sbn, sbn)) {
2215
- 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))) {
2216
2305
  discontinuity();
2217
2306
  return;
2218
2307
  }
@@ -2474,17 +2563,21 @@ var FECManager = class _FECManager {
2474
2563
  this.#blockWaitDeadlinesMs.delete(key);
2475
2564
  this.#repairHoldUntilMs.delete(key);
2476
2565
  this.#traceLifecycle("timeout-queued", sbn, packetId, catalogTrackName);
2477
- this.#finalizeExpiredBlock(sbn, packetId, catalogTrackName);
2566
+ this.#finalizeExpiredBlock(sbn, packetId, catalogTrackName, currentDeadlineMs ?? firedAtMs);
2478
2567
  };
2479
- timer.handle = setTimeout(onFire, Math.max(1, Math.ceil(deadlineMs - nowMs)));
2568
+ timer.handle = setTimeout(
2569
+ onFire,
2570
+ this.#receiptAtMs === void 0 ? Math.max(1, Math.ceil(deadlineMs - nowMs)) : this.#receiptTimerDelayMs(deadlineMs, 1)
2571
+ );
2480
2572
  this.#activeBlocks.set(key, timer);
2481
2573
  this.#indexBlockKey(key, sbn, packetId);
2482
2574
  }
2483
2575
  /**
2484
2576
  * Hand a block whose delivery is over to its decoder for finalization: the
2485
- * 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.
2486
2579
  */
2487
- #finalizeExpiredBlock(sbn, packetId, catalogTrackName) {
2580
+ #finalizeExpiredBlock(sbn, packetId, catalogTrackName, dueAtMs = performance.now()) {
2488
2581
  const key = this.#blockKey(sbn, packetId, catalogTrackName);
2489
2582
  if (this.#materializedBlocks.has(key) && !this.#blockPathCounts.has(key)) {
2490
2583
  this.#failBlock(sbn, packetId, catalogTrackName);
@@ -2500,7 +2593,7 @@ var FECManager = class _FECManager {
2500
2593
  if (workerClient) {
2501
2594
  this.#pendingWorkerCleanups.add(key);
2502
2595
  this.#pendingWorkerCleanupClients.set(key, workerClient);
2503
- this.#boundOwedCleanup(key, packetId, workerClient);
2596
+ this.#boundOwedCleanup(key, packetId, workerClient, dueAtMs);
2504
2597
  workerClient.cleanup(sbn);
2505
2598
  } else {
2506
2599
  const decoder = this.#decoderForPacket(packetId, catalogTrackName)?.client;
@@ -2814,6 +2907,7 @@ var FECManager = class _FECManager {
2814
2907
  resetMap(this.#blockSourceEsis);
2815
2908
  resetMap(this.#blockRebuiltEsis);
2816
2909
  resetMap(this.#blockAuthoredLengths);
2910
+ resetSet(this.#isoSpanKeys);
2817
2911
  resetMap(this.#blockRepairRsIds);
2818
2912
  resetMap(this.#blockRsbLengths);
2819
2913
  resetMap(this.#heldLayerStates);
@@ -2939,6 +3033,7 @@ var FECManager = class _FECManager {
2939
3033
  dropMap(this.#blockSourceEsis);
2940
3034
  dropMap(this.#blockRebuiltEsis);
2941
3035
  dropMap(this.#blockAuthoredLengths);
3036
+ dropSet(this.#isoSpanKeys);
2942
3037
  dropMap(this.#blockRepairRsIds);
2943
3038
  dropMap(this.#blockRsbLengths);
2944
3039
  dropMap(this.#blockPathCounts);
@@ -3212,8 +3307,10 @@ var FECManager = class _FECManager {
3212
3307
  }
3213
3308
  /**
3214
3309
  * An open block's accepted sources, distinct repair RS_IDs, authored K'
3215
- * (SSB_length) and RSB_length (each undefined until a repair stated it).
3216
- * Undefined for a block that is not open.
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.
3217
3314
  */
3218
3315
  blockSymbolCounts(sbn, packetId, catalogTrackName) {
3219
3316
  const key = this.#blockKey(sbn, packetId, catalogTrackName);
@@ -3281,8 +3378,9 @@ var FECManager = class _FECManager {
3281
3378
  return true;
3282
3379
  }
3283
3380
  /**
3284
- * Drop a block's repair hold: its FETCH ended without delivering. The block
3285
- * falls back to its multicast wait, which may already have passed.
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.
3286
3384
  */
3287
3385
  releaseRepairHold(sbn, packetId, catalogTrackName) {
3288
3386
  const key = this.#blockKey(sbn, packetId, catalogTrackName);
@@ -3420,6 +3518,7 @@ var FECManager = class _FECManager {
3420
3518
  const locator = this.#growingIsoLocatorFor(packetId, catalogTrackName);
3421
3519
  const evictedBefore = locator.heldEvicted;
3422
3520
  const held = locator.hold(ssId, source);
3521
+ this.#settleExpiredIsoHoles(locator, packetId, catalogTrackName);
3423
3522
  if (held && source.source === "multicast") this.#noteMulticastSource(locator, ssId, packetId, catalogTrackName);
3424
3523
  const evicted = locator.heldEvicted - evictedBefore;
3425
3524
  if (evicted > 0) {
@@ -3441,17 +3540,20 @@ var FECManager = class _FECManager {
3441
3540
  * contradicts a known block is refused (counted) and must be dropped.
3442
3541
  */
3443
3542
  placeIsoRepair(packetId, catalogTrackName, ssStart, ssbLength) {
3444
- const placement = this.#growingIsoLocatorFor(packetId, catalogTrackName).placeRepair(ssStart, ssbLength);
3543
+ const locator = this.#growingIsoLocatorFor(packetId, catalogTrackName);
3544
+ const placement = locator.placeRepair(ssStart, ssbLength);
3545
+ this.#settleExpiredIsoHoles(locator, packetId, catalogTrackName);
3445
3546
  if (placement.status !== "placed") {
3446
3547
  this.#isoRepairRefusedCount++;
3447
3548
  if (this.#isoRepairRefusedCount <= 5 || this.#isoRepairRefusedCount % 100 === 0) {
3448
3549
  console.warn(`[FECManager] packetId=${packetId} iso-ssbg1-v1 repair refused (${placement.status}): ${placement.reason}`);
3449
3550
  }
3551
+ if (placement.ofSpan !== void 0) this.releaseRepairHold(placement.ofSpan.start, packetId, catalogTrackName);
3450
3552
  return placement;
3451
3553
  }
3554
+ this.#isoSpanKeys.delete(this.#blockKey(placement.block.start, packetId, catalogTrackName));
3452
3555
  if (placement.span !== void 0) this.#openIsoSpan(placement.span, packetId, catalogTrackName);
3453
3556
  if (placement.hole !== void 0) {
3454
- const locator = this.#isoLocatorFor(packetId, catalogTrackName);
3455
3557
  const hole = placement.hole.block;
3456
3558
  const previous = locator.blockEndingAt(hole.start);
3457
3559
  const loss = {
@@ -3472,17 +3574,29 @@ var FECManager = class _FECManager {
3472
3574
  * `handler`, instead of a repair-less span; null restores spans. Set by the
3473
3575
  * range repair scheduler; applies to every stream from its next gap. The
3474
3576
  * handler and the deferral are one setting, so no hole is ever created with
3475
- * 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.
3476
3581
  */
3477
- setUndelimitedLossHandler(handler) {
3582
+ setUndelimitedLossHandler(handler, onExpired = null) {
3478
3583
  this.#onUndelimitedLoss = handler;
3584
+ this.#onIsoHoleExpired = handler === null ? null : onExpired;
3479
3585
  this.#deferIsoGaps = handler !== null;
3480
3586
  for (const locator of this.#isoLocators.values()) locator.deferIncompleteGaps = this.#deferIsoGaps;
3481
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
+ }
3482
3595
  /**
3483
- * The range repair for a hole ended: every hole still pending inside
3484
- * `[start, start + length)` becomes a repair-less span. Returns those spans
3485
- * with the held sources they placed, for the caller to feed (MmtpRouter).
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).
3486
3600
  */
3487
3601
  closeIsoHoles(packetId, catalogTrackName, start, length) {
3488
3602
  const locator = this.#isoLocators.get(this.#streamKey(packetId, catalogTrackName));
@@ -3498,10 +3612,25 @@ var FECManager = class _FECManager {
3498
3612
  * its placed sources exactly as on the wire (feedRepairSymbol). A span every
3499
3613
  * SS_ID of which vanished resolves through its deadline like any vanished
3500
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).
3501
3626
  */
3502
3627
  #openIsoSpan(span, packetId, catalogTrackName) {
3503
3628
  const key = this.#blockKey(span.block.start, packetId, catalogTrackName);
3504
- if (!this.#blockAuthoredLengths.has(key)) this.#blockAuthoredLengths.set(key, span.block.length);
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
+ }
3505
3634
  if (span.placed.length === 0) this.#materializeBlock(span.block.start, packetId, catalogTrackName, true);
3506
3635
  }
3507
3636
  /**
@@ -3539,6 +3668,50 @@ var FECManager = class _FECManager {
3539
3668
  }
3540
3669
  return lost;
3541
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), and a multicast source at or
3677
+ * past `toSsId` arrived, so each is lost or reordered behind it (a MoQ
3678
+ * source shows nothing: MoQ streams overtake one another). The span itself
3679
+ * keeps its whole wait.
3680
+ *
3681
+ * The wait is the late-symbol allowance, unless `rapMayHide`: the gap may
3682
+ * hold a RAP packet an installed keyframe overlay can still rebuild (its
3683
+ * decision stalls, or it ends at a RAP that may lie past a whole MPU).
3684
+ * Then the frame waits as a stated block its group cannot complete does
3685
+ * (#overlayLateWaitMs): the allowance alone with no overlay installed, the
3686
+ * overlay's span plus the larger of the allowance and its tolerance, or,
3687
+ * for an overlay that states no span, the span's whole wait (undefined).
3688
+ */
3689
+ isoRepairlessWaitMs(packetId, catalogTrackName, fromSsId, toSsId, rapMayHide = false) {
3690
+ const config = this.#trackConfigs.get(packetId);
3691
+ if (config === void 0 || !_FECManager.#hasCatalogTiming(config)) return void 0;
3692
+ const locator = this.#isoLocators.get(this.#streamKey(packetId, catalogTrackName));
3693
+ if (locator === void 0 || !locator.coversBetween(fromSsId, toSsId)) return void 0;
3694
+ const newestSource = locator.newestSource;
3695
+ if (newestSource === void 0 || serial32Precedes(newestSource, toSsId)) return void 0;
3696
+ let repairless = false;
3697
+ for (const block of locator.blocksBetween(fromSsId, toSsId)) {
3698
+ const key = this.#blockKey(block.start, packetId, catalogTrackName);
3699
+ if (this.#completedBlocks.has(key)) continue;
3700
+ if (block.span && block.length > locator.kMax) {
3701
+ repairless = true;
3702
+ continue;
3703
+ }
3704
+ const received = this.#blockSourceEsis.get(key);
3705
+ for (let esi = 0; esi < block.length; esi++) {
3706
+ const ssId = serial32Add(block.start, esi);
3707
+ if (!serial32Precedes(fromSsId, ssId) || !serial32Precedes(ssId, toSsId)) continue;
3708
+ if (!received?.has(esi) && !locator.isHeld(ssId)) return void 0;
3709
+ }
3710
+ }
3711
+ if (!repairless) return void 0;
3712
+ const waitMs = rapMayHide ? this.#overlayLateWaitMs(packetId, catalogTrackName, config) : this.#multicastWaitMs(config) - config.interleaveDepthMs;
3713
+ return waitMs === void 0 ? void 0 : Math.max(0, waitMs);
3714
+ }
3542
3715
  /**
3543
3716
  * iso-ssbg1-v1 block location: repair symbols it refused, oversize sources,
3544
3717
  * the sources held now for a block no repair has stated yet, and the held
@@ -3842,11 +4015,14 @@ var FECManager = class _FECManager {
3842
4015
  });
3843
4016
  client.onCleanupComplete((sbn) => {
3844
4017
  if (this.#releasedWorkerClients.has(client)) return;
3845
- const cleanupKeys = [...this.#pendingWorkerCleanups].filter((key) => {
4018
+ const owed = [...this.#pendingWorkerCleanups].filter((key) => this.#pendingWorkerCleanupClients.get(key) === client);
4019
+ const cleanupKeys = owed.filter((key) => {
3846
4020
  const block = this.#parseBlockKey(key);
3847
- return block.packetId === packetId && block.sbn === sbn && this.#pendingWorkerCleanupClients.get(key) === client;
4021
+ return block.packetId === packetId && block.sbn === sbn;
3848
4022
  });
3849
- for (const key of cleanupKeys) this.#settleOwedCleanup(key, "cleanup-ack");
4023
+ const askedAtMs = Math.max(...cleanupKeys.map((key) => this.#pendingWorkerCleanupBounds.get(key)?.askedAtMs ?? -Infinity));
4024
+ const due = owed.filter((key) => !cleanupKeys.includes(key) && (this.#pendingWorkerCleanupBounds.get(key)?.dueAtMs ?? Infinity) <= askedAtMs);
4025
+ for (const key of [...cleanupKeys, ...due]) this.#settleOwedCleanup(key, "cleanup-ack");
3850
4026
  });
3851
4027
  client.onError((msg, code) => {
3852
4028
  const requestedKind = code ?? msg;
@@ -3916,9 +4092,11 @@ var FECManager = class _FECManager {
3916
4092
  * fail deadline already passed, so failing it is the decision that deadline
3917
4093
  * made. A late ack then finds nothing owed and is a no-op.
3918
4094
  */
3919
- #boundOwedCleanup(key, packetId, client) {
4095
+ #boundOwedCleanup(key, packetId, client, dueAtMs) {
3920
4096
  this.#clearOwedCleanupBound(key);
3921
4097
  const bound = {
4098
+ dueAtMs,
4099
+ askedAtMs: performance.now(),
3922
4100
  handle: setTimeout(() => {
3923
4101
  if (this.#pendingWorkerCleanupBounds.get(key) !== bound) return;
3924
4102
  this.#pendingWorkerCleanupBounds.delete(key);
@@ -4088,9 +4266,15 @@ var FECManager = class _FECManager {
4088
4266
  rebuilt = /* @__PURE__ */ new Set();
4089
4267
  this.#blockRebuiltEsis.set(key, rebuilt);
4090
4268
  }
4269
+ const config = this.#trackConfigs.get(packetId);
4270
+ const wasShort = config !== void 0 && this.#lateSourceWaitMs(key, sbn, packetId, catalogTrackName, config) !== void 0;
4091
4271
  rebuilt.add(located.esi);
4092
4272
  const recovered = this.#feedDecoderSource(packetId, ssId, symbolData, catalogTrackName, sbn);
4093
- if (recovered === null) this.#completeWhenSourcesPresent(key, sbn, located.block.length, packetId, catalogTrackName);
4273
+ if (recovered === null && !this.#completeWhenSourcesPresent(key, sbn, located.block.length, packetId, catalogTrackName)) {
4274
+ if (wasShort && this.#activeBlocks.has(key) && this.#lateSourceWaitMs(key, sbn, packetId, catalogTrackName, config) === void 0) {
4275
+ this.#armBlockTimeout(sbn, packetId, catalogTrackName, this.#multicastWaitMs(config));
4276
+ }
4277
+ }
4094
4278
  return { taken: true, recovered };
4095
4279
  }
4096
4280
  /**
@@ -4333,7 +4517,7 @@ var FECManager = class _FECManager {
4333
4517
  const previous = locator.newestSource;
4334
4518
  if (!locator.noteSource(ssId) || previous === void 0) return;
4335
4519
  for (const block of locator.blocksBetween(previous - 1 >>> 0, ssId)) {
4336
- if (block.span || !serial32Precedes(serial32Add(block.start, block.length - 1), ssId)) continue;
4520
+ if (!serial32Precedes(serial32Add(block.start, block.length - 1), ssId)) continue;
4337
4521
  this.#shortenUnrecoverableWait(
4338
4522
  this.#blockKey(block.start, packetId, catalogTrackName),
4339
4523
  block.start,
@@ -4351,18 +4535,54 @@ var FECManager = class _FECManager {
4351
4535
  * covers repair symbols paced after its sources, buys it nothing: it waits
4352
4536
  * the late-symbol allowance alone, the multicast wait less the span (the
4353
4537
  * catalog tolerance or the measured delivery gap). Undefined for any other
4354
- * block.
4538
+ * block. While a keyframe overlay is installed, the block waits for its
4539
+ * repair too (#overlayLateWaitMs). A repair-less span keeps its whole
4540
+ * wait, even one longer than K whose group is empty (#openIsoSpan): its
4541
+ * resolution is what releases the frames behind it, and failing it early
4542
+ * released them past a keyframe the overlay was still rebuilding, which
4543
+ * then arrived stale. The release gate lets them go instead
4544
+ * (isoRepairlessWaitMs).
4355
4545
  */
4356
4546
  #lateSourceWaitMs(key, sbn, packetId, catalogTrackName, config) {
4547
+ if (this.#isoSpanKeys.has(key)) return void 0;
4357
4548
  const authoredLength = this.#blockAuthoredLengths.get(key);
4358
4549
  const rsbLength = this.#blockRsbLengths.get(key);
4359
4550
  if (authoredLength === void 0 || rsbLength === void 0) return void 0;
4360
- if ((this.#blockSourceCounts.get(key) ?? 0) + rsbLength >= authoredLength) return void 0;
4551
+ let present = this.#blockSourceCounts.get(key) ?? 0;
4552
+ const received = this.#blockSourceEsis.get(key);
4553
+ for (const esi of this.#blockRebuiltEsis.get(key) ?? []) if (!received?.has(esi)) present++;
4554
+ if (present + rsbLength >= authoredLength) return void 0;
4361
4555
  const newestSource = this.#isoLocators.get(this.#streamKey(packetId, catalogTrackName))?.newestSource;
4362
4556
  if (newestSource === void 0 || !serial32Precedes(serial32Add(sbn, authoredLength - 1), newestSource)) {
4363
4557
  return void 0;
4364
4558
  }
4365
- return this.#multicastWaitMs(config) - config.interleaveDepthMs;
4559
+ return this.#overlayLateWaitMs(packetId, catalogTrackName, config);
4560
+ }
4561
+ /**
4562
+ * How long a loss only a late source or an installed keyframe overlay can
4563
+ * still fill waits once a later source passed it: the late-symbol
4564
+ * allowance alone (the multicast wait less the span) while no overlay is
4565
+ * installed. An installed one (keyframeOverlayTiming) may still rebuild a
4566
+ * RAP packet the loss took: a second FEC instance over the same packets
4567
+ * (draft-ramadan-moq-mmt-02 7.4), whose repair is paced across its own
4568
+ * span, unrelated to the base's. That packet can complete a stated block
4569
+ * (feedRebuiltSourceSymbol), or play behind a span; giving the loss up
4570
+ * first lets the release gate pass the keyframe, whose rebuild then lands
4571
+ * stale. The overlay repair of a packet the loss took goes out within the
4572
+ * overlay's span of that packet (fec-core-00 9.3), and the later source was
4573
+ * sent after it, so the loss waits that span plus the larger of the
4574
+ * allowance and the overlay's own tolerance. An overlay that states no
4575
+ * span (its block may then span keyframes), or one whose wait is not
4576
+ * shorter than the whole multicast wait, leaves the whole wait: undefined.
4577
+ */
4578
+ #overlayLateWaitMs(packetId, catalogTrackName, config) {
4579
+ const waitMs = this.#multicastWaitMs(config);
4580
+ const allowanceMs = waitMs - config.interleaveDepthMs;
4581
+ const overlay = this.keyframeOverlayTiming?.(packetId, catalogTrackName);
4582
+ if (overlay === void 0) return allowanceMs;
4583
+ const overlaySpanMs = overlay.interleaveDepthMs ?? 0;
4584
+ const overlayWaitMs = overlaySpanMs + Math.max(allowanceMs, overlay.reorderToleranceMs ?? 0);
4585
+ return overlaySpanMs > 0 && overlayWaitMs < waitMs ? overlayWaitMs : void 0;
4366
4586
  }
4367
4587
  /**
4368
4588
  * Bring an open block's wait in to its late-source wait, when it has one.
@@ -4480,12 +4700,13 @@ var FECManager = class _FECManager {
4480
4700
  * the inactivity deadline on each symbol, records the symbol's in-band
4481
4701
  * classification evidence, and marks the block clean when all of its
4482
4702
  * authored source symbols arrived: the SSB_length a repair symbol declared,
4483
- * otherwise K.
4703
+ * otherwise K. `held` marks a source held unplaced since it arrived and
4704
+ * placed only now (see #noteSbnSeen).
4484
4705
  *
4485
4706
  * Throws for a packetId that was never configured, so a classified block
4486
4707
  * never reads the manager-global K or timeout.
4487
4708
  */
4488
- trackBlock(sbn, packetId, catalogTrackName, esi, evidence) {
4709
+ trackBlock(sbn, packetId, catalogTrackName, esi, evidence, held = false) {
4489
4710
  const trackConfig = this.#trackConfigs.get(packetId);
4490
4711
  if (trackConfig === void 0) {
4491
4712
  throw new Error(
@@ -4501,7 +4722,8 @@ var FECManager = class _FECManager {
4501
4722
  catalogTrackName,
4502
4723
  "source",
4503
4724
  evidence.packetSequenceNumber,
4504
- Number.isInteger(esi) ? sbn + esi >>> 0 : sbn
4725
+ Number.isInteger(esi) ? sbn + esi >>> 0 : sbn,
4726
+ held
4505
4727
  );
4506
4728
  const authoredLength = this.#blockAuthoredLengths.get(key) ?? k;
4507
4729
  if (Number.isInteger(esi) && esi >= authoredLength) {
@@ -4556,6 +4778,7 @@ var FECManager = class _FECManager {
4556
4778
  this.#blockSourceEsis.delete(key);
4557
4779
  this.#blockRebuiltEsis.delete(key);
4558
4780
  this.#blockAuthoredLengths.delete(key);
4781
+ this.#isoSpanKeys.delete(key);
4559
4782
  this.#blockRepairRsIds.delete(key);
4560
4783
  this.#blockRsbLengths.delete(key);
4561
4784
  this.#markTerminal(key, sbn, packetId, true);
@@ -4586,6 +4809,19 @@ var FECManager = class _FECManager {
4586
4809
  #receiptNow() {
4587
4810
  return this.#receiptAtMs ?? performance.now();
4588
4811
  }
4812
+ /**
4813
+ * The whole-ms delay of a timer for `deadlineMs` armed inside a receipt
4814
+ * scope: counted from the receipt time, as the timer of a symbol fed when
4815
+ * it was received was, less the whole ms since. So it fires on the tick
4816
+ * that timer would have, never later than a delay counted from now, and
4817
+ * its handler still re-arms a timer that fires before its deadline.
4818
+ * Counted from now, a deadline set from the receipt time is rounded up
4819
+ * from another fraction of a ms (BLO-52085).
4820
+ */
4821
+ #receiptTimerDelayMs(deadlineMs, minMs) {
4822
+ const receivedAtMs = this.#receiptAtMs;
4823
+ return Math.max(minMs, Math.ceil(deadlineMs - receivedAtMs) - Math.ceil(performance.now() - receivedAtMs));
4824
+ }
4589
4825
  /**
4590
4826
  * A held packet admitted late arms from its (earlier) receipt time; that
4591
4827
  * never pulls in a deadline later activity already armed. Outside a
@@ -4634,6 +4870,7 @@ var FECManager = class _FECManager {
4634
4870
  }
4635
4871
  #failBlock(sbn, packetId, catalogTrackName) {
4636
4872
  const key = this.#blockKey(sbn, packetId, catalogTrackName);
4873
+ const span = this.#isoSpanKeys.delete(key) ? { length: this.#blockAuthoredLengths.get(key) ?? 0, sources: this.#blockSourceCounts.get(key) ?? 0 } : void 0;
4637
4874
  this.#traceLifecycle("failed", sbn, packetId, catalogTrackName);
4638
4875
  this.#clearRepairDeadline(key);
4639
4876
  this.#clearBlockTimer(key);
@@ -4653,7 +4890,8 @@ var FECManager = class _FECManager {
4653
4890
  this.#markPathBlockComplete(sbn, packetId, catalogTrackName);
4654
4891
  this.#fecStats.blocksFailed++;
4655
4892
  this.#statsForPacket(packetId).blocksFailed++;
4656
- this.onBlockFailed?.(sbn, packetId, catalogTrackName, blockClass);
4893
+ if (span === void 0) this.onBlockFailed?.(sbn, packetId, catalogTrackName, blockClass);
4894
+ else this.onBlockFailed?.(sbn, packetId, catalogTrackName, blockClass, span);
4657
4895
  this.onBlockResolved?.(sbn, packetId, catalogTrackName);
4658
4896
  }
4659
4897
  /**
@@ -4684,6 +4922,7 @@ var FECManager = class _FECManager {
4684
4922
  this.#blockSourceEsis.delete(key);
4685
4923
  this.#blockRebuiltEsis.delete(key);
4686
4924
  this.#blockAuthoredLengths.delete(key);
4925
+ this.#isoSpanKeys.delete(key);
4687
4926
  this.#blockRepairRsIds.delete(key);
4688
4927
  this.#blockRsbLengths.delete(key);
4689
4928
  this.#clearBlockTimer(key);
@@ -4776,6 +5015,7 @@ var FECManager = class _FECManager {
4776
5015
  this.#blockSourceEsis.clear();
4777
5016
  this.#blockRebuiltEsis.clear();
4778
5017
  this.#blockAuthoredLengths.clear();
5018
+ this.#isoSpanKeys.clear();
4779
5019
  this.#blockRepairRsIds.clear();
4780
5020
  this.#blockRsbLengths.clear();
4781
5021
  this.#heldLayerStates.clear();