@blockcast/mmt-wasm 0.3.0 → 0.4.0-main.2654dbc2ed6d

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/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 = SS_ID of first source in block = SBN * K.
675
- * SSB_length = the authored source-symbol count in this block (1..=K).
676
- * SBN = SS_Start / configured K.
677
- * Repair ESI = K + RS_ID.
678
- *
679
- * The decoder's configured K is the fixed RaptorQ geometry. A short
680
- * authored block (`SSB_length < K`) is the producer's K-symbol RaptorQ
681
- * block with ESIs `SSB_length..K` zero-filled and never transmitted
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
- * - `k-padded-v1`: derives SBN = floor(SS_ID / K), ESI = SS_ID % K and
723
- * zero-pads `data` to T.
724
- * - `iso-ssbg1-v1`: builds the C.3.3 ssbg_mode1 symbol
725
- * `u16be(len) || data || zero padding` (refusing `len + 2 > T`) and
726
- * places it at ESI = serial distance from the start of the known block
727
- * whose `[SS_Start, SS_Start + SSB_length)` contains SS_ID. A source
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
- * `iso-ssbg1-v1` only: retire the held source symbols that no repair can
824
- * place any more, by the same rule as `cleanup_by_ss_start`, without
825
- * retiring any block. For a caller that retires blocks itself, by their
826
- * deadlines (`cleanup_blocks_detailed`), and needs only this half. Returns
827
- * how many it retired.
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
- * `iso-ssbg1-v1` only: retire every block, and every held source symbol,
882
- * lying more than `interleave_depth` blocks behind SS_ID `current`, the
883
- * newest SS_ID the caller has seen (no block start or held source follows
884
- * it). A block start or held source that `current` has moved at least
885
- * half the SS_ID space past no longer precedes it and is retired too
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
- * Keys are SBNs under `k-padded-v1` and SS_Starts under `iso-ssbg1-v1`.
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} sbns
905
+ * @param {Uint32Array} ss_starts
922
906
  */
923
- cleanup_blocks_detailed(sbns) {
924
- const ptr0 = passArray32ToWasm0(sbns, wasm.__wbindgen_malloc);
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`: `"k-padded-v1"` or
934
- * `"iso-ssbg1-v1"`. Required; any other value is refused.
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
  */
@@ -967,7 +951,8 @@ export class MmtFecDecoder {
967
951
  * Configure FEC from 12-byte OTI
968
952
  *
969
953
  * # Arguments
970
- * * `oti` - 12-byte Object Transmission Information from S-TSID fecOTI
954
+ * * `oti` - 12-byte RFC 6330 Common FEC OTI: decoder geometry per
955
+ * draft-fec-01 Section 4.2 (Z = 1, N = 1, Al = 8)
971
956
  * @param {Uint8Array} oti
972
957
  */
973
958
  configure(oti) {
@@ -1011,21 +996,16 @@ if (Symbol.dispose) MmtFecDecoder.prototype[Symbol.dispose] = MmtFecDecoder.prot
1011
996
  * [SS_Start:4][RSB_length:3][RS_ID:3][SSB_length:3][repair symbol: T]
1012
997
  * ```
1013
998
  *
1014
- * with, for a block with Source Block Number `sbn` and `K` source symbols:
1015
- * - `SS_Start = sbn * K` (32-bit) — first SS_ID of the block. The decoder
1016
- * derives `SBN = SS_Start / K`, so this MUST be `sbn * K`.
999
+ * with, for an `iso-ssbg1-v1` block of K' ssbg_mode1 source symbols
1000
+ * (ISO/IEC 23008-1 C.3.3, C.5.2, C.5.3):
1001
+ * - `SS_Start = ` the block's first SS_ID (SS_IDs are consecutive, 32-bit)
1017
1002
  * - `RSB_length = P` (repair count for this block)
1018
- * - `RS_ID = i` (0-based repair index) ⇒ RaptorQ ESI = `K + i`
1019
- * - `SSB_length <= K` (authored source symbols in this block)
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.
1003
+ * - `RS_ID = i` (0-based repair index) ⇒ RaptorQ ESI = `K' + i`
1004
+ * - `SSB_length = K'` (`1..=K`; the configured K is only the maximum)
1023
1005
  *
1024
- * That framing is the `k-padded-v1` profile. Under `iso-ssbg1-v1` the same
1025
- * fields carry ISO/IEC 23008-1 C.5.3 semantics: `SS_Start` is the first SS_ID
1026
- * of a block of consecutive SS_IDs, `SSB_length = K'` (`1..=K`), the RaptorQ
1027
- * block is K' symbols with no padding (F = K'*T), and RS_ID `i` is ESI
1028
- * `K' + i`.
1006
+ * The RaptorQ block is K' symbols with no padding (F = K'*T). The configured
1007
+ * OTI (F = K*T, Z=1, N=1, Al=8) is delivered out-of-band via the catalog /
1008
+ * AL-FEC signaling message — see [`MmtFecEncoder::oti`] — never per-packet.
1029
1009
  */
