@blockcast/mmt-fec 0.3.0 → 0.4.0-main.26d61a540c44

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 (74) hide show
  1. package/README.md +4 -4
  2. package/dist/block-processor.d.ts +19 -20
  3. package/dist/block-processor.d.ts.map +1 -1
  4. package/dist/block-processor.js +27 -93
  5. package/dist/block-processor.js.map +1 -1
  6. package/dist/fec-block-mapper.d.ts +16 -72
  7. package/dist/fec-block-mapper.d.ts.map +1 -1
  8. package/dist/fec-block-mapper.js +17 -96
  9. package/dist/fec-block-mapper.js.map +1 -1
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +3 -3
  13. package/dist/index.js.map +1 -1
  14. package/dist/oti.d.ts +17 -8
  15. package/dist/oti.d.ts.map +1 -1
  16. package/dist/oti.js +9 -1
  17. package/dist/oti.js.map +1 -1
  18. package/dist/repair-group.d.ts +86 -0
  19. package/dist/repair-group.d.ts.map +1 -1
  20. package/dist/repair-group.js +135 -0
  21. package/dist/repair-group.js.map +1 -1
  22. package/package.json +5 -6
  23. package/src/block-processor.ts +31 -110
  24. package/src/fec-block-mapper.ts +23 -108
  25. package/src/index.ts +6 -1
  26. package/src/oti.ts +20 -9
  27. package/src/repair-group.ts +176 -0
  28. package/test-vectors/repair-epoch.json +119 -0
  29. package/node_modules/@blockcast/mmt-alta-parse/README.md +0 -181
  30. package/node_modules/@blockcast/mmt-alta-parse/dist/.build-stamp +0 -0
  31. package/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts +0 -57
  32. package/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts.map +0 -1
  33. package/node_modules/@blockcast/mmt-alta-parse/dist/index.js +0 -115
  34. package/node_modules/@blockcast/mmt-alta-parse/dist/index.js.map +0 -1
  35. package/node_modules/@blockcast/mmt-alta-parse/package.json +0 -50
  36. package/node_modules/@blockcast/mmt-alta-parse/src/index.ts +0 -136
  37. package/node_modules/@blockcast/mmt-base/README.md +0 -134
  38. package/node_modules/@blockcast/mmt-base/dist/.build-stamp +0 -0
  39. package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.d.ts +0 -55
  40. package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.d.ts.map +0 -1
  41. package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.js +0 -128
  42. package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.js.map +0 -1
  43. package/node_modules/@blockcast/mmt-base/dist/index.d.ts +0 -7
  44. package/node_modules/@blockcast/mmt-base/dist/index.d.ts.map +0 -1
  45. package/node_modules/@blockcast/mmt-base/dist/index.js +0 -7
  46. package/node_modules/@blockcast/mmt-base/dist/index.js.map +0 -1
  47. package/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts +0 -292
  48. package/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts.map +0 -1
  49. package/node_modules/@blockcast/mmt-base/dist/mmtp.js +0 -612
  50. package/node_modules/@blockcast/mmt-base/dist/mmtp.js.map +0 -1
  51. package/node_modules/@blockcast/mmt-base/dist/net-constants.d.ts +0 -18
  52. package/node_modules/@blockcast/mmt-base/dist/net-constants.d.ts.map +0 -1
  53. package/node_modules/@blockcast/mmt-base/dist/net-constants.js +0 -18
  54. package/node_modules/@blockcast/mmt-base/dist/net-constants.js.map +0 -1
  55. package/node_modules/@blockcast/mmt-base/dist/ntp-short.d.ts +0 -47
  56. package/node_modules/@blockcast/mmt-base/dist/ntp-short.d.ts.map +0 -1
  57. package/node_modules/@blockcast/mmt-base/dist/ntp-short.js +0 -54
  58. package/node_modules/@blockcast/mmt-base/dist/ntp-short.js.map +0 -1
  59. package/node_modules/@blockcast/mmt-base/dist/serial-number.d.ts +0 -57
  60. package/node_modules/@blockcast/mmt-base/dist/serial-number.d.ts.map +0 -1
  61. package/node_modules/@blockcast/mmt-base/dist/serial-number.js +0 -98
  62. package/node_modules/@blockcast/mmt-base/dist/serial-number.js.map +0 -1
  63. package/node_modules/@blockcast/mmt-base/dist/signalling.d.ts +0 -312
  64. package/node_modules/@blockcast/mmt-base/dist/signalling.d.ts.map +0 -1
  65. package/node_modules/@blockcast/mmt-base/dist/signalling.js +0 -637
  66. package/node_modules/@blockcast/mmt-base/dist/signalling.js.map +0 -1
  67. package/node_modules/@blockcast/mmt-base/package.json +0 -49
  68. package/node_modules/@blockcast/mmt-base/src/fec-block-profile.ts +0 -145
  69. package/node_modules/@blockcast/mmt-base/src/index.ts +0 -6
  70. package/node_modules/@blockcast/mmt-base/src/mmtp.ts +0 -892
  71. package/node_modules/@blockcast/mmt-base/src/net-constants.ts +0 -17
  72. package/node_modules/@blockcast/mmt-base/src/ntp-short.ts +0 -67
  73. package/node_modules/@blockcast/mmt-base/src/serial-number.ts +0 -107
  74. package/node_modules/@blockcast/mmt-base/src/signalling.ts +0 -862
