@blockcast/mmt-container 0.4.0-main.bbd83cb48eff → 0.4.0-main.c9b538a2feb5

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 (130) hide show
  1. package/README.md +25 -12
  2. package/dist/browser-runtime.js +710 -253
  3. package/dist/browser-runtime.js.map +4 -4
  4. package/dist/carp-catalog.d.ts +51 -22
  5. package/dist/carp-catalog.d.ts.map +1 -1
  6. package/dist/carp-catalog.js +240 -191
  7. package/dist/carp-catalog.js.map +3 -3
  8. package/dist/catalog-fec-params.d.ts +1 -1
  9. package/dist/catalog-fec-params.d.ts.map +1 -1
  10. package/dist/catalog-fec-params.js +6 -13
  11. package/dist/catalog-fec-params.js.map +3 -3
  12. package/dist/catalog-network-source.js.map +1 -1
  13. package/dist/catalog-validator.d.ts +4 -3
  14. package/dist/catalog-validator.d.ts.map +1 -1
  15. package/dist/catalog-validator.js +0 -29
  16. package/dist/catalog-validator.js.map +3 -3
  17. package/dist/delivery-catalog.js +4 -12
  18. package/dist/delivery-catalog.js.map +4 -4
  19. package/dist/fec-manager.js.map +1 -1
  20. package/dist/fec-state.d.ts.map +1 -1
  21. package/dist/fec-state.js +14 -2
  22. package/dist/fec-state.js.map +3 -3
  23. package/dist/fec-worker-setup.js.map +1 -1
  24. package/dist/index.d.ts +2 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +4 -0
  27. package/dist/index.js.map +2 -2
  28. package/dist/iso-block-locator.js.map +1 -1
  29. package/dist/manifest-auth-plan.d.ts +26 -25
  30. package/dist/manifest-auth-plan.d.ts.map +1 -1
  31. package/dist/manifest-auth-plan.js +311 -1163
  32. package/dist/manifest-auth-plan.js.map +4 -4
  33. package/dist/mfu-reassembler.js.map +2 -2
  34. package/dist/mmtp-container-parser.js.map +2 -2
  35. package/dist/mmtp-container-parser.no-modules.js +917 -275
  36. package/dist/mmtp-container-parser.no-modules.js.map +4 -4
  37. package/dist/mmtp-decode-pipeline.js.map +2 -2
  38. package/dist/mmtp-fec-session.d.ts +156 -0
  39. package/dist/mmtp-fec-session.d.ts.map +1 -0
  40. package/dist/mmtp-fec-session.js +522 -0
  41. package/dist/mmtp-fec-session.js.map +7 -0
  42. package/dist/mmtp-router.d.ts.map +1 -1
  43. package/dist/mmtp-router.js +17 -0
  44. package/dist/mmtp-router.js.map +2 -2
  45. package/dist/multicast-auth-catalog.d.ts +86 -92
  46. package/dist/multicast-auth-catalog.d.ts.map +1 -1
  47. package/dist/multicast-auth-catalog.js +327 -124
  48. package/dist/multicast-auth-catalog.js.map +3 -3
  49. package/dist/multicast-input.d.ts +25 -3
  50. package/dist/multicast-input.d.ts.map +1 -1
  51. package/dist/multicast-input.js +266 -13
  52. package/dist/multicast-input.js.map +3 -3
  53. package/dist/multicast-manager.d.ts +23 -4
  54. package/dist/multicast-manager.d.ts.map +1 -1
  55. package/dist/multicast-manager.js +59 -29
  56. package/dist/multicast-manager.js.map +4 -4
  57. package/dist/multicast-transport.js +2 -10
  58. package/dist/multicast-transport.js.map +4 -4
  59. package/dist/multicast-unwrap.js.map +2 -2
  60. package/dist/no-modules.d.ts +2 -0
  61. package/dist/no-modules.d.ts.map +1 -1
  62. package/dist/no-modules.js +869 -264
  63. package/dist/no-modules.js.map +4 -4
  64. package/dist/repair-fetch.d.ts +23 -1
  65. package/dist/repair-fetch.d.ts.map +1 -1
  66. package/dist/repair-fetch.js +35 -10
  67. package/dist/repair-fetch.js.map +2 -2
  68. package/dist/repair-layers.js.map +1 -1
  69. package/dist/signaling.d.ts +2 -2
  70. package/dist/signaling.d.ts.map +1 -1
  71. package/dist/signaling.js +3 -3
  72. package/dist/signaling.js.map +2 -2
  73. package/dist/source-auth.js +22 -6
  74. package/dist/source-auth.js.map +2 -2
  75. package/dist/switching-set-alignment.d.ts +1 -1
  76. package/dist/switching-set-alignment.js.map +1 -1
  77. package/dist/timestamp-codec.js.map +2 -2
  78. package/dist/wasm-mfu-reassembler.js.map +1 -1
  79. package/dist/wasm-mmtp-container-parser.js.map +2 -2
  80. package/package.json +5 -5
  81. package/schemas/catalog.schema.json +81 -28
  82. package/src/carp-catalog.ts +77 -39
  83. package/src/catalog-fec-params.ts +5 -2
  84. package/src/catalog-validator.ts +4 -11
  85. package/src/fec-state.ts +3 -2
  86. package/src/index.ts +18 -2
  87. package/src/manifest-auth-plan.ts +39 -91
  88. package/src/mmtp-fec-session.ts +514 -0
  89. package/src/mmtp-router.ts +25 -0
  90. package/src/multicast-auth-catalog.ts +131 -238
  91. package/src/multicast-input.ts +88 -37
  92. package/src/multicast-manager.ts +88 -14
  93. package/src/no-modules.ts +2 -0
  94. package/src/repair-fetch.ts +79 -14
  95. package/src/signaling.ts +2 -2
  96. package/src/switching-set-alignment.ts +1 -1
  97. package/test-vectors/catalog/README.md +38 -3
  98. package/test-vectors/catalog/negative/fec-iso-symbol-size-below-floor.json +28 -0
  99. package/test-vectors/catalog/negative/fec-reed-solomon-iso-symbol-size-13.json +28 -0
  100. package/test-vectors/catalog/negative/fec-repair-overlay-source-symbols-zero.json +43 -0
  101. package/test-vectors/catalog/negative/fec-repair-symbols-zero.json +28 -0
  102. package/test-vectors/catalog/negative/fec-source-symbols-zero.json +28 -0
  103. package/test-vectors/catalog/negative/fec-symbol-size-zero.json +28 -0
  104. package/test-vectors/catalog/negative/multicast-auth-asm-missing-sender-address.json +77 -0
  105. package/test-vectors/catalog/negative/multicast-auth-duplicate-first-epoch.json +56 -0
  106. package/test-vectors/catalog/negative/multicast-auth-duplicate-kid.json +56 -0
  107. package/test-vectors/catalog/negative/multicast-auth-endpoint-auth-without-object-auth.json +38 -0
  108. package/test-vectors/catalog/negative/multicast-auth-endpoint-missing-auth.json +49 -0
  109. package/test-vectors/catalog/negative/multicast-auth-endpoint-missing-bandwidth.json +55 -0
  110. package/test-vectors/catalog/negative/multicast-auth-manifest-port-equals-port.json +56 -0
  111. package/test-vectors/catalog/negative/multicast-auth-manifest-timer-out-of-range.json +56 -0
  112. package/test-vectors/catalog/negative/multicast-auth-max-auth-delay-out-of-range.json +56 -0
  113. package/test-vectors/catalog/negative/multicast-auth-root-dotted-key.json +55 -0
  114. package/test-vectors/catalog/negative/multicast-auth-sender-address-on-ssm.json +57 -0
  115. package/test-vectors/catalog/negative/multicast-auth-version-1.json +56 -0
  116. package/test-vectors/catalog/negative/multicast-auth-version-3.json +56 -0
  117. package/test-vectors/catalog/negative/multicast-auth-version-missing.json +55 -0
  118. package/test-vectors/catalog/negative/multicast-endpoint-foreign-namespace-track.json +44 -0
  119. package/test-vectors/catalog/negative/multicast-endpoint-protocol-amt.json +38 -0
  120. package/test-vectors/catalog/negative/multicast-endpoint-protocol-atsc3.json +38 -0
  121. package/test-vectors/catalog/positive/multicast-amt-manual-relay.json +2 -2
  122. package/test-vectors/catalog/{negative/multicast-endpoint-missing-protocol-and-source.json → positive/multicast-asm-unprotected.json} +10 -5
  123. package/test-vectors/catalog/positive/multicast-auth-asm-sender.json +78 -0
  124. package/test-vectors/catalog/positive/multicast-auth-rotation.json +39 -38
  125. package/test-vectors/catalog/positive/multicast-draft01-4-1-example.json +81 -0
  126. package/test-vectors/catalog/positive/multicast-draft01-7-2-6-example.json +70 -0
  127. package/test-vectors/catalog/section-codes.json +23 -1
  128. package/test-vectors/catalog-multicast-auth-v1.json +38 -20
  129. package/test-vectors/catalog-validation.json +3 -2
  130. package/test-vectors/catalog-validator-public-api.mjs +14 -9