1030
1010
  export class MmtFecEncoder {
1031
1011
  __destroy_into_raw() {
@@ -1070,29 +1050,24 @@ export class MmtFecEncoder {
1070
1050
  * `[SS_Start:4][RSB_length:3][RS_ID:3][SSB_length:3][symbol: T]`.
1071
1051
  * Callers split on that stride; `entry i` is at `i * (13 + T)`.
1072
1052
  *
1073
- * `k-padded-v1`: `block` is the Source Block Number and `source_block`
1074
- * MUST be exactly `K * symbol_size` bytes — the caller pads the final
1075
- * (short) block with zeros, mirroring `InterleavedEncoder` and the FFmpeg
1076
- * path. `SS_Start = block * K` (wrapping), `SSB_length = K`.
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'`.
1053
+ * `ss_start` is the block's first SS_ID and `source_block` is the
1054
+ * block's K' ssbg_mode1 symbols (`1 <= K' <= K`, `len % T == 0`, each a
1055
+ * well-formed C.3.3 symbol). RaptorQ runs over K' symbols (F = K'*T) and
1056
+ * `SSB_length = K'`.
1082
1057
  *
1083
1058
  * # Arguments
1084
- * * `block` - SBN (`k-padded-v1`) or SS_Start (`iso-ssbg1-v1`).
1059
+ * * `ss_start` - SS_Start: the block's first SS_ID.
1085
1060
  * * `source_block` - The block's source symbols, as described above.
1086
1061
  * * `repair_count` - Number of repair symbols (P) to generate.
1087
- * @param {number} block
1062
+ * @param {number} ss_start
1088
1063
  * @param {Uint8Array} source_block
1089
1064
  * @param {number} repair_count
1090
1065
  * @returns {Uint8Array}
1091
1066
  */
1092
- encode_repair(block, source_block, repair_count) {
1067
+ encode_repair(ss_start, source_block, repair_count) {
1093
1068
  const ptr0 = passArray8ToWasm0(source_block, wasm.__wbindgen_malloc);
1094
1069
  const len0 = WASM_VECTOR_LEN;
1095
- const ret = wasm.mmtfecencoder_encode_repair(this.__wbg_ptr, block, ptr0, len0, repair_count);
1070
+ const ret = wasm.mmtfecencoder_encode_repair(this.__wbg_ptr, ss_start, ptr0, len0, repair_count);
1096
1071
  if (ret[3]) {
1097
1072
  throw takeFromExternrefTable0(ret[2]);
1098
1073
  }
@@ -1112,13 +1087,13 @@ export class MmtFecEncoder {
1112
1087
  * Create an encoder for a fixed `(K, symbol_size)` block geometry.
1113
1088
  *
1114
1089
  * Builds the OTI as `ObjectTransmissionInformation::new(K*T, T, 1, 1, 8)`
1115
- * (single source block, single sub-block, byte alignment) — matching the
1116
- * decoder's recovery model in [`FecBlock::try_decode`] — and pre-computes
1117
- * the shared `SourceBlockEncodingPlan` so per-block encoding is cheap.
1090
+ * (single source block, single sub-block, byte alignment) — the geometry
1091
+ * [`MmtFecDecoder::configure`] reads back. K is the maximum SSB_length;
1092
+ * each block is encoded over its own K' symbols (see
1093
+ * [`MmtFecEncoder::encode_repair`]).
1118
1094
  *
1119
- * `block_profile` is the catalog `fec.blockProfile` (`"k-padded-v1"` or
1120
- * `"iso-ssbg1-v1"`); any other value is refused. Under `iso-ssbg1-v1`, K
1121
- * is the maximum SSB_length.
1095
+ * `block_profile` is the catalog `fec.blockProfile` (`"iso-ssbg1-v1"`);
1096
+ * any other value is refused.
1122
1097
  * @param {number} k
1123
1098
  * @param {number} symbol_size
1124
1099
  * @param {string} block_profile
@@ -2286,14 +2261,14 @@ export class ReassemblerStatsJs {
2286
2261
  * @returns {bigint}
2287
2262
  */
2288
2263
  get ambiguous_fallback_fragments() {
2289
- const ret = wasm.__wbg_get_reassemblerstatsjs_ambiguous_fallback_fragments(this.__wbg_ptr);
2264
+ const ret = wasm.__wbg_get_fecstats_unplaced_evicted(this.__wbg_ptr);
2290
2265
  return BigInt.asUintN(64, ret);
2291
2266
  }
2292
2267
  /**
2293
2268
  * @param {bigint} arg0
2294
2269
  */
2295
2270
  set ambiguous_fallback_fragments(arg0) {
2296
- wasm.__wbg_set_reassemblerstatsjs_ambiguous_fallback_fragments(this.__wbg_ptr, arg0);
2271
+ wasm.__wbg_set_fecstats_unplaced_evicted(this.__wbg_ptr, arg0);
2297
2272
  }
2298
2273
  }
2299
2274
  if (Symbol.dispose) ReassemblerStatsJs.prototype[Symbol.dispose] = ReassemblerStatsJs.prototype.free;
@@ -2338,7 +2313,7 @@ export class RecoveredSet {
2338
2313
  * @returns {number}
2339
2314
  */
2340
2315
  get fec_set_index() {
2341
- const ret = wasm.recoveredset_fec_set_index(this.__wbg_ptr);
2316
+ const ret = wasm.mmtfecencoder_k(this.__wbg_ptr);
2342
2317
  return ret >>> 0;
2343
2318
  }
2344
2319
  /**
Binary file
@@ -10,7 +10,7 @@ export const __wbg_get_fecstats_blocks_recovered: (a: number) => bigint;
10
10
  export const __wbg_get_fecstats_bytes_recovered: (a: number) => bigint;
11
11
  export const __wbg_get_fecstats_repair_packets: (a: number) => bigint;
12
12
  export const __wbg_get_fecstats_source_packets: (a: number) => bigint;
13
- export const __wbg_get_reassemblerstatsjs_ambiguous_fallback_fragments: (a: number) => bigint;
13
+ export const __wbg_get_fecstats_unplaced_evicted: (a: number) => bigint;
14
14
  export const __wbg_mfufragmentjs_free: (a: number, b: number) => void;
15
15
  export const __wbg_mmtfecdecoder_free: (a: number, b: number) => void;
16
16
  export const __wbg_mmtfecencoder_free: (a: number, b: number) => void;
@@ -23,7 +23,6 @@ export const __wbg_moqfecdecoder_free: (a: number, b: number) => void;
23
23
  export const __wbg_moqfecencoder_free: (a: number, b: number) => void;
24
24
  export const __wbg_moqfecstatsjs_free: (a: number, b: number) => void;
25
25
  export const __wbg_reassembledmfujs_free: (a: number, b: number) => void;
26
- export const __wbg_reassemblerstatsjs_free: (a: number, b: number) => void;
27
26
  export const __wbg_recoveredset_free: (a: number, b: number) => void;
28
27
  export const __wbg_samplecombinerstatsjs_free: (a: number, b: number) => void;
29
28
  export const __wbg_set_fecstats_blocks_complete: (a: number, b: bigint) => void;
@@ -33,7 +32,7 @@ export const __wbg_set_fecstats_blocks_recovered: (a: number, b: bigint) => void
33
32
  export const __wbg_set_fecstats_bytes_recovered: (a: number, b: bigint) => void;
34
33
  export const __wbg_set_fecstats_repair_packets: (a: number, b: bigint) => void;
35
34
  export const __wbg_set_fecstats_source_packets: (a: number, b: bigint) => void;
36
- export const __wbg_set_reassemblerstatsjs_ambiguous_fallback_fragments: (a: number, b: bigint) => void;
35
+ export const __wbg_set_fecstats_unplaced_evicted: (a: number, b: bigint) => void;
37
36
  export const __wbg_shredfecbuffer_free: (a: number, b: number) => void;
38
37
  export const __wbg_shredreassembler_free: (a: number, b: number) => void;
39
38
  export const annexb_access_unit_is_keyframe: (a: number, b: number, c: number, d: number) => [number, number, number];
@@ -64,7 +63,6 @@ export const mfufragmentjs_with_sample_identity: (a: number, b: number, c: numbe
64
63
  export const mmtfecdecoder_add_repair: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
65
64
  export const mmtfecdecoder_add_source: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
66
65
  export const mmtfecdecoder_cleanup_blocks_detailed: (a: number, b: number, c: number) => void;
67
- export const mmtfecdecoder_cleanup_by_sbn: (a: number, b: number) => [number, number, number, number];
68
66
  export const mmtfecdecoder_cleanup_by_ss_start: (a: number, b: number) => [number, number, number, number];
69
67
  export const mmtfecdecoder_configure: (a: number, b: number, c: number) => [number, number];
70
68
  export const mmtfecdecoder_configure_params: (a: number, b: number, c: number) => [number, number];
@@ -159,7 +157,6 @@ export const reassembledmfujs_repaired_packet_sequence_numbers: (a: number) => [
159
157
  export const reassembledmfujs_sample_number: (a: number) => number;
160
158
  export const reassembledmfujs_stream_identity: (a: number) => number;
161
159
  export const reassembledmfujs_timestamp: (a: number) => number;
162
- export const recoveredset_fec_set_index: (a: number) => number;
163
160
  export const recoveredset_payload: (a: number) => [number, number];
164
161
  export const recoveredset_slot: (a: number) => bigint;
165
162
  export const 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];
@@ -176,7 +173,9 @@ export const moqencodedblock_p: (a: number) => number;
176
173
  export const moqfecstatsjs_blocksComplete: (a: number) => number;
177
174
  export const moqfecstatsjs_blocksIncomplete: (a: number) => number;
178
175
  export const moqfecstatsjs_totalSymbolsReceived: (a: number) => number;
176
+ export const recoveredset_fec_set_index: (a: number) => number;
179
177
  export const shredreassembler_pending_fec_sets: (a: number) => number;
178
+ export const __wbg_get_reassemblerstatsjs_ambiguous_fallback_fragments: (a: number) => bigint;
180
179
  export const __wbg_get_reassemblerstatsjs_duplicate_fragments: (a: number) => bigint;
181
180
  export const __wbg_get_reassemblerstatsjs_evicted_data_units: (a: number) => bigint;
182
181
  export const __wbg_get_reassemblerstatsjs_evicted_memory_limit: (a: number) => bigint;
@@ -188,6 +187,8 @@ export const __wbg_get_samplecombinerstatsjs_combined_samples: (a: number) => bi
188
187
  export const __wbg_get_samplecombinerstatsjs_evicted_samples: (a: number) => bigint;
189
188
  export const __wbg_get_samplecombinerstatsjs_passthrough_samples: (a: number) => bigint;
190
189
  export const __wbg_get_samplecombinerstatsjs_timed_out_samples: (a: number) => bigint;
190
+ export const __wbg_reassemblerstatsjs_free: (a: number, b: number) => void;
191
+ export const __wbg_set_reassemblerstatsjs_ambiguous_fallback_fragments: (a: number, b: bigint) => void;
191
192
  export const __wbg_set_reassemblerstatsjs_duplicate_fragments: (a: number, b: bigint) => void;
192
193
  export const __wbg_set_reassemblerstatsjs_evicted_data_units: (a: number, b: bigint) => void;
193
194
  export const __wbg_set_reassemblerstatsjs_evicted_memory_limit: (a: number, b: bigint) => void;
@@ -46,6 +46,12 @@ declare namespace wasm_bindgen {
46
46
  * Blocks that expired with fewer than K symbols (delivery issue, not FEC issue)
47
47
  */
48
48
  blocks_delivery_failed: bigint;
49
+ /**
50
+ * `iso-ssbg1-v1` held sources evicted, oldest arrival first, because the
51
+ * unplaced pool was at its `(interleave_depth + 1) * K` cap: no sweep
52
+ * (`cleanup_by_ss_start` / `retire_unplaced`) retired them first.
53
+ */
54
+ unplaced_evicted: bigint;
49
55
  }
50
56
 
51
57
  export class MfuFragmentJs {
@@ -101,27 +107,15 @@ declare namespace wasm_bindgen {
101
107
  /**
102
108
  * Add a repair symbol per ISO 23008-1 §C.5.3.
103
109
  *
104
- * Repair carries (SS_Start, SSB_length, RS_ID).
105
- * SS_Start = SS_ID of first source in block = SBN * K.
106
- * SSB_length = the authored source-symbol count in this block (1..=K).
107
- * SBN = SS_Start / configured K.
108
- * Repair ESI = K + RS_ID.
109
- *
110
- * The decoder's configured K is the fixed RaptorQ geometry. A short
111
- * authored block (`SSB_length < K`) is the producer's K-symbol RaptorQ
112
- * block with ESIs `SSB_length..K` zero-filled and never transmitted
113
- * (fec-raptorq `InterleavedEncoder::force_complete`). The block records
114
- * `SSB_length`, completes once that many source symbols arrived, and
115
- * recovers from `SSB_length` received symbols by supplying the known
116
- * padding itself. A conflicting `SSB_length` for one block is rejected
117
- * without changing that block.
118
- *
119
- * Under `iso-ssbg1-v1` the block is `[SS_Start, SS_Start + SSB_length)`
120
- * with `1 <= SSB_length <= K` (K is only the maximum), its RaptorQ geometry
121
- * is K' = SSB_length with no padding, and repair ESI = SSB_length + RS_ID
122
- * (C.5.3). The first repair defines the block and claims every held source
123
- * in range. A conflicting SSB_length, or a range overlapping a different
124
- * known block, is refused without changing any block. Output is the K'*T
110
+ * Repair carries (SS_Start, SSB_length, RS_ID). The block is
111
+ * `[SS_Start, SS_Start + SSB_length)` with `1 <= SSB_length <= K` (the
112
+ * configured K is only the maximum), its RaptorQ geometry is
113
+ * K' = SSB_length with no padding, and repair ESI = SSB_length + RS_ID.
114
+ * The first repair defines the block and claims every held source in
115
+ * range. A conflicting SSB_length, a range overlapping a different known
116
+ * block, or a start more than `interleave_depth` blocks behind the last
117
+ * `cleanup_by_ss_start`'s `current` (`iso_blocks_behind_lower_bound`), is
118
+ * refused without changing any block. Output is the K'*T
125
119
  * concatenated ssbg_mode1 symbols: split by T and trim by the length field.
126
120
  */
127
121
  add_repair(ss_start: number, ssb_length: number, rs_id: number, data: Uint8Array, timestamp: number): Uint8Array | undefined;
@@ -131,13 +125,12 @@ declare namespace wasm_bindgen {
131
125
  * SS_ID is a flat 32-bit counter. An unconfigured decoder rejects the
132
126
  * packet.
133
127
  *
134
- * - `k-padded-v1`: derives SBN = floor(SS_ID / K), ESI = SS_ID % K and
135
- * zero-pads `data` to T.
136
- * - `iso-ssbg1-v1`: builds the C.3.3 ssbg_mode1 symbol
137
- * `u16be(len) || data || zero padding` (refusing `len + 2 > T`) and
138
- * places it at ESI = serial distance from the start of the known block
139
- * whose `[SS_Start, SS_Start + SSB_length)` contains SS_ID. A source
140
- * whose block no repair has defined yet is held by SS_ID until one does.
128
+ * Builds the C.3.3 ssbg_mode1 symbol `u16be(len) || data || zero padding`
129
+ * (refusing `len + 2 > T`) and places it at ESI = serial distance from the
130
+ * start of the known block whose `[SS_Start, SS_Start + SSB_length)`
131
+ * contains SS_ID. A source whose block no repair has defined yet is held
132
+ * by SS_ID until one does; at most `(interleave_depth + 1) * K` are held, and
133
+ * the oldest arrival is evicted first (`FecStats::unplaced_evicted`).
141
134
  *
142
135
  * # Arguments
143
136
  * * `ss_id` - Source symbol ID (32-bit monotonic counter)
@@ -153,18 +146,6 @@ declare namespace wasm_bindgen {
153
146
  * Get alignment (Al) parameter from OTI
154
147
  */
155
148
  get_alignment(): number;
156
- /**
157
- * `k-padded-v1` only: cleanup blocks more than `interleave_depth` blocks
158
- * behind `current_sbn`. Refused under `iso-ssbg1-v1`, which has no SBN
159
- * (use `cleanup_by_ss_start`).
160
- *
161
- * Blocks are ordered by RFC 1982 serial comparison of their first SS_ID
162
- * (`sbn * K mod 2^32`, ISO/IEC 23008-1 C.5.2; BLO-35597 iso:5). For a
163
- * stream that has not wrapped SS_ID that is exactly the old
164
- * `sbn < current_sbn - interleave_depth`; after the wrap it still retires
165
- * the pre-wrap blocks instead of keeping them forever.
166
- */
167
- cleanup_by_sbn(current_sbn: number): Uint32Array;
168
149
  /**
169
150
  * Get sub-blocks (N) parameter from OTI
170
151
  */
@@ -178,11 +159,11 @@ declare namespace wasm_bindgen {
178
159
  */
179
160
  get_symbol_size(): number;
180
161
  /**
181
- * `iso-ssbg1-v1` only: retire the held source symbols that no repair can
182
- * place any more, by the same rule as `cleanup_by_ss_start`, without
183
- * retiring any block. For a caller that retires blocks itself, by their
184
- * deadlines (`cleanup_blocks_detailed`), and needs only this half. Returns
185
- * how many it retired.
162
+ * Retire the held source symbols that no repair can place any more, by
163
+ * the same rule as `cleanup_by_ss_start`, without retiring any block. For
164
+ * a caller that retires blocks itself, by their deadlines
165
+ * (`cleanup_blocks_detailed`), and needs only this half. Returns how many
166
+ * it retired.
186
167
  */
187
168
  retire_unplaced(current: number): number;
188
169
  /**
@@ -202,11 +183,11 @@ declare namespace wasm_bindgen {
202
183
  */
203
184
  get_source_blocks(): number;
204
185
  /**
205
- * `iso-ssbg1-v1` only: retire every block, and every held source symbol,
206
- * lying more than `interleave_depth` blocks behind SS_ID `current`, the
207
- * newest SS_ID the caller has seen (no block start or held source follows
208
- * it). A block start or held source that `current` has moved at least
209
- * half the SS_ID space past no longer precedes it and is retired too
186
+ * Retire every block, and every held source symbol, lying more than
187
+ * `interleave_depth` blocks behind SS_ID `current`, the newest SS_ID the
188
+ * caller has seen (no block start or held source follows it). A block
189
+ * start or held source that `current` has moved at least half the SS_ID
190
+ * space past no longer precedes it and is retired too
210
191
  * (`iso_past_horizon`).
211
192
  *
212
193
  * Blocks have no SBN under ssbg_mode1, so distance is measured on the
@@ -222,21 +203,21 @@ declare namespace wasm_bindgen {
222
203
  */
223
204
  get_interleave_depth(): number;
224
205
  /**
225
- * Finalize only the source blocks whose host-owned deadlines fired.
226
- * Keys are SBNs under `k-padded-v1` and SS_Starts under `iso-ssbg1-v1`.
206
+ * Finalize only the source blocks whose host-owned deadlines fired,
207
+ * named by their SS_Starts.
227
208
  *
228
209
  * The JavaScript FEC manager owns per-block repair grace. A timeout for one
229
210
  * block must therefore not run the decoder's global age scan and evict a
230
211
  * peer block that is still waiting for fetched repair.
231
212
  */
232
- cleanup_blocks_detailed(sbns: Uint32Array): void;
213
+ cleanup_blocks_detailed(ss_starts: Uint32Array): void;
233
214
  /**
234
215
  * Create a new FEC decoder
235
216
  *
236
217
  * # Arguments
237
218
  * * `interleave_depth` - Explicit positive number of interleaved blocks.
238
- * * `block_profile` - Catalog `fec.blockProfile`: `"k-padded-v1"` or
239
- * `"iso-ssbg1-v1"`. Required; any other value is refused.
219
+ * * `block_profile` - Catalog `fec.blockProfile`: `"iso-ssbg1-v1"`.
220
+ * Required; any other value is refused.
240
221
  */
241
222
  constructor(interleave_depth: number, block_profile: string);
242
223
  /**
@@ -251,7 +232,8 @@ declare namespace wasm_bindgen {
251
232
  * Configure FEC from 12-byte OTI
252
233
  *
253
234
  * # Arguments
254
- * * `oti` - 12-byte Object Transmission Information from S-TSID fecOTI
235
+ * * `oti` - 12-byte RFC 6330 Common FEC OTI: decoder geometry per
236
+ * draft-fec-01 Section 4.2 (Z = 1, N = 1, Al = 8)
255
237
  */
256
238
  configure(oti: Uint8Array): void;
257
239
  /**
@@ -271,33 +253,28 @@ declare namespace wasm_bindgen {
271
253
  * `[SS_Start:4][RSB_length:3][RS_ID:3][SSB_length:3][symbol: T]`.
272
254
  * Callers split on that stride; `entry i` is at `i * (13 + T)`.
273
255
  *
274
- * `k-padded-v1`: `block` is the Source Block Number and `source_block`
275
- * MUST be exactly `K * symbol_size` bytes — the caller pads the final
276
- * (short) block with zeros, mirroring `InterleavedEncoder` and the FFmpeg
277
- * path. `SS_Start = block * K` (wrapping), `SSB_length = K`.
278
- *
279
- * `iso-ssbg1-v1`: `block` is the SS_Start (the block's first SS_ID) and
280
- * `source_block` is the block's K' ssbg_mode1 symbols (`1 <= K' <= K`,
281
- * `len % T == 0`, each a well-formed C.3.3 symbol). RaptorQ runs over K'
282
- * symbols (F = K'*T) and `SSB_length = K'`.
256
+ * `ss_start` is the block's first SS_ID and `source_block` is the
257
+ * block's K' ssbg_mode1 symbols (`1 <= K' <= K`, `len % T == 0`, each a
258
+ * well-formed C.3.3 symbol). RaptorQ runs over K' symbols (F = K'*T) and
259
+ * `SSB_length = K'`.
283
260
  *
284
261
  * # Arguments
285
- * * `block` - SBN (`k-padded-v1`) or SS_Start (`iso-ssbg1-v1`).
262
+ * * `ss_start` - SS_Start: the block's first SS_ID.
286
263
  * * `source_block` - The block's source symbols, as described above.
287
264
  * * `repair_count` - Number of repair symbols (P) to generate.
288
265
  */
289
- encode_repair(block: number, source_block: Uint8Array, repair_count: number): Uint8Array;
266
+ encode_repair(ss_start: number, source_block: Uint8Array, repair_count: number): Uint8Array;
290
267
  /**
291
268
  * Create an encoder for a fixed `(K, symbol_size)` block geometry.
292
269
  *
293
270
  * Builds the OTI as `ObjectTransmissionInformation::new(K*T, T, 1, 1, 8)`
294
- * (single source block, single sub-block, byte alignment) — matching the
295
- * decoder's recovery model in [`FecBlock::try_decode`] — and pre-computes
296
- * the shared `SourceBlockEncodingPlan` so per-block encoding is cheap.
271
+ * (single source block, single sub-block, byte alignment) — the geometry
272
+ * [`MmtFecDecoder::configure`] reads back. K is the maximum SSB_length;
273
+ * each block is encoded over its own K' symbols (see
274
+ * [`MmtFecEncoder::encode_repair`]).
297
275
  *
298
- * `block_profile` is the catalog `fec.blockProfile` (`"k-padded-v1"` or
299
- * `"iso-ssbg1-v1"`); any other value is refused. Under `iso-ssbg1-v1`, K
300
- * is the maximum SSB_length.
276
+ * `block_profile` is the catalog `fec.blockProfile` (`"iso-ssbg1-v1"`);
277
+ * any other value is refused.
301
278
  */
302
279
  constructor(k: number, symbol_size: number, block_profile: string);
303
280
  /**
@@ -811,7 +788,7 @@ declare interface InitOutput {
811
788
  readonly __wbg_get_fecstats_bytes_recovered: (a: number) => bigint;
812
789
  readonly __wbg_get_fecstats_repair_packets: (a: number) => bigint;
813
790
  readonly __wbg_get_fecstats_source_packets: (a: number) => bigint;
814
- readonly __wbg_get_reassemblerstatsjs_ambiguous_fallback_fragments: (a: number) => bigint;
791
+ readonly __wbg_get_fecstats_unplaced_evicted: (a: number) => bigint;
815
792
  readonly __wbg_mfufragmentjs_free: (a: number, b: number) => void;
816
793
  readonly __wbg_mmtfecdecoder_free: (a: number, b: number) => void;
817
794
  readonly __wbg_mmtfecencoder_free: (a: number, b: number) => void;
@@ -824,7 +801,6 @@ declare interface InitOutput {
824
801
  readonly __wbg_moqfecencoder_free: (a: number, b: number) => void;
825
802
  readonly __wbg_moqfecstatsjs_free: (a: number, b: number) => void;
826
803
  readonly __wbg_reassembledmfujs_free: (a: number, b: number) => void;
827
- readonly __wbg_reassemblerstatsjs_free: (a: number, b: number) => void;
828
804
  readonly __wbg_recoveredset_free: (a: number, b: number) => void;
829
805
  readonly __wbg_samplecombinerstatsjs_free: (a: number, b: number) => void;
830
806
  readonly __wbg_set_fecstats_blocks_complete: (a: number, b: bigint) => void;
@@ -834,7 +810,7 @@ declare interface InitOutput {
834
810
  readonly __wbg_set_fecstats_bytes_recovered: (a: number, b: bigint) => void;
835
811
  readonly __wbg_set_fecstats_repair_packets: (a: number, b: bigint) => void;
836
812
  readonly __wbg_set_fecstats_source_packets: (a: number, b: bigint) => void;
837
- readonly __wbg_set_reassemblerstatsjs_ambiguous_fallback_fragments: (a: number, b: bigint) => void;
813
+ readonly __wbg_set_fecstats_unplaced_evicted: (a: number, b: bigint) => void;
838
814
  readonly __wbg_shredfecbuffer_free: (a: number, b: number) => void;
839
815
  readonly __wbg_shredreassembler_free: (a: number, b: number) => void;
840
816
  readonly annexb_access_unit_is_keyframe: (a: number, b: number, c: number, d: number) => [number, number, number];
@@ -865,7 +841,6 @@ declare interface InitOutput {
865
841
  readonly mmtfecdecoder_add_repair: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
866
842
  readonly mmtfecdecoder_add_source: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
867
843
  readonly mmtfecdecoder_cleanup_blocks_detailed: (a: number, b: number, c: number) => void;
868
- readonly mmtfecdecoder_cleanup_by_sbn: (a: number, b: number) => [number, number, number, number];
869
844
  readonly mmtfecdecoder_cleanup_by_ss_start: (a: number, b: number) => [number, number, number, number];
870
845
  readonly mmtfecdecoder_configure: (a: number, b: number, c: number) => [number, number];
871
846
  readonly mmtfecdecoder_configure_params: (a: number, b: number, c: number) => [number, number];
@@ -960,7 +935,6 @@ declare interface InitOutput {
960
935
  readonly reassembledmfujs_sample_number: (a: number) => number;
961
936
  readonly reassembledmfujs_stream_identity: (a: number) => number;
962
937
  readonly reassembledmfujs_timestamp: (a: number) => number;
963
- readonly recoveredset_fec_set_index: (a: number) => number;
964
938
  readonly recoveredset_payload: (a: number) => [number, number];
965
939
  readonly recoveredset_slot: (a: number) => bigint;
966
940
  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];
@@ -977,7 +951,9 @@ declare interface InitOutput {
977
951
  readonly moqfecstatsjs_blocksComplete: (a: number) => number;
978
952
  readonly moqfecstatsjs_blocksIncomplete: (a: number) => number;
979
953
  readonly moqfecstatsjs_totalSymbolsReceived: (a: number) => number;
954
+ readonly recoveredset_fec_set_index: (a: number) => number;
980
955
  readonly shredreassembler_pending_fec_sets: (a: number) => number;
956
+ readonly __wbg_get_reassemblerstatsjs_ambiguous_fallback_fragments: (a: number) => bigint;
981
957
  readonly __wbg_get_reassemblerstatsjs_duplicate_fragments: (a: number) => bigint;
982
958
  readonly __wbg_get_reassemblerstatsjs_evicted_data_units: (a: number) => bigint;
983
959
  readonly __wbg_get_reassemblerstatsjs_evicted_memory_limit: (a: number) => bigint;
@@ -989,6 +965,8 @@ declare interface InitOutput {
989
965
  readonly __wbg_get_samplecombinerstatsjs_evicted_samples: (a: number) => bigint;
990
966
  readonly __wbg_get_samplecombinerstatsjs_passthrough_samples: (a: number) => bigint;
991
967
  readonly __wbg_get_samplecombinerstatsjs_timed_out_samples: (a: number) => bigint;
968
+ readonly __wbg_reassemblerstatsjs_free: (a: number, b: number) => void;
969
+ readonly __wbg_set_reassemblerstatsjs_ambiguous_fallback_fragments: (a: number, b: bigint) => void;
992
970
  readonly __wbg_set_reassemblerstatsjs_duplicate_fragments: (a: number, b: bigint) => void;
993
971
  readonly __wbg_set_reassemblerstatsjs_evicted_data_units: (a: number, b: bigint) => void;
994
972
  readonly __wbg_set_reassemblerstatsjs_evicted_memory_limit: (a: number, b: bigint) => void;