@blockcast/mmt-transport 0.2.2 → 0.3.0-main.1cd3cdea89da

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +44 -58
  2. package/dist/abr-controller.d.ts +34 -4
  3. package/dist/abr-controller.d.ts.map +1 -1
  4. package/dist/abr-controller.js +66 -17
  5. package/dist/abr-controller.js.map +1 -1
  6. package/dist/amt-gateway.d.ts.map +1 -1
  7. package/dist/amt-gateway.js +3 -4
  8. package/dist/amt-gateway.js.map +1 -1
  9. package/dist/driad-discovery.d.ts.map +1 -1
  10. package/dist/driad-discovery.js +3 -6
  11. package/dist/driad-discovery.js.map +1 -1
  12. package/dist/endpoint-config.d.ts +68 -0
  13. package/dist/endpoint-config.d.ts.map +1 -1
  14. package/dist/endpoint-config.js +118 -3
  15. package/dist/endpoint-config.js.map +1 -1
  16. package/dist/index.d.ts +10 -8
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +8 -11
  19. package/dist/index.js.map +1 -1
  20. package/dist/mmt-transport.no-modules.js +896 -61
  21. package/dist/mmt-transport.no-modules.js.map +4 -4
  22. package/dist/moqt-priority.d.ts +39 -0
  23. package/dist/moqt-priority.d.ts.map +1 -0
  24. package/dist/moqt-priority.js +41 -0
  25. package/dist/moqt-priority.js.map +1 -0
  26. package/dist/multicast-catalog-policy.d.ts +96 -0
  27. package/dist/multicast-catalog-policy.d.ts.map +1 -0
  28. package/dist/multicast-catalog-policy.js +660 -0
  29. package/dist/multicast-catalog-policy.js.map +1 -0
  30. package/dist/multicast-orchestrator.d.ts +35 -0
  31. package/dist/multicast-orchestrator.d.ts.map +1 -1
  32. package/dist/multicast-orchestrator.js +128 -10
  33. package/dist/multicast-orchestrator.js.map +1 -1
  34. package/dist/multicast-signaling-reconciler.d.ts +37 -0
  35. package/dist/multicast-signaling-reconciler.d.ts.map +1 -0
  36. package/dist/multicast-signaling-reconciler.js +161 -0
  37. package/dist/multicast-signaling-reconciler.js.map +1 -0
  38. package/dist/multicast-subscription-pool.d.ts.map +1 -1
  39. package/dist/multicast-subscription-pool.js +37 -10
  40. package/dist/multicast-subscription-pool.js.map +1 -1
  41. package/dist/multicast-tier.d.ts +19 -0
  42. package/dist/multicast-tier.d.ts.map +1 -1
  43. package/dist/multicast-tier.js +21 -4
  44. package/dist/multicast-tier.js.map +1 -1
  45. package/dist/no-modules.d.ts +40 -3
  46. package/dist/no-modules.d.ts.map +1 -1
  47. package/dist/no-modules.js +30 -3
  48. package/dist/no-modules.js.map +1 -1
  49. package/dist/packet-batch.d.ts +13 -0
  50. package/dist/packet-batch.d.ts.map +1 -0
  51. package/dist/packet-batch.js +14 -0
  52. package/dist/packet-batch.js.map +1 -0
  53. package/dist/stall-detector.d.ts +10 -0
  54. package/dist/stall-detector.d.ts.map +1 -1
  55. package/dist/stall-detector.js +21 -0
  56. package/dist/stall-detector.js.map +1 -1
  57. package/dist/takeover.d.ts +3 -0
  58. package/dist/takeover.d.ts.map +1 -1
  59. package/dist/takeover.js +35 -2
  60. package/dist/takeover.js.map +1 -1
  61. package/dist/transport-manager.d.ts +21 -17
  62. package/dist/transport-manager.d.ts.map +1 -1
  63. package/dist/transport-manager.js +63 -29
  64. package/dist/transport-manager.js.map +1 -1
  65. package/dist/types.d.ts +98 -123
  66. package/dist/types.d.ts.map +1 -1
  67. package/dist/types.js +12 -50
  68. package/dist/types.js.map +1 -1
  69. package/package.json +13 -7
  70. package/src/abr-controller.ts +81 -17
  71. package/src/amt-gateway.ts +3 -5
  72. package/src/driad-discovery.ts +3 -6
  73. package/src/endpoint-config.ts +157 -3
  74. package/src/index.ts +54 -33
  75. package/src/moqt-priority.ts +51 -0
  76. package/src/multicast-catalog-policy.ts +753 -0
  77. package/src/multicast-orchestrator.ts +138 -11
  78. package/src/multicast-signaling-reconciler.ts +156 -0
  79. package/src/multicast-subscription-pool.ts +46 -11
  80. package/src/multicast-tier.ts +30 -3
  81. package/src/no-modules.ts +54 -2
  82. package/src/packet-batch.ts +17 -0
  83. package/src/stall-detector.ts +37 -0
  84. package/src/takeover.ts +41 -3
  85. package/src/transport-manager.ts +64 -34
  86. package/src/types.ts +103 -160
  87. package/vectors/multicast-tier-switch/README.md +18 -0
  88. package/vectors/multicast-tier-switch/cases.json +646 -0
  89. package/dist/endpoint-config.test.d.ts +0 -2
  90. package/dist/endpoint-config.test.d.ts.map +0 -1
  91. package/dist/endpoint-config.test.js +0 -39
  92. package/dist/endpoint-config.test.js.map +0 -1
  93. package/dist/fec-client.d.ts +0 -442
  94. package/dist/fec-client.d.ts.map +0 -1
  95. package/dist/fec-client.js +0 -789
  96. package/dist/fec-client.js.map +0 -1
  97. package/dist/fec-client.test.d.ts +0 -8
  98. package/dist/fec-client.test.d.ts.map +0 -1
  99. package/dist/fec-client.test.js +0 -112
  100. package/dist/fec-client.test.js.map +0 -1
  101. package/dist/multicast-subscription-pool.test.d.ts +0 -2
  102. package/dist/multicast-subscription-pool.test.d.ts.map +0 -1
  103. package/dist/multicast-subscription-pool.test.js +0 -108
  104. package/dist/multicast-subscription-pool.test.js.map +0 -1
  105. package/dist/multicast-tier.test.d.ts +0 -2
  106. package/dist/multicast-tier.test.d.ts.map +0 -1
  107. package/dist/multicast-tier.test.js +0 -75
  108. package/dist/multicast-tier.test.js.map +0 -1
  109. package/dist/stall-detector.test.d.ts +0 -2
  110. package/dist/stall-detector.test.d.ts.map +0 -1
  111. package/dist/stall-detector.test.js +0 -33
  112. package/dist/stall-detector.test.js.map +0 -1
  113. package/dist/transport-manager.test.d.ts +0 -2
  114. package/dist/transport-manager.test.d.ts.map +0 -1
  115. package/dist/transport-manager.test.js +0 -155
  116. package/dist/transport-manager.test.js.map +0 -1
  117. package/src/endpoint-config.test.ts +0 -54
  118. package/src/fec-client.test.ts +0 -140
  119. package/src/fec-client.ts +0 -1103
  120. package/src/multicast-subscription-pool.test.ts +0 -115
  121. package/src/multicast-tier.test.ts +0 -80
  122. package/src/stall-detector.test.ts +0 -34
  123. package/src/transport-manager.test.ts +0 -192
