@blockcast/fec-worker 0.3.0-main.2515e5ca4858 → 0.3.0-main.2774791ffb52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -15
- package/dist/fec-worker-client.d.ts +4 -13
- package/dist/fec-worker-client.d.ts.map +1 -1
- package/dist/fec-worker-client.js +8 -35
- package/dist/fec-worker-client.js.map +1 -1
- package/dist/fec-worker-types.d.ts +16 -63
- package/dist/fec-worker-types.d.ts.map +1 -1
- package/dist/fec-worker-types.js +2 -2
- package/dist/fec-worker.js +4 -70
- package/dist/fec-worker.js.map +2 -2
- package/package.json +4 -7
- package/src/fec-worker-client.ts +6 -37
- package/src/fec-worker-types.ts +16 -63
- package/src/fec-worker.ts +8 -297
package/README.md
CHANGED
|
@@ -23,8 +23,7 @@ const client = new FecWorkerClient(workerUrl)
|
|
|
23
23
|
|
|
24
24
|
client.onFrame((data, meta) => {
|
|
25
25
|
// data is an ArrayBuffer transferred from the worker (zero-copy).
|
|
26
|
-
// meta tells you whether this frame was recovered via FEC
|
|
27
|
-
// configured) whether its source-packet trailer verified.
|
|
26
|
+
// meta tells you whether this frame was recovered via FEC.
|
|
28
27
|
decoder.decode(data) // hand off to WebCodecs / MSE
|
|
29
28
|
})
|
|
30
29
|
client.onSnapshot((stats) => fecPanel.render(stats))
|
|
@@ -46,7 +45,6 @@ const config: FecTrackConfig = {
|
|
|
46
45
|
interleaveMs: 1000, // 30 frames @ 30 fps
|
|
47
46
|
deliveryWindowMs: 2000, // computeFecDeliveryWindowMs(...) from the catalog
|
|
48
47
|
fecMode: "subframe",
|
|
49
|
-
altaEnabled: false,
|
|
50
48
|
relayBlockSigEnabled: false,
|
|
51
49
|
}
|
|
52
50
|
client.configure(config, mmtWasmModule)
|
|
@@ -98,7 +96,7 @@ This is the **Worker-per-track FEC pipeline** architectural decision tracked in
|
|
|
98
96
|
|
|
99
97
|
Buffers cross the boundary via the `Transferable` list. After `postMessage`, the sender's `ArrayBuffer` is detached — touching it throws. This is the contract that makes zero-copy safe: there is no aliased view that could be mutated mid-decode.
|
|
100
98
|
|
|
101
|
-
`WebAssembly.Module` is structured-cloneable (not transferable) and is *cloned* (cheap — the underlying compiled module is shared across realms).
|
|
99
|
+
`WebAssembly.Module` is structured-cloneable (not transferable) and is *cloned* (cheap — the underlying compiled module is shared across realms).
|
|
102
100
|
|
|
103
101
|
Errors that escape the worker's `try/catch` (in either the sync command path or the async configure path) are emitted as `{type: "error", message}` events rather than thrown — the main thread surfaces them through `onError`.
|
|
104
102
|
|
|
@@ -110,8 +108,8 @@ All messages are typed as discriminated unions in `fec-worker-types.ts`. Both th
|
|
|
110
108
|
|
|
111
109
|
| `type` | Payload | Transferred |
|
|
112
110
|
|--------|---------|-------------|
|
|
113
|
-
| `configure` | `config: FecTrackConfig`, `wasmModule: WebAssembly.Module
|
|
114
|
-
| `feedSource` | `ssId: number`, `data: ArrayBuffer`, `ts: number
|
|
111
|
+
| `configure` | `config: FecTrackConfig`, `wasmModule: WebAssembly.Module` | none — WASM modules are structured-cloned |
|
|
112
|
+
| `feedSource` | `ssId: number`, `data: ArrayBuffer`, `ts: number` | `data` |
|
|
115
113
|
| `feedRepair` | `ssStart: number`, `ssbLength: number`, `rsId: number`, `data: ArrayBuffer`, `ts: number` | `data` |
|
|
116
114
|
| `relayBlockSig` | `sbn: number`, `sig: ArrayBuffer`, `hash: ArrayBuffer` | `sig`, `hash` |
|
|
117
115
|
| `cleanup` | `sbns: number[]` (all timed-out blocks covered by this coalesced barrier) | none |
|
|
@@ -135,7 +133,7 @@ All messages are typed as discriminated unions in `fec-worker-types.ts`. Both th
|
|
|
135
133
|
|
|
136
134
|
The Worker posts `blockUpdate` only to a client that sent `subscribeBlockUpdates`: each one is a structured clone and a page-thread task, and the snapshot already counts every transition. `FecWorkerClient` subscribes when `onBlockUpdate` is registered and the Worker has announced the command. A Worker that predates the command posts `blockUpdate` unasked and is never sent it (BLO-36599).
|
|
137
135
|
|
|
138
|
-
`FrameMeta` carries `recovered: boolean` (this frame came out of the FEC decode, not the direct path), `sbn: number`, and
|
|
136
|
+
`FrameMeta` carries `recovered: boolean` (this frame came out of the FEC decode, not the direct path), `sbn: number`, and for recovered frames `esi` / `ssbLength`. Source provenance is verified upstream at router admission by `@blockcast/mmt-manifest-verify`, not in the Worker.
|
|
139
137
|
|
|
140
138
|
## Lifecycle
|
|
141
139
|
|
|
@@ -143,12 +141,11 @@ The Worker posts `blockUpdate` only to a client that sent `subscribeBlockUpdates
|
|
|
143
141
|
new FecWorkerClient(url)
|
|
144
142
|
│ worker spawned with { type: "module" }
|
|
145
143
|
▼
|
|
146
|
-
client.configure(config, wasmModule
|
|
144
|
+
client.configure(config, wasmModule)
|
|
147
145
|
│ worker initSyncs WASM, instantiates MmtFecDecoder(interleaveDepth, blockProfile),
|
|
148
146
|
│ refuses a decoder whose get_block_profile() differs,
|
|
149
147
|
│ immediately configures exact catalog K/T (no decoder defaults),
|
|
150
|
-
│
|
|
151
|
-
│ from catalog values, throws if any of K / D / interleaveMs ≤ 0,
|
|
148
|
+
│ rejects invalid geometry or negative spans; zero keeps in-band FEC,
|
|
152
149
|
│ starts the 200 ms snapshot timer, emits initial snapshot
|
|
153
150
|
▼
|
|
154
151
|
client.feedSource(...) / feedRepair(...) ◄── steady state
|
|
@@ -166,8 +163,8 @@ client.cleanup(sbn) ◄── per-block inactivity
|
|
|
166
163
|
│ any block still in "collecting" at eviction time is counted as failed
|
|
167
164
|
▼
|
|
168
165
|
client.dispose()
|
|
169
|
-
sends {type:"dispose"}, terminates worker. WASM decoder
|
|
170
|
-
|
|
166
|
+
sends {type:"dispose"}, terminates worker. The WASM decoder is
|
|
167
|
+
explicitly free()'d before terminate so its linear
|
|
171
168
|
memory is released (FinalizationRegistry would not run between
|
|
172
169
|
dispose and terminate). Idempotent.
|
|
173
170
|
```
|
|
@@ -194,9 +191,8 @@ The `snapshot` event delivers a `FecTrackStats` every 200 ms (catalog-derived; n
|
|
|
194
191
|
| `blocks` | Up to `max(D × 3, 24)` recent `FecBlockSnapshot`s for live visualization |
|
|
195
192
|
| `interleaveWindowBlocks` | `D` from config |
|
|
196
193
|
|
|
197
|
-
The three `sourceDropped*` counters split by cause
|
|
194
|
+
The three `sourceDropped*` counters split by cause so a dashboard can tell the failure modes apart. They are tested in a fixed order, each returning early — `Retired` → `Terminal` → `Duplicate` — so a symbol counts once, under the **first** cause that matches: a symbol that is both past retention and a repeat counts only as `Retired`, and `Terminal` absorbs every post-settle duplicate. A block that settles at K-1 source symbols (BLO-35597 defect 2) is explained by a late symbol past retention (`Retired`), a symbol for a block that had already settled — complete, recovered **or failed** (`Terminal`), or a repeated SS_ID (`Duplicate`). `Retired` and `Terminal` narrow the cause; they do not attribute it. `Duplicate` does: it cannot fire once a block settles — the `Terminal` check returns first, and `markBlockTerminal` retires the block's accepted-ESI set anyway — so a non-zero `Duplicate` is positive evidence that a repeated SS_ID reached the worker while the block was **still collecting** — a duplicate packet on the wire (an ESI is the SS_ID's serial distance from SS_Start, so no derivation can collide). It attributes the **timing**, not the origin. A symbol lost in transit never reaches the worker and increments nothing, so **all three reading zero is not evidence of a publisher defect** — wire loss produces an identical shape. Separate those with `FecBlockSnapshot.ssbLength`: below `k` is a genuinely short authored block, equal to `k` with fewer accepted is loss-or-late, undefined (no repair symbol yet) leaves both open. All three are cumulative across decoder epochs, so they stay comparable against the `sourceSymbols` denominator; only a reset zeroes them.
|
|
198
195
|
|
|
199
|
-
When ALTA is enabled, the snapshot also carries the four-state verification accounting — `altaVerified` (crypto passed), `altaFailed` (tamper-confirmed), `altaPending` (unverifiable, e.g. missing trailer / late-joiner anchor gap), `altaError` (verifier threw — infrastructure flake, not tamper) — plus `altaInitFailed` (true if the ALTA WASM didn't initialize), `altaPendingEvictedCap` / `altaPendingEvictedTtl` (deferred-queue eviction reasons), and a bounded `altaFailedDetails[]` ring with the last ≤16 tamper events. The four-way split exists so ops alerting can distinguish a network problem (`altaPending` rising) from an attack (`altaFailed` rising) from a runtime bug (`altaError` rising).
|
|
200
196
|
|
|
201
197
|
`FecTrackStats` is also the shape consumed downstream by `@blockcast/mmt-container`'s `CmcdProducer` and the diagnostics `fec-panel` — keep it stable when you extend it.
|
|
202
198
|
|
|
@@ -204,7 +200,6 @@ When ALTA is enabled, the snapshot also carries the four-state verification acco
|
|
|
204
200
|
|
|
205
201
|
- **`@blockcast/mmt-fec`** — the wrapped library. Container-agnostic RaptorQ decoder + block manager + reorder buffer. Lives on the main thread when you don't need a Worker; this package is the off-thread variant of the same decoder.
|
|
206
202
|
- **`@blockcast/mmt-container`** — the consumer that wires this Worker into the data path. `FecManager` instantiates one `FecWorkerClient` per track, routes MMTP source/repair payloads in, and pumps recovered frames into the MFU reassembler / fmp4 segmenter.
|
|
207
|
-
- **`@blockcast/mmt-alta-parse`** — ALTA trailer extraction. Used inside the Worker to parse the `[0xF0A1][len][auth]` trailer off recovered source symbols (publisher-stripped trailers don't appear on direct-source packets, which carry the trailer in band).
|
|
208
203
|
|
|
209
204
|
## Testing
|
|
210
205
|
|
|
@@ -17,26 +17,17 @@ export declare class FecWorkerClient {
|
|
|
17
17
|
constructor(workerOrUrl: Worker | URL);
|
|
18
18
|
/**
|
|
19
19
|
* Configure the Worker with FEC parameters and WASM module.
|
|
20
|
+
* `interleaveMs: 0` is a valid no-span catalog value; in that mode the
|
|
21
|
+
* caller supplies a positive receiver-local `deliveryWindowMs`.
|
|
20
22
|
* wasmModule is transferred (not neutered — WebAssembly.Module is shareable).
|
|
21
|
-
* altaPublicKey is PKCS#8 SPKI DER bytes (self-describing — algorithm detected from OID).
|
|
22
|
-
* Transferred (detached from sender).
|
|
23
|
-
* altaWasmModule is structured-cloneable (NOT transferable — do not add to transfer list).
|
|
24
23
|
*/
|
|
25
|
-
configure(config: FecTrackConfig, wasmModule: WebAssembly.Module
|
|
24
|
+
configure(config: FecTrackConfig, wasmModule: WebAssembly.Module): void;
|
|
26
25
|
/**
|
|
27
26
|
* Feed a source symbol to the Worker. data ArrayBuffer is transferred (zero-copy).
|
|
28
27
|
* Caller must not access data after this call — it is transferred with the
|
|
29
28
|
* task's symbol batch, before any later command of this client.
|
|
30
|
-
*
|
|
31
|
-
* Optional `alta` carries the detached ALTA authenticator bytes and the
|
|
32
|
-
* byte offset in `data` where the signed payload ends. The auth buffer is
|
|
33
|
-
* transferred zero-copy alongside `data`. Use {@link getMmtpAltaTrailer}
|
|
34
|
-
* upstream (mmtp-router) to extract it from the wire packet.
|
|
35
29
|
*/
|
|
36
|
-
feedSource(ssId: number, data: ArrayBuffer, ts: number
|
|
37
|
-
auth: ArrayBuffer;
|
|
38
|
-
payloadEnd: number;
|
|
39
|
-
}): void;
|
|
30
|
+
feedSource(ssId: number, data: ArrayBuffer, ts: number): void;
|
|
40
31
|
/**
|
|
41
32
|
* Feed a repair symbol to the Worker. data ArrayBuffer is transferred (zero-copy).
|
|
42
33
|
* Caller must not access data after this call — it is detached.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fec-worker-client.d.ts","sourceRoot":"","sources":["../src/fec-worker-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAIX,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,kBAAkB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,eAAe;;IA2B3B;;;OAGG;gBACS,WAAW,EAAE,MAAM,GAAG,GAAG;IAgBrC
|
|
1
|
+
{"version":3,"file":"fec-worker-client.d.ts","sourceRoot":"","sources":["../src/fec-worker-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAIX,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,kBAAkB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,eAAe;;IA2B3B;;;OAGG;gBACS,WAAW,EAAE,MAAM,GAAG,GAAG;IAgBrC;;;;;OAKG;IACH,SAAS,CACR,MAAM,EAAE,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}
|
|
55
55
|
/**
|
|
56
56
|
* Configure the Worker with FEC parameters and WASM module.
|
|
57
|
+
* `interleaveMs: 0` is a valid no-span catalog value; in that mode the
|
|
58
|
+
* caller supplies a positive receiver-local `deliveryWindowMs`.
|
|
57
59
|
* wasmModule is transferred (not neutered — WebAssembly.Module is shareable).
|
|
58
|
-
* altaPublicKey is PKCS#8 SPKI DER bytes (self-describing — algorithm detected from OID).
|
|
59
|
-
* Transferred (detached from sender).
|
|
60
|
-
* altaWasmModule is structured-cloneable (NOT transferable — do not add to transfer list).
|
|
61
60
|
*/
|
|
62
|
-
configure(config, wasmModule
|
|
61
|
+
configure(config, wasmModule) {
|
|
63
62
|
if (this.#disposed)
|
|
64
63
|
throw new Error("[FecWorkerClient] disposed");
|
|
65
64
|
this.#flushSymbols();
|
|
@@ -67,44 +66,20 @@ export class FecWorkerClient {
|
|
|
67
66
|
type: "configure",
|
|
68
67
|
config,
|
|
69
68
|
wasmModule,
|
|
70
|
-
altaPublicKey,
|
|
71
|
-
altaWasmModule,
|
|
72
69
|
};
|
|
73
70
|
// WebAssembly.Module is structured-cloneable, NOT transferable.
|
|
74
71
|
// Pass it in the message body (Chrome clones it automatically).
|
|
75
|
-
|
|
76
|
-
const transferList = [];
|
|
77
|
-
if (altaPublicKey)
|
|
78
|
-
transferList.push(altaPublicKey);
|
|
79
|
-
// altaWasmModule is structured-cloneable — NOT added to transferList
|
|
80
|
-
this.#worker.postMessage(cmd, transferList);
|
|
72
|
+
this.#worker.postMessage(cmd);
|
|
81
73
|
}
|
|
82
74
|
/**
|
|
83
75
|
* Feed a source symbol to the Worker. data ArrayBuffer is transferred (zero-copy).
|
|
84
76
|
* Caller must not access data after this call — it is transferred with the
|
|
85
77
|
* task's symbol batch, before any later command of this client.
|
|
86
|
-
*
|
|
87
|
-
* Optional `alta` carries the detached ALTA authenticator bytes and the
|
|
88
|
-
* byte offset in `data` where the signed payload ends. The auth buffer is
|
|
89
|
-
* transferred zero-copy alongside `data`. Use {@link getMmtpAltaTrailer}
|
|
90
|
-
* upstream (mmtp-router) to extract it from the wire packet.
|
|
91
78
|
*/
|
|
92
|
-
feedSource(ssId, data, ts
|
|
79
|
+
feedSource(ssId, data, ts) {
|
|
93
80
|
if (this.#disposed)
|
|
94
81
|
throw new Error("[FecWorkerClient] feedSource on a disposed client");
|
|
95
|
-
|
|
96
|
-
this.#queueSymbol({
|
|
97
|
-
type: "feedSource",
|
|
98
|
-
ssId,
|
|
99
|
-
data,
|
|
100
|
-
ts,
|
|
101
|
-
altaAuth: alta.auth,
|
|
102
|
-
altaPayloadEnd: alta.payloadEnd,
|
|
103
|
-
}, data, alta.auth);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
this.#queueSymbol({ type: "feedSource", ssId, data, ts }, data);
|
|
107
|
-
}
|
|
82
|
+
this.#queueSymbol({ type: "feedSource", ssId, data, ts }, data);
|
|
108
83
|
}
|
|
109
84
|
/**
|
|
110
85
|
* Feed a repair symbol to the Worker. data ArrayBuffer is transferred (zero-copy).
|
|
@@ -120,15 +95,13 @@ export class FecWorkerClient {
|
|
|
120
95
|
throw new Error("[FecWorkerClient] feedRepair on a disposed client");
|
|
121
96
|
this.#queueSymbol({ type: "feedRepair", ssStart, ssbLength, rsId, data, ts }, data);
|
|
122
97
|
}
|
|
123
|
-
#queueSymbol(symbol, data
|
|
98
|
+
#queueSymbol(symbol, data) {
|
|
124
99
|
if (!this.#batchSymbols) {
|
|
125
|
-
this.#worker.postMessage(symbol,
|
|
100
|
+
this.#worker.postMessage(symbol, [data]);
|
|
126
101
|
return;
|
|
127
102
|
}
|
|
128
103
|
this.#pendingSymbols.push(symbol);
|
|
129
104
|
this.#pendingTransfer.push(data);
|
|
130
|
-
if (auth)
|
|
131
|
-
this.#pendingTransfer.push(auth);
|
|
132
105
|
if (this.#flushQueued)
|
|
133
106
|
return;
|
|
134
107
|
this.#flushQueued = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fec-worker-client.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AM,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAmB;IACpD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,MAAM,MAAM,GACX,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClB,IAAI,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5C,KAAK,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAC/C,OAAO,4DAA4D,MAAM,EAAE,CAAC;AAC7E,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @blockcast/fec-worker — Shared Type Definitions
|
|
3
3
|
*
|
|
4
4
|
* Defines the Worker message protocol (commands/events), FecTrackStats shape
|
|
5
|
-
* consumed by fec-panel (Phase 5) and CmcdProducer (Phase 6), and
|
|
6
|
-
*
|
|
5
|
+
* consumed by fec-panel (Phase 5) and CmcdProducer (Phase 6), and the relay
|
|
6
|
+
* block signature stub.
|
|
7
7
|
*
|
|
8
8
|
* Types here are importable from both main thread and Worker contexts.
|
|
9
9
|
*/
|
|
@@ -54,16 +54,22 @@ export interface FecTrackConfig {
|
|
|
54
54
|
* Never assign `deriveFecInterleaveDepth()` here — that returns media units
|
|
55
55
|
* per block, which is a different quantity (BLO-35597). */
|
|
56
56
|
interleaveDepth: number;
|
|
57
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Catalog interleave span in integer milliseconds. A positive value is the complete
|
|
59
|
+
* source-plus-repair span; zero represents an absent/zero catalog span and
|
|
60
|
+
* carries no elapsed-time deadline.
|
|
61
|
+
*/
|
|
58
62
|
interleaveMs: number;
|
|
59
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Positive cleanup budget. For a positive `interleaveMs` this is the
|
|
65
|
+
* catalog span plus its explicit reorder allowance. For zero it is a
|
|
66
|
+
* receiver-local bound only, never an inferred catalog deadline.
|
|
67
|
+
*/
|
|
60
68
|
deliveryWindowMs: number;
|
|
61
69
|
/** FEC encoding mode */
|
|
62
70
|
fecMode: "subframe" | "object";
|
|
63
71
|
/** MoQ repair track name (optional) */
|
|
64
72
|
repairTrack?: string;
|
|
65
|
-
/** Whether ALTA publisher auth is enabled (AUTH-01) */
|
|
66
|
-
altaEnabled: boolean;
|
|
67
73
|
/** Whether relay block signature verification is enabled (AUTH-01) */
|
|
68
74
|
relayBlockSigEnabled: boolean;
|
|
69
75
|
}
|
|
@@ -92,10 +98,11 @@ export interface FecBlockSnapshot {
|
|
|
92
98
|
lastSymbolTs: number;
|
|
93
99
|
/** Timestamp when block completed (ms), undefined if not yet complete */
|
|
94
100
|
completedTs?: number;
|
|
95
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Cleanup timestamp (ms). It is the catalog completion deadline when
|
|
103
|
+
* `config.interleaveMs > 0`, and a local retention timestamp otherwise.
|
|
104
|
+
*/
|
|
96
105
|
deadlineTs: number;
|
|
97
|
-
/** Count of source symbols with valid ALTA signature (AUTH-02) */
|
|
98
|
-
altaVerified: number;
|
|
99
106
|
/** Relay block signature validity: true/false after verification, null if not yet verified (AUTH-02) */
|
|
100
107
|
relayBlockSigValid: boolean | null;
|
|
101
108
|
}
|
|
@@ -115,38 +122,6 @@ export interface FecTrackStats {
|
|
|
115
122
|
blocksFailed: number;
|
|
116
123
|
/** Recovery success rate 0-100 */
|
|
117
124
|
recoveryRate: number;
|
|
118
|
-
/** Packets with valid publisher ALTA signature */
|
|
119
|
-
altaVerified: number;
|
|
120
|
-
/** Packets with MAC / signature / hash-chain mismatch (tamper-confirmed) */
|
|
121
|
-
altaFailed: number;
|
|
122
|
-
/** Packets that couldn't be verified due to missing trailer / not-ready verifier /
|
|
123
|
-
* late-joiner bootstrap gap. Neither tamper nor error — just unverifiable. */
|
|
124
|
-
altaPending: number;
|
|
125
|
-
/** Deferred-queue entries evicted by cap (queue full). Separate counter so
|
|
126
|
-
* cap misconfiguration is distinguishable from natural bootstrap-gap noise. */
|
|
127
|
-
altaPendingEvictedCap: number;
|
|
128
|
-
/** Deferred-queue entries evicted by TTL (retry window expired). */
|
|
129
|
-
altaPendingEvictedTtl: number;
|
|
130
|
-
/** verifyDetached / parse threw an exception (WASM trap, OOM, unmarshal panic).
|
|
131
|
-
* Not counted as altaFailed because the cause isn't crypto — helps ops
|
|
132
|
-
* distinguish infrastructure flake from tamper. */
|
|
133
|
-
altaError: number;
|
|
134
|
-
/** True if ALTA was enabled at configure time but the verifier WASM init
|
|
135
|
-
* failed. Ops alerting should treat this as "ALTA disabled due to error",
|
|
136
|
-
* distinct from "ALTA disabled by config" (altaEnabled flag not present). */
|
|
137
|
-
altaInitFailed: boolean;
|
|
138
|
-
/** Diagnostic: last ≤16 altaFailed events with full context (seq, error
|
|
139
|
-
* string from the verifier, auth+payload lengths, and which code path
|
|
140
|
-
* raised the failure). Bounded so it can't blow memory. Intended for
|
|
141
|
-
* investigation — not a stable API; consumers should treat it as
|
|
142
|
-
* opt-in and defensive (may be undefined). */
|
|
143
|
-
altaFailedDetails?: Array<{
|
|
144
|
-
seq: number;
|
|
145
|
-
error: string;
|
|
146
|
-
authLen: number;
|
|
147
|
-
payloadLen: number;
|
|
148
|
-
path: string;
|
|
149
|
-
}>;
|
|
150
125
|
/** Blocks with valid relay signature */
|
|
151
126
|
relayBlocksVerified: number;
|
|
152
127
|
/** Blocks with invalid relay signature */
|
|
@@ -230,8 +205,6 @@ export type FecWorkerErrorCode = "recovered-symbol-size-unconfigured" | "recover
|
|
|
230
205
|
| "recovered-block-unplaced" | "reset-failed" | "unknown-command" | "command-failed" | "worker-runtime" | "worker-message";
|
|
231
206
|
/** Per-frame metadata emitted with frame events from Worker. */
|
|
232
207
|
export interface FrameMeta {
|
|
233
|
-
/** ALTA verification result: true/false after check, null when ALTA not configured (AUTH-04) */
|
|
234
|
-
altaVerified: boolean | null;
|
|
235
208
|
/** Whether this frame was recovered via FEC (not received directly) */
|
|
236
209
|
recovered: boolean;
|
|
237
210
|
/** Block key this frame belongs to: the block's SS_Start */
|
|
@@ -253,14 +226,6 @@ export type FecWorkerCommand = {
|
|
|
253
226
|
type: "configure";
|
|
254
227
|
config: FecTrackConfig;
|
|
255
228
|
wasmModule: WebAssembly.Module;
|
|
256
|
-
/**
|
|
257
|
-
* ALTA public key as PKCS#8 SubjectPublicKeyInfo DER bytes (self-describing).
|
|
258
|
-
* Algorithm (Ed25519 or ECDSA P-256) is auto-detected from the SPKI OID.
|
|
259
|
-
* Ed25519 SPKI is 44 bytes; P-256 uncompressed is 91 bytes.
|
|
260
|
-
*/
|
|
261
|
-
altaPublicKey?: ArrayBuffer;
|
|
262
|
-
/** Pre-compiled ALTA WASM module. Structured-cloneable (NOT transferable) — do not add to transfer list. */
|
|
263
|
-
altaWasmModule?: WebAssembly.Module;
|
|
264
229
|
} | {
|
|
265
230
|
type: "feedSource";
|
|
266
231
|
/** Flat 32-bit Source Symbol ID from the MMTP Source FEC Payload ID
|
|
@@ -272,18 +237,6 @@ export type FecWorkerCommand = {
|
|
|
272
237
|
* most T-2 bytes). */
|
|
273
238
|
data: ArrayBuffer;
|
|
274
239
|
ts: number;
|
|
275
|
-
/** Optional ALTA authenticator bytes (detached mode — 08-07 MMTP
|
|
276
|
-
* trailer). Present when the source packet carried a
|
|
277
|
-
* `[0xF0A1][len][auth]` trailer and ALTA is enabled at the worker.
|
|
278
|
-
* When omitted, the worker skips verification and the packet
|
|
279
|
-
* counts as `altaPending`. */
|
|
280
|
-
altaAuth?: ArrayBuffer;
|
|
281
|
-
/** Byte offset within `data` where the signed MMTP payload ends
|
|
282
|
-
* (== where the trailer began on the wire). Required when
|
|
283
|
-
* `altaAuth` is present. Worker constructs
|
|
284
|
-
* `payload = new Uint8Array(data, 0, altaPayloadEnd)` for
|
|
285
|
-
* `verifyDetached(altaAuth, payload)`. */
|
|
286
|
-
altaPayloadEnd?: number;
|
|
287
240
|
} | {
|
|
288
241
|
type: "feedRepair";
|
|
289
242
|
/** SS_Start: SS_ID of the first source symbol in the block, from the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fec-worker-types.d.ts","sourceRoot":"","sources":["../src/fec-worker-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC;AAE7C,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC9B,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC;IAC7B,2CAA2C;IAC3C,UAAU,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,YAAY,EAAE,eAAe,CAAC;IAC9B,wFAAwF;IACxF,CAAC,EAAE,MAAM,CAAC;IACV,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;gEAM4D;IAC5D,eAAe,EAAE,MAAM,CAAC;IACxB
|
|
1
|
+
{"version":3,"file":"fec-worker-types.d.ts","sourceRoot":"","sources":["../src/fec-worker-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;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AM,EAAE,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE;AAC3B;;;;;GAKG;GACD;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,wBAAwB,EAAE,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAEjE,uEAAuE;AACvE,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG,uBAAuB,CAAC"}
|
package/dist/fec-worker-types.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @blockcast/fec-worker — Shared Type Definitions
|
|
3
3
|
*
|
|
4
4
|
* Defines the Worker message protocol (commands/events), FecTrackStats shape
|
|
5
|
-
* consumed by fec-panel (Phase 5) and CmcdProducer (Phase 6), and
|
|
6
|
-
*
|
|
5
|
+
* consumed by fec-panel (Phase 5) and CmcdProducer (Phase 6), and the relay
|
|
6
|
+
* block signature stub.
|
|
7
7
|
*
|
|
8
8
|
* Types here are importable from both main thread and Worker contexts.
|
|
9
9
|
*/
|
package/dist/fec-worker.js
CHANGED
|
@@ -33,8 +33,6 @@ function isoBlocksBehind(a, b, kMax) {
|
|
|
33
33
|
// src/fec-worker.ts
|
|
34
34
|
var wasmDecoder = null;
|
|
35
35
|
var config = null;
|
|
36
|
-
var altaEnabled = false;
|
|
37
|
-
var altaVerifier = null;
|
|
38
36
|
var snapshotTimer = null;
|
|
39
37
|
var blockUpdatesSubscribed = false;
|
|
40
38
|
var blocks = /* @__PURE__ */ new Map();
|
|
@@ -53,14 +51,6 @@ var repairSymbols = 0;
|
|
|
53
51
|
var blocksComplete = 0;
|
|
54
52
|
var blocksRecovered = 0;
|
|
55
53
|
var blocksFailed = 0;
|
|
56
|
-
var altaVerified = 0;
|
|
57
|
-
var altaFailed = 0;
|
|
58
|
-
var altaFailedDetails = [];
|
|
59
|
-
var altaPending = 0;
|
|
60
|
-
var altaPendingEvictedCap = 0;
|
|
61
|
-
var altaPendingEvictedTtl = 0;
|
|
62
|
-
var altaError = 0;
|
|
63
|
-
var altaInitFailed = false;
|
|
64
54
|
var relayBlocksVerified = 0;
|
|
65
55
|
var relayBlocksFailed = 0;
|
|
66
56
|
var liveSbn = 0;
|
|
@@ -71,9 +61,6 @@ var sourceDroppedTerminal = 0;
|
|
|
71
61
|
var sourceDroppedDuplicate = 0;
|
|
72
62
|
var sourceUnplacedRetired = 0;
|
|
73
63
|
var recoveryTimes = [];
|
|
74
|
-
var pendingVerify = /* @__PURE__ */ new Map();
|
|
75
|
-
var pendingVerifyCap = 0;
|
|
76
|
-
var pendingVerifyTtlMs = 0;
|
|
77
64
|
function emit(event, transfer) {
|
|
78
65
|
self.postMessage(event, transfer ?? []);
|
|
79
66
|
}
|
|
@@ -92,7 +79,6 @@ function clearBlockTracking() {
|
|
|
92
79
|
acceptedSourceEsis.clear();
|
|
93
80
|
acceptedRepairEsis.clear();
|
|
94
81
|
unplacedSources.clear();
|
|
95
|
-
pendingVerify.clear();
|
|
96
82
|
recoveryTimes.length = 0;
|
|
97
83
|
liveSbn = 0;
|
|
98
84
|
liveSbnKnown = false;
|
|
@@ -171,8 +157,9 @@ function getOrCreateBlock(sbn, isoSsbLength) {
|
|
|
171
157
|
repairCount: config.repairCount,
|
|
172
158
|
firstSymbolTs: now,
|
|
173
159
|
lastSymbolTs: now,
|
|
160
|
+
// A positive interleaveMs makes this the catalog completion deadline;
|
|
161
|
+
// zero makes deliveryWindowMs a receiver-local cleanup bound.
|
|
174
162
|
deadlineTs: now + config.deliveryWindowMs,
|
|
175
|
-
altaVerified: 0,
|
|
176
163
|
relayBlockSigValid: null
|
|
177
164
|
};
|
|
178
165
|
if (isoSsbLength !== void 0) block.ssbLength = isoSsbLength;
|
|
@@ -207,15 +194,6 @@ function buildStatsSnapshot() {
|
|
|
207
194
|
recoveryRate: blocksComplete + blocksRecovered > 0 ? Math.round(
|
|
208
195
|
blocksRecovered / (blocksRecovered + blocksFailed) * 100
|
|
209
196
|
) || 0 : 0,
|
|
210
|
-
altaVerified,
|
|
211
|
-
altaFailed,
|
|
212
|
-
altaPending,
|
|
213
|
-
altaPendingEvictedCap,
|
|
214
|
-
altaPendingEvictedTtl,
|
|
215
|
-
altaError,
|
|
216
|
-
altaInitFailed,
|
|
217
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
218
|
-
altaFailedDetails: altaFailedDetails.slice(),
|
|
219
197
|
relayBlocksVerified,
|
|
220
198
|
relayBlocksFailed,
|
|
221
199
|
liveSbn,
|
|
@@ -270,11 +248,8 @@ function emitRecoveredSymbols(sbn, recoveredBlock, block) {
|
|
|
270
248
|
});
|
|
271
249
|
continue;
|
|
272
250
|
}
|
|
273
|
-
const recoveredAltaVerified = null;
|
|
274
|
-
if (altaEnabled) altaPending++;
|
|
275
251
|
const buf = toOwnedArrayBuffer(symbol);
|
|
276
252
|
const meta = {
|
|
277
|
-
altaVerified: recoveredAltaVerified,
|
|
278
253
|
recovered: true,
|
|
279
254
|
sbn,
|
|
280
255
|
esi: i,
|
|
@@ -387,7 +362,6 @@ function feedIsoSource(cmd, view, decoder, cfg) {
|
|
|
387
362
|
advanceMediaHorizon(cmd.ssId);
|
|
388
363
|
unplacedSources.set(cmd.ssId, performance.now());
|
|
389
364
|
sourceSymbols++;
|
|
390
|
-
if (altaEnabled) altaPending++;
|
|
391
365
|
if (result2 && result2.byteLength > 0) {
|
|
392
366
|
emit({
|
|
393
367
|
type: "error",
|
|
@@ -418,7 +392,6 @@ function feedIsoSource(cmd, view, decoder, cfg) {
|
|
|
418
392
|
block.sourceReceived++;
|
|
419
393
|
block.lastSymbolTs = performance.now();
|
|
420
394
|
sourceSymbols++;
|
|
421
|
-
if (altaEnabled) altaPending++;
|
|
422
395
|
settleSourceArrival(key, block, result);
|
|
423
396
|
}
|
|
424
397
|
function findOverlappingIsoBlock(ssStart, ssbLength) {
|
|
@@ -499,9 +472,9 @@ async function handleConfigure(cmd) {
|
|
|
499
472
|
`[FecWorker] configure: interleaveDepth must be an integer in 1..${MAX_INTERLEAVE_DEPTH} (got ${cmd.config.interleaveDepth})`
|
|
500
473
|
);
|
|
501
474
|
}
|
|
502
|
-
if (!Number.isFinite(cmd.config.interleaveMs) || cmd.config.interleaveMs
|
|
475
|
+
if (!Number.isFinite(cmd.config.interleaveMs) || !Number.isSafeInteger(cmd.config.interleaveMs) || cmd.config.interleaveMs < 0) {
|
|
503
476
|
throw new Error(
|
|
504
|
-
`[FecWorker] configure: interleaveMs must be finite
|
|
477
|
+
`[FecWorker] configure: interleaveMs must be a finite non-negative integer (got ${cmd.config.interleaveMs})`
|
|
505
478
|
);
|
|
506
479
|
}
|
|
507
480
|
if (!Number.isFinite(cmd.config.deliveryWindowMs) || cmd.config.deliveryWindowMs <= 0) {
|
|
@@ -528,28 +501,6 @@ async function handleConfigure(cmd) {
|
|
|
528
501
|
verifyDecoderProfile(decoder, blockProfile);
|
|
529
502
|
wasmDecoder = decoder;
|
|
530
503
|
config = cmd.config;
|
|
531
|
-
altaEnabled = !!cmd.altaPublicKey;
|
|
532
|
-
pendingVerifyCap = Math.ceil(config.interleaveDepth * 1.5);
|
|
533
|
-
pendingVerifyTtlMs = Math.ceil(config.interleaveMs * config.k * 1.5);
|
|
534
|
-
altaVerifier = null;
|
|
535
|
-
altaInitFailed = false;
|
|
536
|
-
if (cmd.altaPublicKey && cmd.altaWasmModule) {
|
|
537
|
-
try {
|
|
538
|
-
const altaGlueUrl = "/wasm/alta/alta_rs.js";
|
|
539
|
-
const altaGlue = await import(
|
|
540
|
-
/* webpackIgnore: true */
|
|
541
|
-
altaGlueUrl
|
|
542
|
-
);
|
|
543
|
-
altaGlue.initSync({ module: cmd.altaWasmModule });
|
|
544
|
-
const keyBytes = new Uint8Array(cmd.altaPublicKey);
|
|
545
|
-
altaVerifier = new altaGlue.JsAltaVerifier(keyBytes);
|
|
546
|
-
} catch (e) {
|
|
547
|
-
console.warn("[FecWorker] ALTA WASM init failed, verification disabled:", e);
|
|
548
|
-
altaVerifier = null;
|
|
549
|
-
altaEnabled = false;
|
|
550
|
-
altaInitFailed = true;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
504
|
wasmDecoder.configure_params(config.k, config.symbolSize);
|
|
554
505
|
emit({ type: "capabilities", commands: ["feedSymbols", "subscribeBlockUpdates"] });
|
|
555
506
|
startSnapshotTimer();
|
|
@@ -637,20 +588,10 @@ function handleDispose() {
|
|
|
637
588
|
clearInterval(snapshotTimer);
|
|
638
589
|
snapshotTimer = null;
|
|
639
590
|
}
|
|
640
|
-
if (altaVerifier) {
|
|
641
|
-
try {
|
|
642
|
-
altaVerifier.free();
|
|
643
|
-
} catch (_e) {
|
|
644
|
-
}
|
|
645
|
-
altaVerifier = null;
|
|
646
|
-
}
|
|
647
591
|
if (wasmDecoder) {
|
|
648
592
|
wasmDecoder.free();
|
|
649
593
|
wasmDecoder = null;
|
|
650
594
|
}
|
|
651
|
-
pendingVerify.clear();
|
|
652
|
-
pendingVerifyCap = 0;
|
|
653
|
-
pendingVerifyTtlMs = 0;
|
|
654
595
|
config = null;
|
|
655
596
|
clearBlockTracking();
|
|
656
597
|
}
|
|
@@ -672,13 +613,6 @@ function handleReset() {
|
|
|
672
613
|
blocksComplete = 0;
|
|
673
614
|
blocksRecovered = 0;
|
|
674
615
|
blocksFailed = 0;
|
|
675
|
-
altaVerified = 0;
|
|
676
|
-
altaFailed = 0;
|
|
677
|
-
altaFailedDetails.length = 0;
|
|
678
|
-
altaPending = 0;
|
|
679
|
-
altaPendingEvictedCap = 0;
|
|
680
|
-
altaPendingEvictedTtl = 0;
|
|
681
|
-
altaError = 0;
|
|
682
616
|
relayBlocksVerified = 0;
|
|
683
617
|
relayBlocksFailed = 0;
|
|
684
618
|
repairSymbolSizeMismatch = 0;
|