@blockcast/mmt-transport 0.2.2 → 0.3.0
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 +44 -58
- package/dist/abr-controller.d.ts +34 -4
- package/dist/abr-controller.d.ts.map +1 -1
- package/dist/abr-controller.js +66 -17
- package/dist/abr-controller.js.map +1 -1
- package/dist/amt-gateway.d.ts.map +1 -1
- package/dist/amt-gateway.js +3 -4
- package/dist/amt-gateway.js.map +1 -1
- package/dist/driad-discovery.d.ts.map +1 -1
- package/dist/driad-discovery.js +3 -6
- package/dist/driad-discovery.js.map +1 -1
- package/dist/endpoint-config.d.ts +68 -0
- package/dist/endpoint-config.d.ts.map +1 -1
- package/dist/endpoint-config.js +118 -3
- package/dist/endpoint-config.js.map +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -11
- package/dist/index.js.map +1 -1
- package/dist/mmt-transport.no-modules.js +881 -60
- package/dist/mmt-transport.no-modules.js.map +4 -4
- package/dist/moqt-priority.d.ts +39 -0
- package/dist/moqt-priority.d.ts.map +1 -0
- package/dist/moqt-priority.js +41 -0
- package/dist/moqt-priority.js.map +1 -0
- package/dist/multicast-catalog-policy.d.ts +96 -0
- package/dist/multicast-catalog-policy.d.ts.map +1 -0
- package/dist/multicast-catalog-policy.js +660 -0
- package/dist/multicast-catalog-policy.js.map +1 -0
- package/dist/multicast-orchestrator.d.ts +24 -0
- package/dist/multicast-orchestrator.d.ts.map +1 -1
- package/dist/multicast-orchestrator.js +102 -9
- package/dist/multicast-orchestrator.js.map +1 -1
- package/dist/multicast-signaling-reconciler.d.ts +37 -0
- package/dist/multicast-signaling-reconciler.d.ts.map +1 -0
- package/dist/multicast-signaling-reconciler.js +161 -0
- package/dist/multicast-signaling-reconciler.js.map +1 -0
- package/dist/multicast-subscription-pool.d.ts.map +1 -1
- package/dist/multicast-subscription-pool.js +37 -10
- package/dist/multicast-subscription-pool.js.map +1 -1
- package/dist/multicast-tier.d.ts +19 -0
- package/dist/multicast-tier.d.ts.map +1 -1
- package/dist/multicast-tier.js +21 -4
- package/dist/multicast-tier.js.map +1 -1
- package/dist/no-modules.d.ts +40 -3
- package/dist/no-modules.d.ts.map +1 -1
- package/dist/no-modules.js +30 -3
- package/dist/no-modules.js.map +1 -1
- package/dist/packet-batch.d.ts +13 -0
- package/dist/packet-batch.d.ts.map +1 -0
- package/dist/packet-batch.js +14 -0
- package/dist/packet-batch.js.map +1 -0
- package/dist/stall-detector.d.ts +10 -0
- package/dist/stall-detector.d.ts.map +1 -1
- package/dist/stall-detector.js +21 -0
- package/dist/stall-detector.js.map +1 -1
- package/dist/takeover.d.ts +3 -0
- package/dist/takeover.d.ts.map +1 -1
- package/dist/takeover.js +35 -2
- package/dist/takeover.js.map +1 -1
- package/dist/transport-manager.d.ts +21 -17
- package/dist/transport-manager.d.ts.map +1 -1
- package/dist/transport-manager.js +63 -29
- package/dist/transport-manager.js.map +1 -1
- package/dist/types.d.ts +98 -123
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +12 -50
- package/dist/types.js.map +1 -1
- package/node_modules/@blockcast/mmt-alta-parse/README.md +181 -0
- package/node_modules/@blockcast/mmt-alta-parse/dist/.build-stamp +0 -0
- package/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts +57 -0
- package/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts.map +1 -0
- package/node_modules/@blockcast/mmt-alta-parse/dist/index.js +115 -0
- package/node_modules/@blockcast/mmt-alta-parse/dist/index.js.map +1 -0
- package/node_modules/@blockcast/mmt-alta-parse/package.json +50 -0
- package/node_modules/@blockcast/mmt-alta-parse/src/index.ts +136 -0
- package/node_modules/@blockcast/mmt-base/README.md +134 -0
- package/node_modules/@blockcast/mmt-base/dist/.build-stamp +0 -0
- package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.d.ts +55 -0
- package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.d.ts.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.js +128 -0
- package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.js.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/index.d.ts +7 -0
- package/node_modules/@blockcast/mmt-base/dist/index.d.ts.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/index.js +7 -0
- package/node_modules/@blockcast/mmt-base/dist/index.js.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts +292 -0
- package/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/mmtp.js +612 -0
- package/node_modules/@blockcast/mmt-base/dist/mmtp.js.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/net-constants.d.ts +18 -0
- package/node_modules/@blockcast/mmt-base/dist/net-constants.d.ts.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/net-constants.js +18 -0
- package/node_modules/@blockcast/mmt-base/dist/net-constants.js.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/ntp-short.d.ts +47 -0
- package/node_modules/@blockcast/mmt-base/dist/ntp-short.d.ts.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/ntp-short.js +54 -0
- package/node_modules/@blockcast/mmt-base/dist/ntp-short.js.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/serial-number.d.ts +57 -0
- package/node_modules/@blockcast/mmt-base/dist/serial-number.d.ts.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/serial-number.js +98 -0
- package/node_modules/@blockcast/mmt-base/dist/serial-number.js.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/signalling.d.ts +312 -0
- package/node_modules/@blockcast/mmt-base/dist/signalling.d.ts.map +1 -0
- package/node_modules/@blockcast/mmt-base/dist/signalling.js +637 -0
- package/node_modules/@blockcast/mmt-base/dist/signalling.js.map +1 -0
- package/node_modules/@blockcast/mmt-base/package.json +49 -0
- package/node_modules/@blockcast/mmt-base/src/fec-block-profile.ts +145 -0
- package/node_modules/@blockcast/mmt-base/src/index.ts +6 -0
- package/node_modules/@blockcast/mmt-base/src/mmtp.ts +892 -0
- package/node_modules/@blockcast/mmt-base/src/net-constants.ts +17 -0
- package/node_modules/@blockcast/mmt-base/src/ntp-short.ts +67 -0
- package/node_modules/@blockcast/mmt-base/src/serial-number.ts +107 -0
- package/node_modules/@blockcast/mmt-base/src/signalling.ts +862 -0
- package/package.json +13 -6
- package/src/abr-controller.ts +81 -17
- package/src/amt-gateway.ts +3 -5
- package/src/driad-discovery.ts +3 -6
- package/src/endpoint-config.ts +157 -3
- package/src/index.ts +54 -33
- package/src/moqt-priority.ts +51 -0
- package/src/multicast-catalog-policy.ts +753 -0
- package/src/multicast-orchestrator.ts +114 -10
- package/src/multicast-signaling-reconciler.ts +156 -0
- package/src/multicast-subscription-pool.ts +46 -11
- package/src/multicast-tier.ts +30 -3
- package/src/no-modules.ts +54 -2
- package/src/packet-batch.ts +17 -0
- package/src/stall-detector.ts +37 -0
- package/src/takeover.ts +41 -3
- package/src/transport-manager.ts +64 -34
- package/src/types.ts +103 -160
- package/dist/endpoint-config.test.d.ts +0 -2
- package/dist/endpoint-config.test.d.ts.map +0 -1
- package/dist/endpoint-config.test.js +0 -39
- package/dist/endpoint-config.test.js.map +0 -1
- package/dist/fec-client.d.ts +0 -442
- package/dist/fec-client.d.ts.map +0 -1
- package/dist/fec-client.js +0 -789
- package/dist/fec-client.js.map +0 -1
- package/dist/fec-client.test.d.ts +0 -8
- package/dist/fec-client.test.d.ts.map +0 -1
- package/dist/fec-client.test.js +0 -112
- package/dist/fec-client.test.js.map +0 -1
- package/dist/multicast-subscription-pool.test.d.ts +0 -2
- package/dist/multicast-subscription-pool.test.d.ts.map +0 -1
- package/dist/multicast-subscription-pool.test.js +0 -108
- package/dist/multicast-subscription-pool.test.js.map +0 -1
- package/dist/multicast-tier.test.d.ts +0 -2
- package/dist/multicast-tier.test.d.ts.map +0 -1
- package/dist/multicast-tier.test.js +0 -75
- package/dist/multicast-tier.test.js.map +0 -1
- package/dist/stall-detector.test.d.ts +0 -2
- package/dist/stall-detector.test.d.ts.map +0 -1
- package/dist/stall-detector.test.js +0 -33
- package/dist/stall-detector.test.js.map +0 -1
- package/dist/transport-manager.test.d.ts +0 -2
- package/dist/transport-manager.test.d.ts.map +0 -1
- package/dist/transport-manager.test.js +0 -155
- package/dist/transport-manager.test.js.map +0 -1
- package/src/endpoint-config.test.ts +0 -54
- package/src/fec-client.test.ts +0 -140
- package/src/fec-client.ts +0 -1103
- package/src/multicast-subscription-pool.test.ts +0 -115
- package/src/multicast-tier.test.ts +0 -80
- package/src/stall-detector.test.ts +0 -34
- 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
|
-
});
|
package/src/fec-client.test.ts
DELETED
|
@@ -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
|
-
});
|