@blockcast/mmt-container 2.2.0-main.efb4fa4521af → 2.2.0-main.fb5c7dfbe2de

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 (82) hide show
  1. package/README.md +29 -17
  2. package/dist/browser-runtime.js +1336 -302
  3. package/dist/browser-runtime.js.map +3 -3
  4. package/dist/catalog-fec-params.d.ts +17 -1
  5. package/dist/catalog-fec-params.d.ts.map +1 -1
  6. package/dist/catalog-fec-params.js +15 -0
  7. package/dist/catalog-fec-params.js.map +2 -2
  8. package/dist/cmcd-producer.d.ts +60 -47
  9. package/dist/cmcd-producer.d.ts.map +1 -1
  10. package/dist/cmcd-producer.js +138 -109
  11. package/dist/cmcd-producer.js.map +2 -2
  12. package/dist/delivery-catalog.js +26 -16
  13. package/dist/delivery-catalog.js.map +2 -2
  14. package/dist/delta-fallback-config.js.map +1 -1
  15. package/dist/fec-manager.d.ts +70 -12
  16. package/dist/fec-manager.d.ts.map +1 -1
  17. package/dist/fec-manager.js +403 -58
  18. package/dist/fec-manager.js.map +2 -2
  19. package/dist/fec-worker-setup.d.ts +1 -1
  20. package/dist/fec-worker-setup.js +1 -1
  21. package/dist/fec-worker-setup.js.map +1 -1
  22. package/dist/index.d.ts +4 -4
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +5 -1
  25. package/dist/index.js.map +2 -2
  26. package/dist/iso-block-locator.d.ts +48 -13
  27. package/dist/iso-block-locator.d.ts.map +1 -1
  28. package/dist/iso-block-locator.js +97 -25
  29. package/dist/iso-block-locator.js.map +2 -2
  30. package/dist/iso-bmff-timing.d.ts +10 -1
  31. package/dist/iso-bmff-timing.d.ts.map +1 -1
  32. package/dist/iso-bmff-timing.js +36 -2
  33. package/dist/iso-bmff-timing.js.map +2 -2
  34. package/dist/media-router.js.map +1 -1
  35. package/dist/mmtp-container-parser.d.ts +79 -10
  36. package/dist/mmtp-container-parser.d.ts.map +1 -1
  37. package/dist/mmtp-container-parser.js +207 -26
  38. package/dist/mmtp-container-parser.js.map +2 -2
  39. package/dist/mmtp-container-parser.no-modules.js +209 -29
  40. package/dist/mmtp-container-parser.no-modules.js.map +2 -2
  41. package/dist/mmtp-decode-pipeline.js +206 -26
  42. package/dist/mmtp-decode-pipeline.js.map +2 -2
  43. package/dist/mmtp-router.d.ts +34 -8
  44. package/dist/mmtp-router.d.ts.map +1 -1
  45. package/dist/mmtp-router.js +555 -79
  46. package/dist/mmtp-router.js.map +2 -2
  47. package/dist/multicast-manager.d.ts +13 -3
  48. package/dist/multicast-manager.d.ts.map +1 -1
  49. package/dist/multicast-manager.js +980 -146
  50. package/dist/multicast-manager.js.map +2 -2
  51. package/dist/multicast-transport.js +28 -18
  52. package/dist/multicast-transport.js.map +2 -2
  53. package/dist/no-modules.js +206 -26
  54. package/dist/no-modules.js.map +2 -2
  55. package/dist/repair-fetch.d.ts +36 -8
  56. package/dist/repair-fetch.d.ts.map +1 -1
  57. package/dist/repair-fetch.js +285 -26
  58. package/dist/repair-fetch.js.map +3 -3
  59. package/dist/repair-layer-subscriptions.d.ts +6 -2
  60. package/dist/repair-layer-subscriptions.d.ts.map +1 -1
  61. package/dist/repair-layer-subscriptions.js +6 -3
  62. package/dist/repair-layer-subscriptions.js.map +2 -2
  63. package/dist/track-session.d.ts +1 -1
  64. package/dist/track-session.d.ts.map +1 -1
  65. package/dist/track-session.js +1 -0
  66. package/dist/track-session.js.map +2 -2
  67. package/dist/wasm-mmtp-container-parser.js +206 -26
  68. package/dist/wasm-mmtp-container-parser.js.map +2 -2
  69. package/package.json +8 -5
  70. package/src/catalog-fec-params.ts +36 -1
  71. package/src/cmcd-producer.ts +189 -179
  72. package/src/fec-manager.ts +433 -32
  73. package/src/fec-worker-setup.ts +2 -2
  74. package/src/index.ts +9 -2
  75. package/src/iso-block-locator.ts +133 -31
  76. package/src/iso-bmff-timing.ts +40 -1
  77. package/src/mmtp-container-parser.ts +306 -29
  78. package/src/mmtp-router.ts +548 -38
  79. package/src/multicast-manager.ts +44 -6
  80. package/src/repair-fetch.ts +363 -49
  81. package/src/repair-layer-subscriptions.ts +13 -5
  82. package/src/track-session.ts +4 -1
@@ -18,8 +18,10 @@ import {
18
18
  type FecFallbackDecoder,
19
19
  type MulticastSymbolDelivery,
20
20
  type RepairVia,
21
+ type ExpiredIsoHole,
21
22
  type UndelimitedIsoLoss,
22
23
  type FecFailClosedEvent,
24
+ type IsoSpanFailure,
23
25
  } from "./fec-manager.js";
