@blockcast/mmt-wasm 0.3.0 → 0.4.0-main.86f861ac235a
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/package.json +38 -38
- package/pkg/mmt_wasm.d.ts +54 -77
- package/pkg/mmt_wasm.js +76 -102
- package/pkg/mmt_wasm_bg.wasm +0 -0
- package/pkg/mmt_wasm_bg.wasm.d.ts +6 -5
- package/pkg-no-modules/mmt_wasm.d.ts +54 -77
- package/pkg-no-modules/mmt_wasm.js +76 -102
- package/pkg-no-modules/mmt_wasm_bg.wasm +0 -0
- package/pkg-no-modules/mmt_wasm_bg.wasm.d.ts +6 -5
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
2
|
+
"name": "@blockcast/mmt-wasm",
|
|
3
|
+
"version": "0.4.0-main.86f861ac235a",
|
|
4
|
+
"description": "wasm-bindgen builds of the libmmt Rust core (RaptorQ FEC, MMTP MFU reassembly): `pkg` for ESM bundlers and `pkg-no-modules` as a global script for Closure-compiled pages",
|
|
5
|
+
"main": "pkg/mmt_wasm.js",
|
|
6
|
+
"types": "pkg/mmt_wasm.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./pkg/mmt_wasm.d.ts",
|
|
10
|
+
"import": "./pkg/mmt_wasm.js"
|
|
11
|
+
},
|
|
12
|
+
"./mmt_wasm_bg.wasm": "./pkg/mmt_wasm_bg.wasm",
|
|
13
|
+
"./no-modules": {
|
|
14
|
+
"types": "./pkg-no-modules/mmt_wasm.d.ts",
|
|
15
|
+
"default": "./pkg-no-modules/mmt_wasm.js"
|
|
16
|
+
},
|
|
17
|
+
"./no-modules/mmt_wasm_bg.wasm": "./pkg-no-modules/mmt_wasm_bg.wasm",
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"pkg",
|
|
22
|
+
"pkg-no-modules"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "make -C ../.. mmt-wasm",
|
|
26
|
+
"test": "node build-contract.test.mjs"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"mmt",
|
|
30
|
+
"mmtp",
|
|
31
|
+
"raptorq",
|
|
32
|
+
"wasm"
|
|
33
|
+
],
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/Blockcast/libmmt.git",
|
|
38
|
+
"directory": "packages/mmt-wasm"
|
|
39
|
+
}
|
|
40
40
|
}
|
package/pkg/mmt_wasm.d.ts
CHANGED
|
@@ -45,6 +45,12 @@ export class FecStats {
|
|
|
45
45
|
* Blocks that expired with fewer than K symbols (delivery issue, not FEC issue)
|
|
46
46
|
*/
|
|
47
47
|
blocks_delivery_failed: bigint;
|
|
48
|
+
/**
|
|
49
|
+
* `iso-ssbg1-v1` held sources evicted, oldest arrival first, because the
|
|
50
|
+
* unplaced pool was at its `(interleave_depth + 1) * K` cap: no sweep
|
|
51
|
+
* (`cleanup_by_ss_start` / `retire_unplaced`) retired them first.
|
|
52
|
+
*/
|
|
53
|
+
unplaced_evicted: bigint;
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
export class MfuFragmentJs {
|
|
@@ -100,27 +106,15 @@ export class MmtFecDecoder {
|
|
|
100
106
|
/**
|
|
101
107
|
* Add a repair symbol per ISO 23008-1 §C.5.3.
|
|
102
108
|
*
|
|
103
|
-
* Repair carries (SS_Start, SSB_length, RS_ID).
|
|
104
|
-
* SS_Start
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* (fec-raptorq `InterleavedEncoder::force_complete`). The block records
|
|
113
|
-
* `SSB_length`, completes once that many source symbols arrived, and
|
|
114
|
-
* recovers from `SSB_length` received symbols by supplying the known
|
|
115
|
-
* padding itself. A conflicting `SSB_length` for one block is rejected
|
|
116
|
-
* without changing that block.
|
|
117
|
-
*
|
|
118
|
-
* Under `iso-ssbg1-v1` the block is `[SS_Start, SS_Start + SSB_length)`
|
|
119
|
-
* with `1 <= SSB_length <= K` (K is only the maximum), its RaptorQ geometry
|
|
120
|
-
* is K' = SSB_length with no padding, and repair ESI = SSB_length + RS_ID
|
|
121
|
-
* (C.5.3). The first repair defines the block and claims every held source
|
|
122
|
-
* in range. A conflicting SSB_length, or a range overlapping a different
|
|
123
|
-
* known block, is refused without changing any block. Output is the K'*T
|
|
109
|
+
* Repair carries (SS_Start, SSB_length, RS_ID). The block is
|
|
110
|
+
* `[SS_Start, SS_Start + SSB_length)` with `1 <= SSB_length <= K` (the
|
|
111
|
+
* configured K is only the maximum), its RaptorQ geometry is
|
|
112
|
+
* K' = SSB_length with no padding, and repair ESI = SSB_length + RS_ID.
|
|
113
|
+
* The first repair defines the block and claims every held source in
|
|
114
|
+
* range. A conflicting SSB_length, a range overlapping a different known
|
|
115
|
+
* block, or a start more than `interleave_depth` blocks behind the last
|
|
116
|
+
* `cleanup_by_ss_start`'s `current` (`iso_blocks_behind_lower_bound`), is
|
|
117
|
+
* refused without changing any block. Output is the K'*T
|
|
124
118
|
* concatenated ssbg_mode1 symbols: split by T and trim by the length field.
|
|
125
119
|
*/
|
|
126
120
|
add_repair(ss_start: number, ssb_length: number, rs_id: number, data: Uint8Array, timestamp: number): Uint8Array | undefined;
|
|
@@ -130,13 +124,12 @@ export class MmtFecDecoder {
|
|
|
130
124
|
* SS_ID is a flat 32-bit counter. An unconfigured decoder rejects the
|
|
131
125
|
* packet.
|
|
132
126
|
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* whose block no repair has defined yet is held by SS_ID until one does.
|
|
127
|
+
* Builds the C.3.3 ssbg_mode1 symbol `u16be(len) || data || zero padding`
|
|
128
|
+
* (refusing `len + 2 > T`) and places it at ESI = serial distance from the
|
|
129
|
+
* start of the known block whose `[SS_Start, SS_Start + SSB_length)`
|
|
130
|
+
* contains SS_ID. A source whose block no repair has defined yet is held
|
|
131
|
+
* by SS_ID until one does; at most `(interleave_depth + 1) * K` are held, and
|
|
132
|
+
* the oldest arrival is evicted first (`FecStats::unplaced_evicted`).
|
|
140
133
|
*
|
|
141
134
|
* # Arguments
|
|
142
135
|
* * `ss_id` - Source symbol ID (32-bit monotonic counter)
|
|
@@ -152,18 +145,6 @@ export class MmtFecDecoder {
|
|
|
152
145
|
* Get alignment (Al) parameter from OTI
|
|
153
146
|
*/
|
|
154
147
|
get_alignment(): number;
|
|
155
|
-
/**
|
|
156
|
-
* `k-padded-v1` only: cleanup blocks more than `interleave_depth` blocks
|
|
157
|
-
* behind `current_sbn`. Refused under `iso-ssbg1-v1`, which has no SBN
|
|
158
|
-
* (use `cleanup_by_ss_start`).
|
|
159
|
-
*
|
|
160
|
-
* Blocks are ordered by RFC 1982 serial comparison of their first SS_ID
|
|
161
|
-
* (`sbn * K mod 2^32`, ISO/IEC 23008-1 C.5.2; BLO-35597 iso:5). For a
|
|
162
|
-
* stream that has not wrapped SS_ID that is exactly the old
|
|
163
|
-
* `sbn < current_sbn - interleave_depth`; after the wrap it still retires
|
|
164
|
-
* the pre-wrap blocks instead of keeping them forever.
|
|
165
|
-
*/
|
|
166
|
-
cleanup_by_sbn(current_sbn: number): Uint32Array;
|
|
167
148
|
/**
|
|
168
149
|
* Get sub-blocks (N) parameter from OTI
|
|
169
150
|
*/
|
|
@@ -177,11 +158,11 @@ export class MmtFecDecoder {
|
|
|
177
158
|
*/
|
|
178
159
|
get_symbol_size(): number;
|
|
179
160
|
/**
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
161
|
+
* Retire the held source symbols that no repair can place any more, by
|
|
162
|
+
* the same rule as `cleanup_by_ss_start`, without retiring any block. For
|
|
163
|
+
* a caller that retires blocks itself, by their deadlines
|
|
164
|
+
* (`cleanup_blocks_detailed`), and needs only this half. Returns how many
|
|
165
|
+
* it retired.
|
|
185
166
|
*/
|
|
186
167
|
retire_unplaced(current: number): number;
|
|
187
168
|
/**
|
|
@@ -201,11 +182,11 @@ export class MmtFecDecoder {
|
|
|
201
182
|
*/
|
|
202
183
|
get_source_blocks(): number;
|
|
203
184
|
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
185
|
+
* Retire every block, and every held source symbol, lying more than
|
|
186
|
+
* `interleave_depth` blocks behind SS_ID `current`, the newest SS_ID the
|
|
187
|
+
* caller has seen (no block start or held source follows it). A block
|
|
188
|
+
* start or held source that `current` has moved at least half the SS_ID
|
|
189
|
+
* space past no longer precedes it and is retired too
|
|
209
190
|
* (`iso_past_horizon`).
|
|
210
191
|
*
|
|
211
192
|
* Blocks have no SBN under ssbg_mode1, so distance is measured on the
|
|
@@ -221,21 +202,21 @@ export class MmtFecDecoder {
|
|
|
221
202
|
*/
|
|
222
203
|
get_interleave_depth(): number;
|
|
223
204
|
/**
|
|
224
|
-
* Finalize only the source blocks whose host-owned deadlines fired
|
|
225
|
-
*
|
|
205
|
+
* Finalize only the source blocks whose host-owned deadlines fired,
|
|
206
|
+
* named by their SS_Starts.
|
|
226
207
|
*
|
|
227
208
|
* The JavaScript FEC manager owns per-block repair grace. A timeout for one
|
|
228
209
|
* block must therefore not run the decoder's global age scan and evict a
|
|
229
210
|
* peer block that is still waiting for fetched repair.
|
|
230
211
|
*/
|
|
231
|
-
cleanup_blocks_detailed(
|
|
212
|
+
cleanup_blocks_detailed(ss_starts: Uint32Array): void;
|
|
232
213
|
/**
|
|
233
214
|
* Create a new FEC decoder
|
|
234
215
|
*
|
|
235
216
|
* # Arguments
|
|
236
217
|
* * `interleave_depth` - Explicit positive number of interleaved blocks.
|
|
237
|
-
* * `block_profile` - Catalog `fec.blockProfile`: `"
|
|
238
|
-
*
|
|
218
|
+
* * `block_profile` - Catalog `fec.blockProfile`: `"iso-ssbg1-v1"`.
|
|
219
|
+
* Required; any other value is refused.
|
|
239
220
|
*/
|
|
240
221
|
constructor(interleave_depth: number, block_profile: string);
|
|
241
222
|
/**
|
|
@@ -270,33 +251,28 @@ export class MmtFecEncoder {
|
|
|
270
251
|
* `[SS_Start:4][RSB_length:3][RS_ID:3][SSB_length:3][symbol: T]`.
|
|
271
252
|
* Callers split on that stride; `entry i` is at `i * (13 + T)`.
|
|
272
253
|
*
|
|
273
|
-
* `
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* `iso-ssbg1-v1`: `block` is the SS_Start (the block's first SS_ID) and
|
|
279
|
-
* `source_block` is the block's K' ssbg_mode1 symbols (`1 <= K' <= K`,
|
|
280
|
-
* `len % T == 0`, each a well-formed C.3.3 symbol). RaptorQ runs over K'
|
|
281
|
-
* symbols (F = K'*T) and `SSB_length = K'`.
|
|
254
|
+
* `ss_start` is the block's first SS_ID and `source_block` is the
|
|
255
|
+
* block's K' ssbg_mode1 symbols (`1 <= K' <= K`, `len % T == 0`, each a
|
|
256
|
+
* well-formed C.3.3 symbol). RaptorQ runs over K' symbols (F = K'*T) and
|
|
257
|
+
* `SSB_length = K'`.
|
|
282
258
|
*
|
|
283
259
|
* # Arguments
|
|
284
|
-
* * `
|
|
260
|
+
* * `ss_start` - SS_Start: the block's first SS_ID.
|
|
285
261
|
* * `source_block` - The block's source symbols, as described above.
|
|
286
262
|
* * `repair_count` - Number of repair symbols (P) to generate.
|
|
287
263
|
*/
|
|
288
|
-
encode_repair(
|
|
264
|
+
encode_repair(ss_start: number, source_block: Uint8Array, repair_count: number): Uint8Array;
|
|
289
265
|
/**
|
|
290
266
|
* Create an encoder for a fixed `(K, symbol_size)` block geometry.
|
|
291
267
|
*
|
|
292
268
|
* Builds the OTI as `ObjectTransmissionInformation::new(K*T, T, 1, 1, 8)`
|
|
293
|
-
* (single source block, single sub-block, byte alignment) —
|
|
294
|
-
*
|
|
295
|
-
*
|
|
269
|
+
* (single source block, single sub-block, byte alignment) — the geometry
|
|
270
|
+
* [`MmtFecDecoder::configure`] reads back. K is the maximum SSB_length;
|
|
271
|
+
* each block is encoded over its own K' symbols (see
|
|
272
|
+
* [`MmtFecEncoder::encode_repair`]).
|
|
296
273
|
*
|
|
297
|
-
* `block_profile` is the catalog `fec.blockProfile` (`"
|
|
298
|
-
*
|
|
299
|
-
* is the maximum SSB_length.
|
|
274
|
+
* `block_profile` is the catalog `fec.blockProfile` (`"iso-ssbg1-v1"`);
|
|
275
|
+
* any other value is refused.
|
|
300
276
|
*/
|
|
301
277
|
constructor(k: number, symbol_size: number, block_profile: string);
|
|
302
278
|
/**
|
|
@@ -808,7 +784,7 @@ export interface InitOutput {
|
|
|
808
784
|
readonly __wbg_get_fecstats_bytes_recovered: (a: number) => bigint;
|
|
809
785
|
readonly __wbg_get_fecstats_repair_packets: (a: number) => bigint;
|
|
810
786
|
readonly __wbg_get_fecstats_source_packets: (a: number) => bigint;
|
|
811
|
-
readonly
|
|
787
|
+
readonly __wbg_get_fecstats_unplaced_evicted: (a: number) => bigint;
|
|
812
788
|
readonly __wbg_mfufragmentjs_free: (a: number, b: number) => void;
|
|
813
789
|
readonly __wbg_mmtfecdecoder_free: (a: number, b: number) => void;
|
|
814
790
|
readonly __wbg_mmtfecencoder_free: (a: number, b: number) => void;
|
|
@@ -821,7 +797,6 @@ export interface InitOutput {
|
|
|
821
797
|
readonly __wbg_moqfecencoder_free: (a: number, b: number) => void;
|
|
822
798
|
readonly __wbg_moqfecstatsjs_free: (a: number, b: number) => void;
|
|
823
799
|
readonly __wbg_reassembledmfujs_free: (a: number, b: number) => void;
|
|
824
|
-
readonly __wbg_reassemblerstatsjs_free: (a: number, b: number) => void;
|
|
825
800
|
readonly __wbg_recoveredset_free: (a: number, b: number) => void;
|
|
826
801
|
readonly __wbg_samplecombinerstatsjs_free: (a: number, b: number) => void;
|
|
827
802
|
readonly __wbg_set_fecstats_blocks_complete: (a: number, b: bigint) => void;
|
|
@@ -831,7 +806,7 @@ export interface InitOutput {
|
|
|
831
806
|
readonly __wbg_set_fecstats_bytes_recovered: (a: number, b: bigint) => void;
|
|
832
807
|
readonly __wbg_set_fecstats_repair_packets: (a: number, b: bigint) => void;
|
|
833
808
|
readonly __wbg_set_fecstats_source_packets: (a: number, b: bigint) => void;
|
|
834
|
-
readonly
|
|
809
|
+
readonly __wbg_set_fecstats_unplaced_evicted: (a: number, b: bigint) => void;
|
|
835
810
|
readonly __wbg_shredfecbuffer_free: (a: number, b: number) => void;
|
|
836
811
|
readonly __wbg_shredreassembler_free: (a: number, b: number) => void;
|
|
837
812
|
readonly annexb_access_unit_is_keyframe: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
@@ -862,7 +837,6 @@ export interface InitOutput {
|
|
|
862
837
|
readonly mmtfecdecoder_add_repair: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
863
838
|
readonly mmtfecdecoder_add_source: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
864
839
|
readonly mmtfecdecoder_cleanup_blocks_detailed: (a: number, b: number, c: number) => void;
|
|
865
|
-
readonly mmtfecdecoder_cleanup_by_sbn: (a: number, b: number) => [number, number, number, number];
|
|
866
840
|
readonly mmtfecdecoder_cleanup_by_ss_start: (a: number, b: number) => [number, number, number, number];
|
|
867
841
|
readonly mmtfecdecoder_configure: (a: number, b: number, c: number) => [number, number];
|
|
868
842
|
readonly mmtfecdecoder_configure_params: (a: number, b: number, c: number) => [number, number];
|
|
@@ -957,7 +931,6 @@ export interface InitOutput {
|
|
|
957
931
|
readonly reassembledmfujs_sample_number: (a: number) => number;
|
|
958
932
|
readonly reassembledmfujs_stream_identity: (a: number) => number;
|
|
959
933
|
readonly reassembledmfujs_timestamp: (a: number) => number;
|
|
960
|
-
readonly recoveredset_fec_set_index: (a: number) => number;
|
|
961
934
|
readonly recoveredset_payload: (a: number) => [number, number];
|
|
962
935
|
readonly recoveredset_slot: (a: number) => bigint;
|
|
963
936
|
readonly shredfecbuffer_add_shred: (a: number, b: bigint, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
@@ -974,7 +947,9 @@ export interface InitOutput {
|
|
|
974
947
|
readonly moqfecstatsjs_blocksComplete: (a: number) => number;
|
|
975
948
|
readonly moqfecstatsjs_blocksIncomplete: (a: number) => number;
|
|
976
949
|
readonly moqfecstatsjs_totalSymbolsReceived: (a: number) => number;
|
|
950
|
+
readonly recoveredset_fec_set_index: (a: number) => number;
|
|
977
951
|
readonly shredreassembler_pending_fec_sets: (a: number) => number;
|
|
952
|
+
readonly __wbg_get_reassemblerstatsjs_ambiguous_fallback_fragments: (a: number) => bigint;
|
|
978
953
|
readonly __wbg_get_reassemblerstatsjs_duplicate_fragments: (a: number) => bigint;
|
|
979
954
|
readonly __wbg_get_reassemblerstatsjs_evicted_data_units: (a: number) => bigint;
|
|
980
955
|
readonly __wbg_get_reassemblerstatsjs_evicted_memory_limit: (a: number) => bigint;
|
|
@@ -986,6 +961,8 @@ export interface InitOutput {
|
|
|
986
961
|
readonly __wbg_get_samplecombinerstatsjs_evicted_samples: (a: number) => bigint;
|
|
987
962
|
readonly __wbg_get_samplecombinerstatsjs_passthrough_samples: (a: number) => bigint;
|
|
988
963
|
readonly __wbg_get_samplecombinerstatsjs_timed_out_samples: (a: number) => bigint;
|
|
964
|
+
readonly __wbg_reassemblerstatsjs_free: (a: number, b: number) => void;
|
|
965
|
+
readonly __wbg_set_reassemblerstatsjs_ambiguous_fallback_fragments: (a: number, b: bigint) => void;
|
|
989
966
|
readonly __wbg_set_reassemblerstatsjs_duplicate_fragments: (a: number, b: bigint) => void;
|
|
990
967
|
readonly __wbg_set_reassemblerstatsjs_evicted_data_units: (a: number, b: bigint) => void;
|
|
991
968
|
readonly __wbg_set_reassemblerstatsjs_evicted_memory_limit: (a: number, b: bigint) => void;
|
package/pkg/mmt_wasm.js
CHANGED
|
@@ -529,6 +529,25 @@ export class FecStats {
|
|
|
529
529
|
set blocks_delivery_failed(arg0) {
|
|
530
530
|
wasm.__wbg_set_fecstats_blocks_delivery_failed(this.__wbg_ptr, arg0);
|
|
531
531
|
}
|
|
532
|
+
/**
|
|
533
|
+
* `iso-ssbg1-v1` held sources evicted, oldest arrival first, because the
|
|
534
|
+
* unplaced pool was at its `(interleave_depth + 1) * K` cap: no sweep
|
|
535
|
+
* (`cleanup_by_ss_start` / `retire_unplaced`) retired them first.
|
|
536
|
+
* @returns {bigint}
|
|
537
|
+
*/
|
|
538
|
+
get unplaced_evicted() {
|
|
539
|
+
const ret = wasm.__wbg_get_fecstats_unplaced_evicted(this.__wbg_ptr);
|
|
540
|
+
return BigInt.asUintN(64, ret);
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* `iso-ssbg1-v1` held sources evicted, oldest arrival first, because the
|
|
544
|
+
* unplaced pool was at its `(interleave_depth + 1) * K` cap: no sweep
|
|
545
|
+
* (`cleanup_by_ss_start` / `retire_unplaced`) retired them first.
|
|
546
|
+
* @param {bigint} arg0
|
|
547
|
+
*/
|
|
548
|
+
set unplaced_evicted(arg0) {
|
|
549
|
+
wasm.__wbg_set_fecstats_unplaced_evicted(this.__wbg_ptr, arg0);
|
|
550
|
+
}
|
|
532
551
|
/**
|
|
533
552
|
* Recovery rate as percentage (0-100)
|
|
534
553
|
* Counts all blocks: complete + recovered + FEC-failed + delivery-failed
|
|
@@ -670,27 +689,15 @@ export class MmtFecDecoder {
|
|
|
670
689
|
/**
|
|
671
690
|
* Add a repair symbol per ISO 23008-1 §C.5.3.
|
|
672
691
|
*
|
|
673
|
-
* Repair carries (SS_Start, SSB_length, RS_ID).
|
|
674
|
-
* SS_Start
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
* (fec-raptorq `InterleavedEncoder::force_complete`). The block records
|
|
683
|
-
* `SSB_length`, completes once that many source symbols arrived, and
|
|
684
|
-
* recovers from `SSB_length` received symbols by supplying the known
|
|
685
|
-
* padding itself. A conflicting `SSB_length` for one block is rejected
|
|
686
|
-
* without changing that block.
|
|
687
|
-
*
|
|
688
|
-
* Under `iso-ssbg1-v1` the block is `[SS_Start, SS_Start + SSB_length)`
|
|
689
|
-
* with `1 <= SSB_length <= K` (K is only the maximum), its RaptorQ geometry
|
|
690
|
-
* is K' = SSB_length with no padding, and repair ESI = SSB_length + RS_ID
|
|
691
|
-
* (C.5.3). The first repair defines the block and claims every held source
|
|
692
|
-
* in range. A conflicting SSB_length, or a range overlapping a different
|
|
693
|
-
* known block, is refused without changing any block. Output is the K'*T
|
|
692
|
+
* Repair carries (SS_Start, SSB_length, RS_ID). The block is
|
|
693
|
+
* `[SS_Start, SS_Start + SSB_length)` with `1 <= SSB_length <= K` (the
|
|
694
|
+
* configured K is only the maximum), its RaptorQ geometry is
|
|
695
|
+
* K' = SSB_length with no padding, and repair ESI = SSB_length + RS_ID.
|
|
696
|
+
* The first repair defines the block and claims every held source in
|
|
697
|
+
* range. A conflicting SSB_length, a range overlapping a different known
|
|
698
|
+
* block, or a start more than `interleave_depth` blocks behind the last
|
|
699
|
+
* `cleanup_by_ss_start`'s `current` (`iso_blocks_behind_lower_bound`), is
|
|
700
|
+
* refused without changing any block. Output is the K'*T
|
|
694
701
|
* concatenated ssbg_mode1 symbols: split by T and trim by the length field.
|
|
695
702
|
* @param {number} ss_start
|
|
696
703
|
* @param {number} ssb_length
|
|
@@ -719,13 +726,12 @@ export class MmtFecDecoder {
|
|
|
719
726
|
* SS_ID is a flat 32-bit counter. An unconfigured decoder rejects the
|
|
720
727
|
* packet.
|
|
721
728
|
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
* whose block no repair has defined yet is held by SS_ID until one does.
|
|
729
|
+
* Builds the C.3.3 ssbg_mode1 symbol `u16be(len) || data || zero padding`
|
|
730
|
+
* (refusing `len + 2 > T`) and places it at ESI = serial distance from the
|
|
731
|
+
* start of the known block whose `[SS_Start, SS_Start + SSB_length)`
|
|
732
|
+
* contains SS_ID. A source whose block no repair has defined yet is held
|
|
733
|
+
* by SS_ID until one does; at most `(interleave_depth + 1) * K` are held, and
|
|
734
|
+
* the oldest arrival is evicted first (`FecStats::unplaced_evicted`).
|
|
729
735
|
*
|
|
730
736
|
* # Arguments
|
|
731
737
|
* * `ss_id` - Source symbol ID (32-bit monotonic counter)
|
|
@@ -767,28 +773,6 @@ export class MmtFecDecoder {
|
|
|
767
773
|
}
|
|
768
774
|
return ret[0];
|
|
769
775
|
}
|
|
770
|
-
/**
|
|
771
|
-
* `k-padded-v1` only: cleanup blocks more than `interleave_depth` blocks
|
|
772
|
-
* behind `current_sbn`. Refused under `iso-ssbg1-v1`, which has no SBN
|
|
773
|
-
* (use `cleanup_by_ss_start`).
|
|
774
|
-
*
|
|
775
|
-
* Blocks are ordered by RFC 1982 serial comparison of their first SS_ID
|
|
776
|
-
* (`sbn * K mod 2^32`, ISO/IEC 23008-1 C.5.2; BLO-35597 iso:5). For a
|
|
777
|
-
* stream that has not wrapped SS_ID that is exactly the old
|
|
778
|
-
* `sbn < current_sbn - interleave_depth`; after the wrap it still retires
|
|
779
|
-
* the pre-wrap blocks instead of keeping them forever.
|
|
780
|
-
* @param {number} current_sbn
|
|
781
|
-
* @returns {Uint32Array}
|
|
782
|
-
*/
|
|
783
|
-
cleanup_by_sbn(current_sbn) {
|
|
784
|
-
const ret = wasm.mmtfecdecoder_cleanup_by_sbn(this.__wbg_ptr, current_sbn);
|
|
785
|
-
if (ret[3]) {
|
|
786
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
787
|
-
}
|
|
788
|
-
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
789
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
790
|
-
return v1;
|
|
791
|
-
}
|
|
792
776
|
/**
|
|
793
777
|
* Get sub-blocks (N) parameter from OTI
|
|
794
778
|
* @returns {number}
|
|
@@ -820,11 +804,11 @@ export class MmtFecDecoder {
|
|
|
820
804
|
return ret[0];
|
|
821
805
|
}
|
|
822
806
|
/**
|
|
823
|
-
*
|
|
824
|
-
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
*
|
|
807
|
+
* Retire the held source symbols that no repair can place any more, by
|
|
808
|
+
* the same rule as `cleanup_by_ss_start`, without retiring any block. For
|
|
809
|
+
* a caller that retires blocks itself, by their deadlines
|
|
810
|
+
* (`cleanup_blocks_detailed`), and needs only this half. Returns how many
|
|
811
|
+
* it retired.
|
|
828
812
|
* @param {number} current
|
|
829
813
|
* @returns {number}
|
|
830
814
|
*/
|
|
@@ -878,11 +862,11 @@ export class MmtFecDecoder {
|
|
|
878
862
|
return ret[0];
|
|
879
863
|
}
|
|
880
864
|
/**
|
|
881
|
-
*
|
|
882
|
-
*
|
|
883
|
-
*
|
|
884
|
-
*
|
|
885
|
-
*
|
|
865
|
+
* Retire every block, and every held source symbol, lying more than
|
|
866
|
+
* `interleave_depth` blocks behind SS_ID `current`, the newest SS_ID the
|
|
867
|
+
* caller has seen (no block start or held source follows it). A block
|
|
868
|
+
* start or held source that `current` has moved at least half the SS_ID
|
|
869
|
+
* space past no longer precedes it and is retired too
|
|
886
870
|
* (`iso_past_horizon`).
|
|
887
871
|
*
|
|
888
872
|
* Blocks have no SBN under ssbg_mode1, so distance is measured on the
|
|
@@ -912,16 +896,16 @@ export class MmtFecDecoder {
|
|
|
912
896
|
return ret >>> 0;
|
|
913
897
|
}
|
|
914
898
|
/**
|
|
915
|
-
* Finalize only the source blocks whose host-owned deadlines fired
|
|
916
|
-
*
|
|
899
|
+
* Finalize only the source blocks whose host-owned deadlines fired,
|
|
900
|
+
* named by their SS_Starts.
|
|
917
901
|
*
|
|
918
902
|
* The JavaScript FEC manager owns per-block repair grace. A timeout for one
|
|
919
903
|
* block must therefore not run the decoder's global age scan and evict a
|
|
920
904
|
* peer block that is still waiting for fetched repair.
|
|
921
|
-
* @param {Uint32Array}
|
|
905
|
+
* @param {Uint32Array} ss_starts
|
|
922
906
|
*/
|
|
923
|
-
cleanup_blocks_detailed(
|
|
924
|
-
const ptr0 = passArray32ToWasm0(
|
|
907
|
+
cleanup_blocks_detailed(ss_starts) {
|
|
908
|
+
const ptr0 = passArray32ToWasm0(ss_starts, wasm.__wbindgen_malloc);
|
|
925
909
|
const len0 = WASM_VECTOR_LEN;
|
|
926
910
|
wasm.mmtfecdecoder_cleanup_blocks_detailed(this.__wbg_ptr, ptr0, len0);
|
|
927
911
|
}
|
|
@@ -930,8 +914,8 @@ export class MmtFecDecoder {
|
|
|
930
914
|
*
|
|
931
915
|
* # Arguments
|
|
932
916
|
* * `interleave_depth` - Explicit positive number of interleaved blocks.
|
|
933
|
-
* * `block_profile` - Catalog `fec.blockProfile`: `"
|
|
934
|
-
*
|
|
917
|
+
* * `block_profile` - Catalog `fec.blockProfile`: `"iso-ssbg1-v1"`.
|
|
918
|
+
* Required; any other value is refused.
|
|
935
919
|
* @param {number} interleave_depth
|
|
936
920
|
* @param {string} block_profile
|
|
937
921
|
*/
|
|
@@ -1011,21 +995,16 @@ if (Symbol.dispose) MmtFecDecoder.prototype[Symbol.dispose] = MmtFecDecoder.prot
|
|
|
1011
995
|
* [SS_Start:4][RSB_length:3][RS_ID:3][SSB_length:3][repair symbol: T]
|
|
1012
996
|
* ```
|
|
1013
997
|
*
|
|
1014
|
-
* with, for
|
|
1015
|
-
*
|
|
1016
|
-
*
|
|
998
|
+
* with, for an `iso-ssbg1-v1` block of K' ssbg_mode1 source symbols
|
|
999
|
+
* (ISO/IEC 23008-1 C.3.3, C.5.2, C.5.3):
|
|
1000
|
+
* - `SS_Start = ` the block's first SS_ID (SS_IDs are consecutive, 32-bit)
|
|
1017
1001
|
* - `RSB_length = P` (repair count for this block)
|
|
1018
|
-
* - `RS_ID = i` (0-based repair index) ⇒ RaptorQ ESI = `K + i`
|
|
1019
|
-
* - `SSB_length
|
|
1020
|
-
*
|
|
1021
|
-
* OTI (Z=1, N=1, Al=8) is delivered out-of-band via the catalog / AL-FEC
|
|
1022
|
-
* signaling message — see [`MmtFecEncoder::oti`] — never per-packet.
|
|
1002
|
+
* - `RS_ID = i` (0-based repair index) ⇒ RaptorQ ESI = `K' + i`
|
|
1003
|
+
* - `SSB_length = K'` (`1..=K`; the configured K is only the maximum)
|
|
1023
1004
|
*
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
1027
|
-
* block is K' symbols with no padding (F = K'*T), and RS_ID `i` is ESI
|
|
1028
|
-
* `K' + i`.
|
|
1005
|
+
* The RaptorQ block is K' symbols with no padding (F = K'*T). The configured
|
|
1006
|
+
* OTI (F = K*T, Z=1, N=1, Al=8) is delivered out-of-band via the catalog /
|
|
1007
|
+
* AL-FEC signaling message — see [`MmtFecEncoder::oti`] — never per-packet.
|
|
1029
1008
|
*/
|
|
1030
1009
|
export class MmtFecEncoder {
|
|
1031
1010
|
__destroy_into_raw() {
|
|
@@ -1070,29 +1049,24 @@ export class MmtFecEncoder {
|
|
|
1070
1049
|
* `[SS_Start:4][RSB_length:3][RS_ID:3][SSB_length:3][symbol: T]`.
|
|
1071
1050
|
* Callers split on that stride; `entry i` is at `i * (13 + T)`.
|
|
1072
1051
|
*
|
|
1073
|
-
* `
|
|
1074
|
-
*
|
|
1075
|
-
*
|
|
1076
|
-
*
|
|
1077
|
-
*
|
|
1078
|
-
* `iso-ssbg1-v1`: `block` is the SS_Start (the block's first SS_ID) and
|
|
1079
|
-
* `source_block` is the block's K' ssbg_mode1 symbols (`1 <= K' <= K`,
|
|
1080
|
-
* `len % T == 0`, each a well-formed C.3.3 symbol). RaptorQ runs over K'
|
|
1081
|
-
* symbols (F = K'*T) and `SSB_length = K'`.
|
|
1052
|
+
* `ss_start` is the block's first SS_ID and `source_block` is the
|
|
1053
|
+
* block's K' ssbg_mode1 symbols (`1 <= K' <= K`, `len % T == 0`, each a
|
|
1054
|
+
* well-formed C.3.3 symbol). RaptorQ runs over K' symbols (F = K'*T) and
|
|
1055
|
+
* `SSB_length = K'`.
|
|
1082
1056
|
*
|
|
1083
1057
|
* # Arguments
|
|
1084
|
-
* * `
|
|
1058
|
+
* * `ss_start` - SS_Start: the block's first SS_ID.
|
|
1085
1059
|
* * `source_block` - The block's source symbols, as described above.
|
|
1086
1060
|
* * `repair_count` - Number of repair symbols (P) to generate.
|
|
1087
|
-
* @param {number}
|
|
1061
|
+
* @param {number} ss_start
|
|
1088
1062
|
* @param {Uint8Array} source_block
|
|
1089
1063
|
* @param {number} repair_count
|
|
1090
1064
|
* @returns {Uint8Array}
|
|
1091
1065
|
*/
|
|
1092
|
-
encode_repair(
|
|
1066
|
+
encode_repair(ss_start, source_block, repair_count) {
|
|
1093
1067
|
const ptr0 = passArray8ToWasm0(source_block, wasm.__wbindgen_malloc);
|
|
1094
1068
|
const len0 = WASM_VECTOR_LEN;
|
|
1095
|
-
const ret = wasm.mmtfecencoder_encode_repair(this.__wbg_ptr,
|
|
1069
|
+
const ret = wasm.mmtfecencoder_encode_repair(this.__wbg_ptr, ss_start, ptr0, len0, repair_count);
|
|
1096
1070
|
if (ret[3]) {
|
|
1097
1071
|
throw takeFromExternrefTable0(ret[2]);
|
|
1098
1072
|
}
|
|
@@ -1112,13 +1086,13 @@ export class MmtFecEncoder {
|
|
|
1112
1086
|
* Create an encoder for a fixed `(K, symbol_size)` block geometry.
|
|
1113
1087
|
*
|
|
1114
1088
|
* Builds the OTI as `ObjectTransmissionInformation::new(K*T, T, 1, 1, 8)`
|
|
1115
|
-
* (single source block, single sub-block, byte alignment) —
|
|
1116
|
-
*
|
|
1117
|
-
*
|
|
1089
|
+
* (single source block, single sub-block, byte alignment) — the geometry
|
|
1090
|
+
* [`MmtFecDecoder::configure`] reads back. K is the maximum SSB_length;
|
|
1091
|
+
* each block is encoded over its own K' symbols (see
|
|
1092
|
+
* [`MmtFecEncoder::encode_repair`]).
|
|
1118
1093
|
*
|
|
1119
|
-
* `block_profile` is the catalog `fec.blockProfile` (`"
|
|
1120
|
-
*
|
|
1121
|
-
* is the maximum SSB_length.
|
|
1094
|
+
* `block_profile` is the catalog `fec.blockProfile` (`"iso-ssbg1-v1"`);
|
|
1095
|
+
* any other value is refused.
|
|
1122
1096
|
* @param {number} k
|
|
1123
1097
|
* @param {number} symbol_size
|
|
1124
1098
|
* @param {string} block_profile
|
|
@@ -2286,14 +2260,14 @@ export class ReassemblerStatsJs {
|
|
|
2286
2260
|
* @returns {bigint}
|
|
2287
2261
|
*/
|
|
2288
2262
|
get ambiguous_fallback_fragments() {
|
|
2289
|
-
const ret = wasm.
|
|
2263
|
+
const ret = wasm.__wbg_get_fecstats_unplaced_evicted(this.__wbg_ptr);
|
|
2290
2264
|
return BigInt.asUintN(64, ret);
|
|
2291
2265
|
}
|
|
2292
2266
|
/**
|
|
2293
2267
|
* @param {bigint} arg0
|
|
2294
2268
|
*/
|
|
2295
2269
|
set ambiguous_fallback_fragments(arg0) {
|
|
2296
|
-
wasm.
|
|
2270
|
+
wasm.__wbg_set_fecstats_unplaced_evicted(this.__wbg_ptr, arg0);
|
|
2297
2271
|
}
|
|
2298
2272
|
}
|
|
2299
2273
|
if (Symbol.dispose) ReassemblerStatsJs.prototype[Symbol.dispose] = ReassemblerStatsJs.prototype.free;
|
|
@@ -2338,7 +2312,7 @@ export class RecoveredSet {
|
|
|
2338
2312
|
* @returns {number}
|
|
2339
2313
|
*/
|
|
2340
2314
|
get fec_set_index() {
|
|
2341
|
-
const ret = wasm.
|
|
2315
|
+
const ret = wasm.mmtfecencoder_k(this.__wbg_ptr);
|
|
2342
2316
|
return ret >>> 0;
|
|
2343
2317
|
}
|
|
2344
2318
|
/**
|
package/pkg/mmt_wasm_bg.wasm
CHANGED
|
Binary file
|