package/README.md CHANGED
@@ -121,7 +121,7 @@ function parseAlFecMessage(buf: Uint8Array): AlFecMessage | null // every FEC
121
121
  function parseMoqRepairFrame(buf: Uint8Array): MoqRepairFrame
122
122
  ```
123
123
 
124
- Constants worth knowing: `MMTP_HEADER_SIZE = 12`, `MPU_HEADER_SIZE = 8`, `MFU_DU_HEADER_SIZE_TIMED = 14`, `PACKET_TYPE_MPU = 0x00`, `PACKET_TYPE_REPAIR = 0x03`, `ALFEC_MESSAGE_ID = 0x0203`, `FEC_CODE_RAPTORQ = 2`.
124
+ Constants worth knowing: `MMTP_HEADER_SIZE = 12`, `MPU_HEADER_SIZE = 8`, `MFU_DU_HEADER_SIZE_TIMED = 14`, `PACKET_TYPE_MPU = 0x00`, `PACKET_TYPE_REPAIR = 0x03`, `ALFEC_MESSAGE_ID = 0x0203`, `FEC_CODE_RAPTORQ = 3`, `FEC_CODE_REED_SOLOMON = 1`.
125
125
 
126
126
  ```ts
127
127
  import { parseMMTPHeader, extractMFUPayload } from "@blockcast/mmt-base"