24
26
  import {
25
27
  deriveBlockClassifierGeometry,
@@ -407,6 +409,14 @@ export type RepairLifecycleEvent =
407
409
  readonly block: RepairBlockIdentity;
408
410
  readonly blockClass: BlockClass;
409
411
  readonly symbols: RepairSymbolCounts;
412
+ /**
413
+ * Set when what failed is an iso-ssbg1-v1 repair-less span starting at
414
+ * `block.sbn`: `length` SS_IDs between two stated blocks, `sources` of
415
+ * them received. No repair stated the blocks inside it, so the receiver
416
+ * cannot tell which of them lost a source; it is not the failure of the
417
+ * block at `block.sbn` alone.
418
+ */
419
+ readonly span?: IsoSpanFailure;
410
420
  }
411
421
  | {
412
422
  readonly version: 2;
@@ -791,6 +801,19 @@ function isSymbolCounts(value: unknown): boolean {
791
801
  );
792
802
  }
793
803
 
804
+ /** A failed repair-less span: `sources` of its `length` SS_IDs arrived, never all. */
805
+ function isSpanFailure(value: unknown): boolean {
806
+ if (!isRecord(value) || !hasExactKeys(value, ["length", "sources"])) return false;
807
+ const length = value["length"];
808
+ const sources = value["sources"];
809
+ return (
810
+ Number.isSafeInteger(length) &&
811
+ (length as number) > 0 &&
812
+ isNonNegativeSafeInteger(sources) &&
813
+ (sources as number) < (length as number)
814
+ );
815
+ }
816
+
794
817
  function isNullableNonNegative(value: unknown): boolean {
795
818
  return value === null || (typeof value === "number" && Number.isFinite(value) && value >= 0);
796
819
  }
@@ -833,10 +856,16 @@ export function isRepairLifecycleEvent(
833
856
  );
834
857
  case "failed":
835
858
  return (
836
- hasExactKeys(value, ["version", "type", "block", "blockClass", "symbols"]) &&
859
+ hasExactKeys(
860
+ value,
861
+ "span" in value
862
+ ? ["version", "type", "block", "blockClass", "symbols", "span"]
863
+ : ["version", "type", "block", "blockClass", "symbols"],
864
+ ) &&
837
865
  isRepairBlockIdentity(block) &&
838
866
  BLOCK_CLASSES.has(value["blockClass"]) &&
839
- isSymbolCounts(value["symbols"])
867
+ isSymbolCounts(value["symbols"]) &&
868
+ (!("span" in value) || isSpanFailure(value["span"]))
840
869
  );
841
870
  case "repair-preempted":
842
871
  case "repair-deferred":
@@ -1366,7 +1395,7 @@ export class MulticastManager {
1366
1395
  onPublisherRestart: (packetId, catalogTrackName) => {
1367
1396
  this.#resetStreamOutsideRouter(packetId, catalogTrackName);
1368
1397
  },
1369
- onBlockFailed: (sbn, packetId, catalogTrackName, blockClass) => {
1398
+ onBlockFailed: (sbn, packetId, catalogTrackName, blockClass, span) => {
1370
1399
  const pathCount = this.#fec.blockPathCount(
1371
1400
  sbn,
1372
1401
  packetId,
@@ -1385,6 +1414,7 @@ export class MulticastManager {
1385
1414
  multicast: pathCount?.multicastSymbols ?? 0,
1386
1415
  moq: pathCount?.moqSymbols ?? 0,
1387
1416
  },
1417
+ ...(span === undefined ? {} : { span }),
1388
1418
  });
1389
1419
  },
1390
1420
  onFrameGap: (decision) => {
@@ -3193,10 +3223,15 @@ export class MulticastManager {
3193
3223
  * Register the range repair scheduler (draft-ramadan-moq-fec §7.5): from now
3194
3224
  * on an iso-ssbg1-v1 gap missing a source and every repair is kept as a
3195
3225
  * pending hole and reported here, and `closeIsoHoles` must be called for it
3196
- * once its range FETCH ends (or none is sent).
3226
+ * once its range FETCH ends (or none is sent). `onExpired` is told of a
3227
+ * pending hole the stream runs past the locator's horizon: returning true,
3228
+ * the caller closes it (`closeIsoHoles`); otherwise it is discarded.
3197
3229
  */
3198
- onUndelimitedLoss(cb: (loss: UndelimitedIsoLoss) => void): void {
3199
- this.#fec.setUndelimitedLossHandler(cb);
3230
+ onUndelimitedLoss(
3231
+ cb: (loss: UndelimitedIsoLoss) => void,
3232
+ onExpired?: (hole: ExpiredIsoHole) => boolean,
3233
+ ): void {
3234
+ this.#fec.setUndelimitedLossHandler(cb, onExpired ?? null);
3200
3235
  }
3201
3236
 
3202
3237
  /**
@@ -3515,6 +3550,9 @@ export class MulticastManager {
3515
3550
  ...("symbols" in event
3516
3551
  ? { symbols: Object.freeze({ ...event.symbols }) }
3517
3552
  : {}),
3553
+ ...("span" in event && event.span !== undefined
3554
+ ? { span: Object.freeze({ ...event.span }) }
3555
+ : {}),
3518
3556
  },
3519
3557
  ) as RepairLifecycleEvent);
3520
3558
  // Serialize before invoking observers so a re-entrant observer cannot log