package/README.md CHANGED
@@ -29,7 +29,7 @@ const blocks = new FecBlockManager({ k: K, timeoutMs })
29
29
  if (recoveredBlock) {
30
30
  // K source symbols concatenated. Split them back into MFU fragments under
31
31
  // the catalog fec.blockProfile (required; there is no default profile or T).
32
- const { symbols } = processFecBlock(recoveredBlock, { blockProfile: "k-padded-v1", k: K, symbolSize: T })
32
+ const { symbols } = processFecBlock(recoveredBlock, { blockProfile: "iso-ssbg1-v1", k: K, symbolSize: T })
33
33
  for (const s of symbols) reassembler.addFragment(s.fragment)
34
34
  }
35
35
  ```
@@ -48,7 +48,7 @@ Mirrors `package.json#exports`. Each subpath is a tree-shakeable entry point.
48
48
  | `./cmaf-recovery` | `src/cmaf-recovery.ts` | `CmafFecRecovery` — stateful recovery for CMAF chunks + LOC frames |
49
49
  | `./loc` | `src/loc-symbols.ts` | `splitFrameToSymbol`, `recoverFrameFromSymbol` — LOC 1:1 frame ↔ symbol |
50
50
 
51
- The aggregator entry also re-exports OTI helpers (`buildOTI`, `buildOTIFromCatalog`, `parseOTI`, `computeFecTimeout`, `parseRepairPacket`) the block-geometry mappers (`FecBlockMapper`, `NullBlockMapper`, `ObjectBlockMapper`, `createMapper`, `recoveredPacketMediaGroup`), and the `iso-ssbg1-v1` MoQ repair group helpers (`extSsStart`, `extendSsId`, `repairFetchRange`, `repairGroupIdMatches`). Canonical MMTP Source FEC Payload ID parsing lives in `@blockcast/mmt-base`; canonical LOC FEC source information lives in `@blockcast/mmt-container`.
51
+ The aggregator entry also re-exports OTI helpers (`buildOTI`, `buildOTIFromCatalog`, `parseOTI`, `computeFecTimeout`, `parseRepairPacket`) the block-geometry mappers (`FecBlockMapper`, `NullBlockMapper`, `createMapper`, `recoveredPacketMediaGroup`), and the `iso-ssbg1-v1` MoQ repair group helpers (`extSsStart`, `extendSsId`, `repairFetchRange`, `repairGroupIdMatches`). Canonical MMTP Source FEC Payload ID parsing lives in `@blockcast/mmt-base`; canonical LOC FEC source information lives in `@blockcast/mmt-container`.
52
52
 
53
53
  ## Architecture
54
54
 
@@ -104,7 +104,7 @@ container or worker.
104
104
 
105
105
  The WASM decoder hands back `K * symbolSize` bytes (K source symbols concatenated). `processFecBlock` (`src/block-processor.ts:68`) walks each symbol, parses its MMTP header, extracts the MFU payload via `@blockcast/mmt-base`'s `extractMFUPayload`, and emits a `ParsedFecSymbol[]` sorted with wrapping 32-bit MMTP serial-number arithmetic (source-symbol index breaks duplicate ties) — undoing FEC interleaving so the reassembler sees `FI=1` before `FI=2/3` for the same MPU, including across `0xffff_ffff → 0`.
106
106
 
107
- Both `processFecBlock` and `processFecSymbol` require the stream's catalog `fec.blockProfile`, and `processFecBlock` requires the symbol size T; neither is defaulted. Under `k-padded-v1` a recovered fixed-width symbol is trimmed only at the ISO-declared end (`MPU start + 2 + payload_length`), extended by an ALTA trailer only when one begins exactly there, and the remaining bytes must be uniform decoder padding. Under `iso-ssbg1-v1` (ISO/IEC 23008-1 C.3.3 ssbg_mode1) the symbol is `u16 length || packet || 00h padding`: the length field alone delimits the packet, and a length past the symbol or non-zero padding is counted as `bad_ssbg1_length`. Either way the processor never infers packet boundaries from MFU contents or alternate length conventions.
107
+ Both `processFecBlock` and `processFecSymbol` require the stream's catalog `fec.blockProfile`, and `processFecBlock` requires the symbol size T; neither is defaulted, and the only profile is `iso-ssbg1-v1` (the retired `k-padded-v1` token throws like any unknown one). A recovered symbol is the ISO/IEC 23008-1 C.3.3 ssbg_mode1 `u16 length || packet || 00h padding`: the length field alone delimits the packet, and a length past the symbol or non-zero padding is counted as `bad_ssbg1_length`. The processor never infers packet boundaries from MFU contents, padding scans or alternate length conventions.
108
108
 