@@ -1,54 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import {
3
- isMulticastExplicitlyDisabled,
4
- multicastEndpointKey,
5
- normalizeMulticastEndpoint,
6
- readUrlMulticastConfig,
7
- } from "./endpoint-config.js";
8
-
9
- describe("multicast endpoint config", () => {
10
- it("normalizes endpoint identity", () => {
11
- const endpoint = normalizeMulticastEndpoint({
12
- groupAddress: " 232.99.0.10 ",
13
- sourceAddress: " 69.25.95.101 ",
14
- port: 5050,
15
- });
16
- expect(endpoint).toEqual({
17
- groupAddress: "232.99.0.10",
18
- sourceAddress: "69.25.95.101",
19
- port: 5050,
20
- });
21
- expect(multicastEndpointKey(endpoint!)).toBe(
22
- '["69.25.95.101","232.99.0.10",5050,"auto","",""]',
23
- );
24
- });
25
-
26
- it("does not alias endpoint fields containing key delimiters", () => {
27
- const base = { groupAddress: "232.99.0.10", port: 5050, mode: "tunnel" as const };
28
- expect(multicastEndpointKey({ ...base, amtRelay: "relay|2268" })).not.toBe(
29
- multicastEndpointKey({ ...base, amtRelay: "relay", amtRelayPort: 2268 }),
30
- );
31
- });
32
-
33
- it("rejects invalid groups and ports", () => {
34
- expect(normalizeMulticastEndpoint({ groupAddress: "127.0.0.1", port: 5050 })).toBeUndefined();
35
- expect(normalizeMulticastEndpoint({ groupAddress: "232.1.1.1", port: 0 })).toBeUndefined();
36
- });
37
-
38
- it("preserves explicit AMT URL configuration", () => {
39
- expect(readUrlMulticastConfig(
40
- "?mc_group=232.99.0.10&mc_source=69.25.95.101&mc_port=5050&mc_amt_relay=relay.example&mc_amt_relay_port=2268",
41
- )).toEqual({
42
- groupAddress: "232.99.0.10",
43
- sourceAddress: "69.25.95.101",
44
- port: 5050,
45
- mode: "tunnel",
46
- amtRelay: "relay.example",
47
- amtRelayPort: 2268,
48
- });
49
- });
50
-
51
- it("recognizes explicit MoQ-only selection", () => {
52
- expect(isMulticastExplicitlyDisabled("?transport=moq-only")).toBe(true);
53
- });
54
- });
@@ -1,140 +0,0 @@
1
- /**
2
- * Tests for FEC Client
3
- *
4
- * Note: MmtFecClient requires WASM module which is tested separately in mmt-wasm.
5
- * These tests cover the pure TypeScript parts (MfuReassembler) and type exports.
6
- */
7
-
8
- import { describe, expect, it, beforeEach } from "vitest";
9
- import type { FecDecoderConfig, MoqFecClientConfig } from "./fec-client.js";
10
- import { MoqFecClient } from "./fec-client.js";
11
-
12
- describe("FecDecoderConfig interface", () => {
13
- it("should have correct shape", () => {
14
- const config: FecDecoderConfig = {
15
- symbolSize: 1280,
16
- sourceBlocks: 1,
17
- subBlocks: 1,
18
- alignment: 8,
19
- interleaveDepth: 30,
20
- };
21
-
22
- expect(config.symbolSize).toBe(1280);
23
- expect(config.sourceBlocks).toBe(1);
24
- expect(config.subBlocks).toBe(1);
25
- expect(config.alignment).toBe(8);
26
- expect(config.interleaveDepth).toBe(30);
27
- });
28
- });
29
-
30
- describe("MoqFecClient", () => {
31
- let client: MoqFecClient;
32
-
33
- beforeEach(() => {
34
- client = new MoqFecClient({
35
- symbolSize: 1280,
36
- k: 10,
37
- p: 3,
38
- interleaveDepth: 30,
39
- });
40
- });
41
-
42
- it("should create with default config", () => {
43
- const defaultClient = new MoqFecClient();
44
- const config = defaultClient.getConfig();
45
-
46
- expect(config.symbolSize).toBe(1280);
47
- expect(config.k).toBe(10);
48
- expect(config.p).toBe(3);
49
- expect(config.interleaveDepth).toBe(30);
50
- });
51
-
52
- it("should create with custom config", () => {
53
- const config = client.getConfig();
54
-
55
- expect(config.symbolSize).toBe(1280);
56
- expect(config.k).toBe(10);
57
- expect(config.p).toBe(3);
58
- expect(config.interleaveDepth).toBe(30);
59
- });
60
-
61
- it("should not be initialized without WASM module", () => {
62
- expect(client.isInitialized()).toBe(false);
63
- expect(client.isDecoderReady()).toBe(false);
64
- });
65
-
66
- it("should return default stats when not initialized", () => {
67
- const stats = client.getStats();
68
-
69
- expect(stats.blocksComplete).toBe(0);
70
- expect(stats.blocksIncomplete).toBe(0);
71
- expect(stats.totalSymbolsReceived).toBe(0);
72
- expect(stats.effectiveLossRate).toBe(0);
73
- expect(stats.recoveryRate).toBe(1);
74
- });
75
-
76
- it("should return ABR stats when not initialized", () => {
77
- const abrStats = client.getAbrStats();
78
-
79
- expect(abrStats.effectiveLossRate).toBe(0);
80
- expect(abrStats.rawLossRate).toBe(0);
81
- expect(abrStats.recoveryRate).toBe(1);
82
- expect(abrStats.fecEnabled).toBe(false);
83
- });
84
-
85
- it("should calculate max block size", () => {
86
- // Without WASM, uses config values: k * symbolSize
87
- const maxSize = client.getMaxBlockSize();
88
- expect(maxSize).toBe(10 * 1280); // k=10, symbolSize=1280
89
- });
90
-
91
- it("should calculate overhead ratio", () => {
92
- // Without WASM, uses config values: p / k
93
- const overhead = client.getOverheadRatio();
94
- expect(overhead).toBe(3 / 10); // p=3, k=10
95
- });
96
-
97
- it("should throw when encoding without initialization", () => {
98
- expect(() => client.encodeBlock(new Uint8Array(100))).toThrow(
99
- "MoqFecClient not initialized"
100
- );
101
- });
102
-
103
- it("should return null when adding source symbol without decoder", () => {
104
- const result = client.addSourceSymbol(0, 0, new Uint8Array(100));
105
- expect(result).toBeNull();
106
- });
107
-
108
- it("should return null when adding repair symbol without decoder", () => {
109
- const result = client.addRepairSymbol(0, 0, new Uint8Array(100));
110
- expect(result).toBeNull();
111
- });
112
-
113
- it("should dispose cleanly", () => {
114
- client.dispose();
115
- expect(client.isInitialized()).toBe(false);
116
- expect(client.getOti()).toBeNull();
117
- });
118
-
119
- it("should reject invalid OTI length", () => {
120
- expect(() => client.setOti(new Uint8Array(10))).toThrow(
121
- "OTI must be exactly 12 bytes"
122
- );
123
- });
124
- });
125
-
126
- describe("MoqFecClientConfig type", () => {
127
- it("should allow partial config", () => {
128
- const partial: Partial<MoqFecClientConfig> = {
129
- k: 20,
130
- };
131
-
132
- const client = new MoqFecClient(partial);
133
- const config = client.getConfig();
134
-
135
- expect(config.k).toBe(20);
136
- expect(config.p).toBe(3); // default
137
- expect(config.symbolSize).toBe(1280); // default
138
- expect(config.interleaveDepth).toBe(30); // default
139
- });
140
- });