@@ -158,10 +158,12 @@ The constructor rejects non-null, non-finite, or non-positive deadlines. Reliabl
158
158
 
159
159
  ### CARP / CMSF catalog (`./carp-catalog`)
160
160
 
161
- Validate the published catalog schema through the package API. The schema uses
162
- the package-defined `uniqueMulticastAuthTrackBindings` keyword to reject reused
163
- `(mediaTrack, sourceSymbolFormat)` bindings, so compiling the JSON with a bare
164
- JSON Schema validator is not supported.
161
+ Validate the published catalog schema through the package API, then run
162
+ `validateCmsfMmtpCatalog`: the multicast rules of draft-ramadan-moq-multicast-01
163
+ that JSON Schema cannot state (a repeated `kid` or `firstEpoch` in
164
+ `multicast.auth.keys`, a `manifestPort` that clashes with a port of its
165
+ `(S, G)`, a track declaring a foreign namespace) live only in the runtime
166
+ validator.
165
167
 
166
168
  ```ts
167
169
  import schema from "@blockcast/mmt-container/catalog.schema.json" with { type: "json" }
@@ -173,7 +175,7 @@ if (!validateCatalog(catalog)) {
173
175
  }
174
176
  ```
175
177
 
176
- Implements `draft-law-ramadan-moq-carp-reliability` §3 (FEC), §4 (multicast endpoints), and `draft-ramadan-moq-mmt-00` §4.4.4 (track timing). Plain TypeScript interfaces with type guards — no Zod, no runtime schema dependency. Upstream Zod schemas should derive from these via `z.infer<>`.
178
+ Implements `draft-law-ramadan-moq-carp-reliability` §3 (FEC), §4 (multicast endpoints), and `draft-ramadan-moq-mmt-01` §4.4.2 (track timing). Plain TypeScript interfaces with type guards — no Zod, no runtime schema dependency. Upstream Zod schemas should derive from these via `z.infer<>`.
177
179
 
178
180
  ```ts
179
181
  type FecAlgorithm = "none" | "raptorq" | "reed-solomon"
@@ -187,7 +189,7 @@ interface FecCatalogConfig {
187
189
  interleaveDepthMs?: number // FEC block span in MILLISECONDS, default 0 (single-group blocks)
188
190
  repairTrack: string // §6.1 — required
189
191
  mode?: "interleaved" | "object" // extension; "object" (per-frame object blocks) is retired: @blockcast/mmt-fec refuses it
190
- uep?: { keyRatio: number; deltaRatio: number } // §9.1 — Unequal Error Protection
192
+ uep?: { keyRatio: number; deltaRatio: number } // Unequal Error Protection — Blockcast extension, not in draft-ramadan-moq-fec-01
191
193
  deltaFailWindowBlocks?: number // D-11, base track only
192
194
  deltaProbeIntervalMs?: number // D-13, base track only
193
195
  }
@@ -248,7 +250,9 @@ non-DRIAD AMT entry, so the manual one carries the relay while the DRIAD one
248
250
  keeps the discovery request. An `atsc3` endpoint now
249
251
  requires a `{type: "atsc3", …}` entry and throws `atsc3_requires_tuning`
250
252
  without one: that entry carries the frequency, PLP, service id and SLS URI,
251
- which is the only tuning information an ATSC3 receiver has, and the schema
253
+ which is the only tuning information an ATSC3 receiver has (the SLS behind
254
+ `slsUri` describes the MMTP session, MP table included, per A/331:2026-04 7.2,
255
+ and nothing of this profile, so `manifestPort` and keys come from provisioning), and the schema
252
256
  cannot enforce it because `networkSource` is optional there (a native join has
253
257
  none). `version`, `validUntil` and `enabled` are still emitted and still
254
258
  outside `$defs/multicast` (the BLO-3323 freshness model, tracked separately).
@@ -446,7 +450,7 @@ All string values pass through `sanitize()` (T-06-01) — commas, `\r`, `\n` are
446
450
 
447
451
  ### Multicast transport (`./multicast-transport`)
448
452
 
449
- Thin wrapper around the lowercase `window.multicast` gateway. Calls `globalThis.multicast.subscribe({ group, source, port, consume: 'bytes' })`, listens for `"bytes"` events (`CustomEvent<ArrayBuffer>`) on the returned `EventTarget` subscription, pumps packets to a callback, runs a 5-second watchdog, and fires `onTakeover` once both video and audio are confirmed receiving.
453
+ Thin wrapper around the lowercase `window.multicast` gateway. Calls `globalThis.multicast.subscribe({ group, source, port, consume: 'bytes' })`, listens for `"bytes"` events (`CustomEvent<ArrayBuffer>`) on the returned `EventTarget` subscription, pumps packets to a callback, runs a silence watchdog over the catalog-derived failback window (`setFailbackWindowMs`), and fires `onTakeover` once both video and audio are confirmed receiving.
450
454
 
451
455
  ```ts