109
109
  ```ts
110
110
  interface ParsedFecSymbol {
@@ -176,7 +176,7 @@ parseRepairPacket(mmtpPacket) // ISO 23008-1 §C.5.3 repair FEC PID
176
176
 
177
177
  `computeFecTimeout` derives the block-recovery deadline from the catalog interleave value — see `src/oti.ts:121`. The catalog's `interleaveDepthMs` IS the full FEC block span (§5.1), so the timeout is `interleaveDepthMs * safetyFactor`, independent of K; the safety factor is the only tunable. **Do not** hardcode `setTimeout` values upstream.
178
178
 
179
- `./` (root) exposes the catalog block geometry via `FecBlockMapper` (`k`, `d`, `interleaveDepthMs`, `gopDurationMs`, `pacingThresholdMs`, and the required `blockProfile`). It does not map MoQ groups to FEC blocks: a recovered packet's media group comes from its own header (`mediaGroupOf` / `recoveredPacketMediaGroup`), and `fromSsId` is the `k-padded-v1` SS_ID locator that throws under `iso-ssbg1-v1`, whose blocks are located by `(SS_Start, SSB_length)` range membership. `NullBlockMapper` (no FEC, no profile) and `ObjectBlockMapper` (§9.1 object FEC, `k-padded-v1` only) keep their identity `derive`. Under `iso-ssbg1-v1` the MoQ repair group id is the 62-bit wrap-epoch-extended SS_Start (`extSsStart`); a receiver that lost SS_ID x in a block it has not delimited FETCHes `repairFetchRange(x, K, { previousBlockStart })`, or `repairFetchRange(x, K, { reference })` from its wrap-epoch reference when no delimited block ends before x (draft-ramadan-moq-fec §7.5), and discards a repair object whose Group ID fails `repairGroupIdMatches`.
179
+ `./` (root) exposes the catalog block geometry via `FecBlockMapper` (`k`, `d`, `interleaveDepthMs`, `gopDurationMs`, `pacingThresholdMs`, and the required `blockProfile`). It does not map MoQ groups to FEC blocks: a recovered packet's media group comes from its own header (`mediaGroupOf` / `recoveredPacketMediaGroup`), and `fromSsId` throws for every stream with an FEC instance, whose `iso-ssbg1-v1` blocks are located by `(SS_Start, SSB_length)` range membership. `NullBlockMapper` (no FEC, no profile) keeps its identity `derive` and `fromSsId`; `createMapper({ mode: 'object' })` throws, since per-group object FEC numbers SS_IDs on the retired `k-padded-v1` stride. Under `iso-ssbg1-v1` the MoQ repair group id is the 62-bit wrap-epoch-extended SS_Start (`extSsStart`); a receiver that lost SS_ID x in a block it has not delimited FETCHes `repairFetchRange(x, K, { previousBlockStart })`, or `repairFetchRange(x, K, { reference })` from its wrap-epoch reference when no delimited block ends before x (draft-ramadan-moq-fec §7.5), and discards a repair object whose Group ID fails `repairGroupIdMatches`.
180
180
 
181
181
  ## WASM module loading
182
182
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * FEC Block Processor
3
3
  *
4
- * Splits decoded FEC blocks (K symbols concatenated by WASM RaptorQ decoder)
4
+ * Splits decoded FEC blocks (SSB_length symbols concatenated by the WASM decoder)
5
5
  * into individual MFU fragments ready for reassembly and decoding.
6
6
  *
7
7
  * Extracted from moqtail.html's inline processFecBlock() for reuse across
@@ -49,9 +49,9 @@ export interface ProcessFecBlockResult {
49
49
  /** Options for {@link processFecSymbol}. */
50
50
  export interface ProcessFecSymbolOptions {
51
51
  /**
52
- * The stream's catalog `fec.blockProfile`. Required, never defaulted: the
53
- * two profiles lay a packet into a symbol differently, so the same
54
- * recovered bytes trim to different packets under each.
52
+ * The stream's catalog `fec.blockProfile`. Required, never defaulted:
53
+ * the profile fixes how a packet is laid into a symbol, and the only one
54
+ * implemented is `iso-ssbg1-v1`.
55
55
  */
56
56
  blockProfile: FecBlockProfile;
57
57
  /** Symbol index within the block, used only for diagnostics. */
@@ -66,9 +66,9 @@ export interface ProcessFecBlockOptions {
66
66
  /** Symbol size T in bytes (catalog `fec.symbolSize`). Required: there is no default T. */
67
67
  symbolSize: number;
68
68
  /**
69
- * Source symbols in the decoded block: K under `k-padded-v1`, SSB_length
70
- * under `iso-ssbg1-v1`. When omitted the block must be a whole number of
71
- * T-byte symbols and K is that number; a partial symbol throws.
69
+ * Source symbols in the decoded block: its SSB_length (K'). When omitted
70
+ * the block must be a whole number of T-byte symbols and K' is that
71
+ * number; a partial symbol throws.
72
72
  */
73
73
  k?: number;
74
74
  /** Keep only symbols for this packetId. */
@@ -77,30 +77,29 @@ export interface ProcessFecBlockOptions {
77
77
  /**
78
78
  * Parse one recovered FEC source symbol into an MFU fragment.
79
79
  *
80
- * The symbol is laid out by the stream's block profile: under `k-padded-v1`
81
- * it is the protected MMTP packet zero-padded to T; under `iso-ssbg1-v1` it is
82
- * the ssbg_mode1 `u16 length || packet || zero padding`. Either way the
83
- * recovered packet is then parsed identically. Failures are counted by reason
84
- * (`bad_ssbg1_length` is the ISO length/padding refusal), never thrown.
80
+ * The symbol is the `iso-ssbg1-v1` ssbg_mode1 `u16 length || packet || zero
81
+ * padding` (ISO/IEC 23008-1 C.3.3): the length field alone delimits the
82
+ * protected packet, which is then parsed as an MMTP MPU packet. Failures are
83
+ * counted by reason (`bad_ssbg1_length` is the length/padding refusal), never
84
+ * thrown.
85
85
  *
86
- * @throws when `options.blockProfile` is absent or not a known profile token.
86
+ * @throws when `options.blockProfile` is absent or not `iso-ssbg1-v1`.
87
87
  */
88
88
  export declare function processFecSymbol(symbolData: Uint8Array, options: ProcessFecSymbolOptions): ProcessFecBlockResult;
89
89
  /**
90
90
  * Process a decoded FEC block into individual MFU fragments.
91
91
  *
92
92
  * The WASM RaptorQ decoder returns every source symbol of the block
93
- * concatenated (K x T bytes under `k-padded-v1`, SSB_length x T bytes under
94
- * `iso-ssbg1-v1`). This function splits them apart, recovers each protected
95
- * packet by the stream's block profile (see {@link processFecSymbol}),
96
- * extracts the MFU payload via shared extractMFUPayload, and returns
97
- * structured results sorted for reassembly.
93
+ * concatenated (SSB_length x T bytes). This function splits them apart,
94
+ * recovers each protected packet from its ssbg_mode1 length field (see
95
+ * {@link processFecSymbol}), extracts the MFU payload via shared
96
+ * extractMFUPayload, and returns structured results sorted for reassembly.
98
97
  *
99
98
  * @param blockData - Concatenated source symbols from the WASM decoder
100
99
  * @param options - Block profile and symbol size T are required; see {@link ProcessFecBlockOptions}
101
100
  * @throws when the block profile or symbol size is absent or invalid, when an
102
- * omitted `k` cannot be read exactly from the block length, or when an
103
- * `iso-ssbg1-v1` block is not exactly `k` symbols long.
101
+ * omitted `k` cannot be read exactly from the block length, or when the
102
+ * block is not exactly `k` symbols long.
104
103
  */
105
104
  export declare function processFecBlock(blockData: Uint8Array, options: ProcessFecBlockOptions): ProcessFecBlockResult;
106
105
  //# sourceMappingURL=block-processor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"block-processor.d.ts","sourceRoot":"","sources":["../src/block-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAWN,KAAK,eAAe,EAEpB,MAAM,qBAAqB,CAAC;AAE7B,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC/B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,QAAQ,EAAE;QACT,iBAAiB,EAAE,MAAM,CAAC;QAC1B,sBAAsB,EAAE,MAAM,CAAC;QAC/B,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,UAAU,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,2BAA2B,CAAC,EAAE,MAAM,CAAC;QACrC,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FAA0F;IAC1F,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AA0ID;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC/B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,uBAAuB,GAC9B,qBAAqB,CAyBvB;AA2CD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC9B,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,sBAAsB,GAC7B,qBAAqB,CAgCvB"}
@@ -1,59 +1,13 @@
1
1
  /**
2
2
  * FEC Block Processor
3
3
  *
4
- * Splits decoded FEC blocks (K symbols concatenated by WASM RaptorQ decoder)
4
+ * Splits decoded FEC blocks (SSB_length symbols concatenated by the WASM decoder)
5
5
  * into individual MFU fragments ready for reassembly and decoding.
6
6
  *
7
7
  * Extracted from moqtail.html's inline processFecBlock() for reuse across
8
8
  * both moq-lib and moqtail players. Pure function — no side effects.
9
9
  */
10
- import { MMTP_EXT_TRAILER_HEADER_SIZE, MMTP_EXT_TYPE_ALTA_AUTH, MMTP_HEADER_SIZE, MPU_HEADER_SIZE, SSBG1_LENGTH_FIELD_BYTES, extractMFUPayload, parseFecBlockProfile, parseMPUHeader, parseMMTPHeader, trimSsbg1SourceSymbol, } from "@blockcast/mmt-base";
11
- function hasUniformPaddingFrom(data, start) {
12
- if (start >= data.length)
13
- return false;
14
- const pad = data[start];
15
- if (pad !== 0x00 && pad !== 0xee)
16
- return false;
17
- for (let i = start + 1; i < data.length; i++) {
18
- if (data[i] !== pad)
19
- return false;
20
- }
21
- return true;
22
- }
23
- function maybeExtendAltaTrailer(symbolData, packetEnd) {
24
- if (packetEnd + MMTP_EXT_TRAILER_HEADER_SIZE > symbolData.length)
25
- return packetEnd;
26
- const view = new DataView(symbolData.buffer, symbolData.byteOffset + packetEnd, symbolData.byteLength - packetEnd);
27
- const extType = view.getUint16(0, false);
28
- if (extType !== MMTP_EXT_TYPE_ALTA_AUTH)
29
- return packetEnd;
30
- const extLen = view.getUint16(2, false);
31
- const trailerEnd = packetEnd + MMTP_EXT_TRAILER_HEADER_SIZE + extLen;
32
- return trailerEnd <= symbolData.length ? trailerEnd : packetEnd;
33
- }
34
- function trimDecodedSourceSymbol(symbolData) {
35
- if (symbolData.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE)
36
- return null;
37
- const headerLength = parseMMTPHeader(symbolData).headerLength;
38
- if (symbolData.length < headerLength + MPU_HEADER_SIZE)
39
- return null;
40
- const payload = symbolData.subarray(headerLength);
41
- const mpu = parseMPUHeader(payload);
42
- const trailingMpuHeaderSize = MPU_HEADER_SIZE - 2;
43
- if (mpu.payloadLength < trailingMpuHeaderSize)
44
- return null;
45
- // Recovered source symbols are fixed-width and may be padded, but their wire
46
- // boundary is still the ISO length-after-field coordinate. ALTA may extend the
47
- // packet from exactly that point; no MFU-content or alternate-length guessing.
48
- const declaredEnd = headerLength + 2 + mpu.payloadLength;
49
- if (declaredEnd > symbolData.length)
50
- return null;
51
- const packetEnd = maybeExtendAltaTrailer(symbolData, declaredEnd);
52
- if (packetEnd < symbolData.length && !hasUniformPaddingFrom(symbolData, packetEnd)) {
53
- return null;
54
- }
55
- return symbolData.subarray(0, packetEnd);
56
- }
10
+ import { MMTP_HEADER_SIZE, SSBG1_LENGTH_FIELD_BYTES, extractMFUPayload, parseFecBlockProfile, parseMMTPHeader, trimSsbg1SourceSymbol, } from "@blockcast/mmt-base";
57
11
  function emptyProcessResult() {
58
12
  return {
59
13
  symbols: [],
@@ -77,8 +31,8 @@ function resultFromSymbols(parsed, failedCount, failReasons, ownerPacketId) {
77
31
  // Reassembler needs FI=1 before FI=2/3 for the same mpuSequenceNumber.
78
32
  parsed.sort(comparePacketSequence);
79
33
  // When ownerPacketId is set, only keep symbols matching the track that owns
80
- // this FEC block. Other packetIds (including 0 from zero-padded recovery slots)
81
- // are garbage and must be rejected to prevent decoder crashes.
34
+ // this FEC block. Other packetIds are garbage and must be rejected to
35
+ // prevent decoder crashes.
82
36
  const symbols = ownerPacketId != null
83
37
  ? parsed.filter((s) => s.packetId === ownerPacketId)
84
38
  : parsed;
@@ -87,9 +41,8 @@ function resultFromSymbols(parsed, failedCount, failReasons, ownerPacketId) {
87
41
  /**
88
42
  * Gate one candidate MMTP packet on its fixed header: long enough, version 0,
89
43
  * parseable, and an MPU packet. Returns the parsed header, or null after
90
- * counting why it was refused. Both profiles run this exact gate; they differ
91
- * only in which bytes they hand it (the symbol under k-padded-v1, the
92
- * length-delimited packet under iso-ssbg1-v1).
44
+ * counting why it was refused. It sees the length-delimited protected packet,
45
+ * never the padded symbol.
93
46
  */
94
47
  function gateMpuHeader(data, bump) {
95
48
  if (data.length < MMTP_HEADER_SIZE) {
@@ -118,7 +71,7 @@ function parseProtectedPacket(packetData, hdr, index, bump) {
118
71
  // packet (fecType=1 per draft-ramadan-moq-mmt-00 §3.1), but the 4-byte
119
72
  // Source FEC Payload ID (ISO 23008-1 §C.5.2) is never part of the protected
120
73
  // packet (C.4.2). Tell extractMFUPayload to skip FEC PID subtraction so it
121
- // does not truncate video data; any ALTA trailer must then consume the
74
+ // does not truncate video data; any legacy authenticator trailer must then consume the
122
75
  // exact suffix after the declared payload.
123
76
  const extraction = extractMFUPayload(packetData, { skipFecId: true });
124
77
  if (!extraction) {
@@ -147,22 +100,6 @@ function parseProtectedPacket(packetData, hdr, index, bump) {
147
100
  rawSymbol: packetData,
148
101
  };
149
102
  }
150
- /**
151
- * k-padded-v1: the symbol is the protected packet zero-padded to T with no
152
- * length field, so the packet ends at its ISO-declared MPU boundary (plus an
153
- * ALTA trailer starting exactly there) and the rest must be uniform padding.
154
- */
155
- function parseKPaddedSymbol(symbolData, index, bump) {
156
- const hdr = gateMpuHeader(symbolData, bump);
157
- if (!hdr)
158
- return null;
159
- const packetData = trimDecodedSourceSymbol(symbolData);
160
- if (!packetData) {
161
- bump("bad_length");
162
- return null;
163
- }
164
- return parseProtectedPacket(packetData, hdr, index, bump);
165
- }
166
103
  /**
167
104
  * iso-ssbg1-v1 (ISO/IEC 23008-1 C.3.3 ssbg_mode1): the symbol is
168
105
  * `u16be(length) || protected packet || 00h padding`. The length field alone
@@ -183,16 +120,16 @@ function parseSsbg1Symbol(symbolData, index, bump) {
183
120
  /**
184
121
  * Parse one recovered FEC source symbol into an MFU fragment.
185
122
  *
186
- * The symbol is laid out by the stream's block profile: under `k-padded-v1`
187
- * it is the protected MMTP packet zero-padded to T; under `iso-ssbg1-v1` it is
188
- * the ssbg_mode1 `u16 length || packet || zero padding`. Either way the
189
- * recovered packet is then parsed identically. Failures are counted by reason
190
- * (`bad_ssbg1_length` is the ISO length/padding refusal), never thrown.
123
+ * The symbol is the `iso-ssbg1-v1` ssbg_mode1 `u16 length || packet || zero
124
+ * padding` (ISO/IEC 23008-1 C.3.3): the length field alone delimits the
125
+ * protected packet, which is then parsed as an MMTP MPU packet. Failures are
126
+ * counted by reason (`bad_ssbg1_length` is the length/padding refusal), never
127
+ * thrown.
191
128
  *
192
- * @throws when `options.blockProfile` is absent or not a known profile token.
129
+ * @throws when `options.blockProfile` is absent or not `iso-ssbg1-v1`.
193
130
  */
194
131
  export function processFecSymbol(symbolData, options) {
195
- const blockProfile = parseFecBlockProfile(options?.blockProfile, "processFecSymbol options.blockProfile");
132
+ parseFecBlockProfile(options?.blockProfile, "processFecSymbol options.blockProfile");
196
133
  const failReasons = {};
197
134
  let failedCount = 0;
198
135
  const bump = (reason) => {
@@ -204,9 +141,7 @@ export function processFecSymbol(symbolData, options) {
204
141
  const index = options.index ?? 0;
205
142
  let parsed;
206
143
  try {
207
- parsed = blockProfile === "iso-ssbg1-v1"
208
- ? parseSsbg1Symbol(symbolData, index, bump)
209
- : parseKPaddedSymbol(symbolData, index, bump);
144
+ parsed = parseSsbg1Symbol(symbolData, index, bump);
210
145
  }
211
146
  catch {
212
147
  bump("exception");
@@ -214,19 +149,19 @@ export function processFecSymbol(symbolData, options) {
214
149
  }
215
150
  return resultFromSymbols(parsed ? [parsed] : [], failedCount, failReasons, options.ownerPacketId);
216
151
  }
217
- function requireSymbolSize(symbolSize, blockProfile) {
152
+ function requireSymbolSize(symbolSize) {
218
153
  if (symbolSize === undefined) {
219
154
  throw new Error("processFecBlock options.symbolSize is required: name the catalog fec.symbolSize (T)");
220
155
  }
221
156
  if (typeof symbolSize !== "number" || !Number.isSafeInteger(symbolSize) || symbolSize <= 0) {
222
157
  throw new Error(`processFecBlock options.symbolSize must be a positive integer (got ${String(symbolSize)})`);
223
158
  }
224
- if (blockProfile === "iso-ssbg1-v1" && symbolSize <= SSBG1_LENGTH_FIELD_BYTES) {
159
+ if (symbolSize <= SSBG1_LENGTH_FIELD_BYTES) {
225
160
  throw new Error(`processFecBlock options.symbolSize must exceed the ${SSBG1_LENGTH_FIELD_BYTES}-byte ssbg_mode1 length field (got ${symbolSize})`);
226
161
  }
227
162
  return symbolSize;
228
163
  }
229
- function requireSourceSymbolCount(k, blockLength, symbolSize, blockProfile) {
164
+ function requireSourceSymbolCount(k, blockLength, symbolSize) {
230
165
  if (k === undefined) {
231
166
  if (blockLength % symbolSize !== 0) {
232
167
  throw new Error(`processFecBlock: ${blockLength} bytes is not a whole number of ${symbolSize}-byte symbols; pass options.k`);
@@ -238,7 +173,7 @@ function requireSourceSymbolCount(k, blockLength, symbolSize, blockProfile) {
238
173
  }
239
174
  // An iso-ssbg1-v1 block is exactly K' = SSB_length symbols of T bytes
240
175
  // (C.5.3); any other length is not the block the repair symbols described.
241
- if (blockProfile === "iso-ssbg1-v1" && blockLength !== k * symbolSize) {
176
+ if (blockLength !== k * symbolSize) {
242
177
  throw new Error(`processFecBlock: an iso-ssbg1-v1 block of ${k} symbols of ${symbolSize} bytes is ${k * symbolSize} bytes (got ${blockLength})`);
243
178
  }
244
179
  return k;
@@ -247,24 +182,23 @@ function requireSourceSymbolCount(k, blockLength, symbolSize, blockProfile) {
247
182
  * Process a decoded FEC block into individual MFU fragments.
248
183
  *
249
184
  * The WASM RaptorQ decoder returns every source symbol of the block
250
- * concatenated (K x T bytes under `k-padded-v1`, SSB_length x T bytes under
251
- * `iso-ssbg1-v1`). This function splits them apart, recovers each protected
252
- * packet by the stream's block profile (see {@link processFecSymbol}),
253
- * extracts the MFU payload via shared extractMFUPayload, and returns
254
- * structured results sorted for reassembly.
185
+ * concatenated (SSB_length x T bytes). This function splits them apart,
186
+ * recovers each protected packet from its ssbg_mode1 length field (see
187
+ * {@link processFecSymbol}), extracts the MFU payload via shared
188
+ * extractMFUPayload, and returns structured results sorted for reassembly.
255
189
  *
256
190
  * @param blockData - Concatenated source symbols from the WASM decoder
257
191
  * @param options - Block profile and symbol size T are required; see {@link ProcessFecBlockOptions}
258
192
  * @throws when the block profile or symbol size is absent or invalid, when an
259
- * omitted `k` cannot be read exactly from the block length, or when an
260
- * `iso-ssbg1-v1` block is not exactly `k` symbols long.
193
+ * omitted `k` cannot be read exactly from the block length, or when the
194
+ * block is not exactly `k` symbols long.
261
195
  */
262
196
  export function processFecBlock(blockData, options) {
263
197
  const blockProfile = parseFecBlockProfile(options?.blockProfile, "processFecBlock options.blockProfile");
264
- const symbolSize = requireSymbolSize(options.symbolSize, blockProfile);
198
+ const symbolSize = requireSymbolSize(options.symbolSize);
265
199
  if (!blockData || blockData.length === 0)
266
200
  return emptyProcessResult();
267
- const k = requireSourceSymbolCount(options.k, blockData.length, symbolSize, blockProfile);
201
+ const k = requireSourceSymbolCount(options.k, blockData.length, symbolSize);
268
202
  const failReasons = {};
269
203
  let failedCount = 0;
270
204
  const parsed = [];
@@ -1 +1 @@
1
- {"version":3,"file":"block-processor.js","sourceRoot":"","sources":["../src/block-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACN,4BAA4B,EAC5B,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,eAAe,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C;IAC/C,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,MAAM,MAAM,GAAsB,EAAE,CAAC;IAErC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,CAAC,GAAG,UAAU,CAAC;QAChC,IAAI,QAAQ,IAAI,SAAS,CAAC,MAAM;YAAE,MAAM;QACxC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAEjE,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE;YACrE,YAAY;YACZ,KAAK,EAAE,CAAC;SACR,CAAC,CAAC;QACH,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YAClE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC;QAC1D,CAAC;QACD,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;AACnF,CAAC"}
@@ -8,17 +8,10 @@
8
8
  * It deliberately does NOT map MoQ media groups to FEC blocks. A recovered
9
9
  * packet's media group is read from its own MMTP/MPU header
10
10
  * ({@link recoveredPacketMediaGroup}), never from SBN arithmetic, and a source
11
- * symbol's block comes from the wire:
12
- *
13
- * - `k-padded-v1`: `SBN = floor(SS_ID / K)`, `ESI = SS_ID mod K`
14
- * ({@link FecBlockMapper.fromSsId}).
15
- * - `iso-ssbg1-v1`: a block is the SS_ID range `[SS_Start, SS_Start +
16
- * SSB_length)` its Repair FEC Payload ID states (ISO/IEC 23008-1 C.5.3), so
17
- * SS_ID alone locates nothing and `fromSsId` throws.
18
- *
19
- * Object FEC (draft-ramadan-moq-fec §9.1) is the one exception: there each MoQ
20
- * group IS its own FEC block, so {@link ObjectBlockMapper} keeps its identity
21
- * `derive`.
11
+ * symbol's block comes from the wire: under `iso-ssbg1-v1` a block is the SS_ID
12
+ * range `[SS_Start, SS_Start + SSB_length)` its Repair FEC Payload ID states
13
+ * (ISO/IEC 23008-1 C.5.3), so SS_ID alone locates nothing and `fromSsId`
14
+ * throws for every stream with an FEC instance.
22
15
  */
23
16
  import { type FecBlockProfile } from "@blockcast/mmt-base";
24
17
  /** Configuration from catalog FEC parameters. */
@@ -27,10 +20,7 @@ export interface FecBlockConfig {
27
20
  interleaveDepthMs: number;
28
21
  /** GOP/frame duration (milliseconds). Measured from actual MMTP timestamps. */
29
22
  gopDurationMs: number;
30
- /**
31
- * K from catalog fec.sourceSymbols: the source symbols per block under
32
- * `k-padded-v1`, the maximum SSB_length under `iso-ssbg1-v1`.
33
- */
23
+ /** K from catalog fec.sourceSymbols: the maximum SSB_length of a block. */
34
24
  k: number;
35
25
  /**
36
26
  * The catalog `fec.blockProfile`. Required and validated with
@@ -38,7 +28,7 @@ export interface FecBlockConfig {
38
28
  */
39
29
  blockProfile: FecBlockProfile;
40
30
  }
41
- /** FEC coordinates of one MoQ object, for the mappers whose groups are blocks. */
31
+ /** FEC coordinates of one MoQ object, for the mapper whose groups are blocks. */
42
32
  export interface FecCoordinates {
43
33
  /** Source Block Number */
44
34
  sbn: number;
@@ -76,7 +66,7 @@ interface NoFecInstanceConfig {
76
66
  export declare class FecBlockMapper {
77
67
  /** Media units (GOPs/frames) per FEC block, recovered with positive round-half-up semantics. */
78
68
  readonly d: number;
79
- /** K: source symbols per block (`k-padded-v1`) or the maximum SSB_length (`iso-ssbg1-v1`). */
69
+ /** K: the maximum SSB_length of a block (catalog `fec.sourceSymbols`). */
80
70
  readonly k: number;
81
71
  /** Block time span (ms) — used as pacing threshold */
82
72
  readonly interleaveDepthMs: number;
@@ -94,14 +84,13 @@ export declare class FecBlockMapper {
94
84
  */
95
85
  constructor(config: FecBlockConfig | NoFecInstanceConfig);
96
86
  /**
97
- * The `k-padded-v1` locator: SS_ID → (SBN, ESI) with `SBN = floor(SS_ID / K)`
98
- * and `ESI = SS_ID mod K`, for MMTP over multicast UDP where the Source FEC
99
- * Payload ID carries SS_ID directly.
87
+ * SS_ID → (SBN, ESI). Only {@link NullBlockMapper} answers: a stream with an
88
+ * FEC instance is `iso-ssbg1-v1`, whose blocks are located by
89
+ * `(SS_Start, SSB_length)` range membership and never from SS_ID alone.
100
90
  *
101
- * @throws under `iso-ssbg1-v1`, where a block is located by
102
- * `(SS_Start, SSB_length)` range membership and never from SS_ID alone
91
+ * @throws for every stream with an FEC instance
103
92
  */
104
- fromSsId(ssId: number): {
93
+ fromSsId(_ssId: number): {
105
94
  sbn: number;
106
95
  esi: number;
107
96
  };
@@ -137,53 +126,6 @@ export declare class NullBlockMapper extends FecBlockMapper {
137
126
  /** No FEC: nothing to wait for, so pacing never sleeps. */
138
127
  get pacingThresholdMs(): number;
139
128
  }
140
- /**
141
- * Object-level FEC (§9.1): each MoQ group (frame) is its own FEC block.
142
- * K_actual = ceil(frame_bytes / symbolSize) — varies per block.
143
- *
144
- * SBN = group_id, ESI = object_id.
145
- * SS_ID = Group_ID * sourceSymbols + Object_ID (§9.1.2).
146
- *
147
- * That SS_ID is the K-stride numbering of `k-padded-v1`; `iso-ssbg1-v1`
148
- * numbers SS_IDs consecutively per source packet (ISO/IEC 23008-1 C.5.2), so
149
- * §9.1 object FEC is defined only under `k-padded-v1` and the constructor
150
- * refuses any other profile.
151
- *
152
- * The stride of that numbering is the catalog `sourceSymbols`, never a
153
- * block's own K: a short block (K_actual < sourceSymbols) still starts at
154
- * `Group_ID * sourceSymbols` (its repair's SS_Start) and leaves the rest of
155
- * its stride unused, which is exactly `k-padded-v1` with `SSB_length =
156
- * K_actual`. So the SS_ID locator is the inherited
157
- * {@link FecBlockMapper.fromSsId} over `k = sourceSymbols`, the exact inverse
158
- * of {@link ObjectBlockMapper.derive}; it needs no per-block K and infers
159
- * nothing.
160
- *
161
- * This mapper does NOT carry per-block K. Each block discovers its own K from:
162
- * 1. Clean reception: counting source objects per group
163
- * 2. Repair packets: SSB_length in the Repair FEC Payload ID (ISO 23008-1 C.5.3)
164
- *
165
- * Callers MUST pass per-block K to FecBlockManager.addSourcePacket/addRepairPacket.
166
- * Created once per stream, GC'd on stream close (Effect cleanup).
167
- */
168
- export declare class ObjectBlockMapper extends FecBlockMapper {
169
- /** Catalog sourceSymbols (max K) — used ONLY for SS_ID encoding (§9.1.2).
170
- * Actual per-block K varies: K_actual = ceil(frame_bytes / symbolSize). */
171
- readonly sourceSymbolsMax: number;
172
- /**
173
- * @param gopDurationMs - GOP/frame duration (ms)
174
- * @param sourceSymbolsMax - Catalog `fec.sourceSymbols`
175
- * @param blockProfile - Catalog `fec.blockProfile`; must be `k-padded-v1`
176
- */
177
- constructor(gopDurationMs: number, sourceSymbolsMax: number, blockProfile: FecBlockProfile);
178
- /**
179
- * SBN = group_id, ESI = object_id. SS_ID per §9.1.2. Its inverse is the
180
- * inherited `fromSsId` (SBN = floor(SS_ID / sourceSymbols), ESI = SS_ID mod
181
- * sourceSymbols).
182
- */
183
- derive(groupId: number, objectId: number): FecCoordinates;
184
- /** One frame of latency: each frame is its own block. */
185
- get pacingThresholdMs(): number;
186
- }
187
129
  /**
188
130
  * Create a FecBlockMapper from catalog FEC config + measured GOP duration.
189
131
  *
@@ -191,8 +133,10 @@ export declare class ObjectBlockMapper extends FecBlockMapper {
191
133
  * {@link NullBlockMapper}; `fec.blockProfile` is not read, since a stream
192
134
  * without FEC names none.
193
135
  * - Otherwise `fec.blockProfile` is required (validated with
194
- * `parseFecBlockProfile`, throwing when absent or unknown), and
195
- * `mode: 'object'` → {@link ObjectBlockMapper}, else {@link FecBlockMapper}.
136
+ * `parseFecBlockProfile`, throwing unless it is `iso-ssbg1-v1`) and the
137
+ * result is a {@link FecBlockMapper}. `mode: 'object'` (per-group object
138
+ * FEC, SS_ID = Group_ID * K + Object_ID) throws: that numbering is the
139
+ * retired `k-padded-v1` stride, which `iso-ssbg1-v1` does not define.
196
140
  */
197
141
  export declare function createMapper(fecConfig: {
198
142
  interleaveDepthMs?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"fec-block-mapper.d.ts","sourceRoot":"","sources":["../src/fec-block-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAA;AAG5B,iDAAiD;AACjD,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,iBAAiB,EAAE,MAAM,CAAA;IACzB,+EAA+E;IAC/E,aAAa,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,CAAC,EAAE,MAAM,CAAA;IACT;;;OAGG;IACH,YAAY,EAAE,eAAe,CAAA;CAC9B;AAED,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAA;IACX,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAQpE;AAED;;;;;GAKG;AACH,QAAA,MAAM,eAAe,EAAE,OAAO,MAAkC,CAAA;AAEhE,2EAA2E;AAC3E,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,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