452
456
  class MulticastTransport {
@@ -457,12 +461,21 @@ class MulticastTransport {
457
461
  confirmVideo(): void
458
462
  confirmAudio(): void
459
463
  onTakeover(cb: () => void): void
460
- onFailback(cb: () => void): void
464
+ onFailback(cb: (reason: MulticastFailbackReason) => void): void
465
+ setFailbackWindowMs(windowMs: number | null): void
461
466
  dispose(): void
462
467
  readonly stats: { packetsReceived: number; bytesReceived: number }
463
468
  }
464
469
  ```
465
470
 
471
+ **Failover vocabulary.** draft-multicast-01 Section 6 "failover" (multicast to
472
+ unicast) is libmmt's *failback*: `onFailback`, `MulticastManager.onFailback`,
473
+ `failbackAll`, `MediaRouter.failbackToMoq`, `MulticastFailbackReason`, and CMCD
474
+ `x-bc-ct` `mc-to-uc`. libmmt's in-code *failover* (`track-session.ts`) is the
475
+ per-track hop along a track's transport chain. The return to multicast is the
476
+ draft's switch to multicast / join / switch back; CMCD `mc-start` is fired
477
+ host-side.
478
+
466
479
  Direct Sockets is Chrome-IWA-only. Outside an IWA context `isAvailable()` returns false and join() warns + returns false. AMT tunneling and unicast fallback are handled by `@blockcast/mmt-transport`, not by this transport class.
467
480
 
468
481
  ## Track-role convention summary (Phase 14)
@@ -503,11 +516,11 @@ Roles are required by:
503
516
  - **ISO/IEC 14496-12** — ISOBMFF (consumed for fMP4 box construction in `mmtp-to-cmaf.ts`)
504
517
  - **draft-ietf-moq-catalogformat** — CMSF catalog (IETF MOQ WG)
505
518
  - **draft-law-ramadan-moq-carp-reliability** — CARP §3 (FEC) + §4 (multicast endpoints) + §5.1 (interleave units) + §6.1 (repair track)
506
- - **draft-ramadan-moq-mmt-00** — MMT-over-MoQ wire format (§4.4.4 group-duration signaling, §5.3 MMTP→CMAF mapping)
519
+ - **draft-ramadan-moq-mmt-01** — MMT-over-MoQ wire format (§4.4.2 group-duration signaling, §4 MoQ object mapping, §5 MFU mode)
507
520
  - **draft-ramadan-moq-fec** — AL-FEC over MoQ (§5.3 FEC Source Info object extension 0x11: SS_ID(32), fixed 4 bytes)
508
521
  - **RFC 6330** — RaptorQ Forward Error Correction (strict OTI codec in `@blockcast/mmt-fec`)
509
522
  - **RFC 9559** — CMCD (used by `CmcdProducer`)
510
- - **ATSC A/331** — Signaling, Delivery, Synchronization, Error Protection
523
+ - **ATSC A/331:2026-02 (informative for draft-fec-01 / draft-mmt-01; 7.2 SLS/MP table, 8.1.2.1 MMTP session, 8.1.2.5 AL-FEC) and A/331:2026-04 (normative for draft-multicast-01)** — Signaling, Delivery, Synchronization, Error Protection
511
524
 
512
525
  ## Related packages
513
526