@blockcast/mmt-container 0.4.0-main.bb90ce9247fa → 0.4.0-main.bbdfdbf39ded
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 +36 -20
- package/dist/align.d.ts +24 -18
- package/dist/align.d.ts.map +1 -1
- package/dist/align.js +23 -4
- package/dist/align.js.map +2 -2
- package/dist/browser-runtime.js +1721 -705
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +72 -34
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +309 -204
- package/dist/carp-catalog.js.map +3 -3
- package/dist/catalog-fec-params.d.ts +15 -4
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +137 -50
- package/dist/catalog-fec-params.js.map +4 -4
- package/dist/catalog-network-source.d.ts +24 -2
- package/dist/catalog-network-source.d.ts.map +1 -1
- package/dist/catalog-network-source.js +24 -1
- package/dist/catalog-network-source.js.map +3 -3
- package/dist/catalog-validator.d.ts +4 -3
- package/dist/catalog-validator.d.ts.map +1 -1
- package/dist/catalog-validator.js +0 -29
- package/dist/catalog-validator.js.map +3 -3
- package/dist/delivery-catalog.js +100 -230
- package/dist/delivery-catalog.js.map +4 -4
- package/dist/fec-manager.d.ts +64 -1
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +275 -62
- package/dist/fec-manager.js.map +4 -4
- package/dist/fec-state.d.ts +5 -3
- package/dist/fec-state.d.ts.map +1 -1
- package/dist/fec-state.js +34 -12
- package/dist/fec-state.js.map +4 -4
- package/dist/fec-worker-setup.d.ts +2 -0
- package/dist/fec-worker-setup.d.ts.map +1 -1
- package/dist/fec-worker-setup.js +15 -3
- package/dist/fec-worker-setup.js.map +3 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -8
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.d.ts +29 -0
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +100 -17
- package/dist/iso-block-locator.js.map +4 -4
- package/dist/manifest-auth-plan.d.ts +26 -25
- package/dist/manifest-auth-plan.d.ts.map +1 -1
- package/dist/manifest-auth-plan.js +331 -1171
- package/dist/manifest-auth-plan.js.map +4 -4
- package/dist/mfu-reassembler.js +24 -13
- package/dist/mfu-reassembler.js.map +3 -3
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +96 -22
- package/dist/mmtp-container-parser.js.map +3 -3
- package/dist/mmtp-container-parser.no-modules.js +1138 -325
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +96 -22
- package/dist/mmtp-decode-pipeline.js.map +3 -3
- package/dist/mmtp-fec-session.d.ts +159 -0
- package/dist/mmtp-fec-session.d.ts.map +1 -0
- package/dist/mmtp-fec-session.js +531 -0
- package/dist/mmtp-fec-session.js.map +7 -0
- package/dist/mmtp-router.d.ts +31 -5
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +168 -22
- package/dist/mmtp-router.js.map +3 -3
- package/dist/multicast-auth-catalog.d.ts +86 -92
- package/dist/multicast-auth-catalog.d.ts.map +1 -1
- package/dist/multicast-auth-catalog.js +347 -132
- package/dist/multicast-auth-catalog.js.map +4 -4
- package/dist/multicast-input.d.ts +28 -6
- package/dist/multicast-input.d.ts.map +1 -1
- package/dist/multicast-input.js +293 -28
- package/dist/multicast-input.js.map +3 -3
- package/dist/multicast-manager.d.ts +89 -5
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +730 -356
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +12 -2
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +111 -235
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js +24 -13
- package/dist/multicast-unwrap.js.map +3 -3
- package/dist/no-modules.d.ts +4 -1
- package/dist/no-modules.d.ts.map +1 -1
- package/dist/no-modules.js +1087 -309
- package/dist/no-modules.js.map +4 -4
- package/dist/phase14-catalog-override.d.ts +1 -1
- package/dist/phase14-catalog-override.d.ts.map +1 -1
- package/dist/phase14-catalog-override.js +2 -2
- package/dist/phase14-catalog-override.js.map +2 -2
- package/dist/repair-fetch.d.ts +81 -6
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +159 -31
- package/dist/repair-fetch.js.map +3 -3
- package/dist/repair-layers.d.ts +2 -0
- package/dist/repair-layers.d.ts.map +1 -1
- package/dist/repair-layers.js +22 -2
- package/dist/repair-layers.js.map +3 -3
- package/dist/sample-combiner.d.ts +7 -1
- package/dist/sample-combiner.d.ts.map +1 -1
- package/dist/sample-combiner.js +14 -2
- package/dist/sample-combiner.js.map +2 -2
- package/dist/signaling.d.ts +2 -2
- package/dist/signaling.d.ts.map +1 -1
- package/dist/signaling.js +6 -3
- package/dist/signaling.js.map +3 -3
- package/dist/source-auth.js +2710 -7
- package/dist/source-auth.js.map +4 -4
- package/dist/switching-set-alignment.d.ts +1 -1
- package/dist/switching-set-alignment.js.map +1 -1
- package/dist/timestamp-codec.js +24 -13
- package/dist/timestamp-codec.js.map +3 -3
- package/dist/wasm-mfu-reassembler.js +3 -0
- package/dist/wasm-mfu-reassembler.js.map +3 -3
- package/dist/wasm-mmtp-container-parser.js +96 -22
- package/dist/wasm-mmtp-container-parser.js.map +3 -3
- package/package.json +6 -9
- package/schemas/catalog.schema.json +124 -37
- package/src/align.ts +52 -21
- package/src/carp-catalog.ts +163 -61
- package/src/catalog-fec-params.ts +66 -20
- package/src/catalog-network-source.ts +45 -2
- package/src/catalog-validator.ts +4 -11
- package/src/fec-manager.ts +239 -63
- package/src/fec-state.ts +14 -12
- package/src/fec-worker-setup.ts +20 -2
- package/src/index.ts +29 -10
- package/src/iso-block-locator.ts +97 -6
- package/src/manifest-auth-plan.ts +39 -91
- package/src/mmtp-container-parser.ts +75 -7
- package/src/mmtp-fec-session.ts +533 -0
- package/src/mmtp-router.ts +133 -5
- package/src/multicast-auth-catalog.ts +131 -238
- package/src/multicast-input.ts +119 -61
- package/src/multicast-manager.ts +258 -21
- package/src/multicast-transport.ts +17 -3
- package/src/no-modules.ts +7 -1
- package/src/phase14-catalog-override.ts +3 -3
- package/src/repair-fetch.ts +283 -39
- package/src/repair-layers.ts +22 -2
- package/src/sample-combiner.ts +15 -2
- package/src/signaling.ts +2 -2
- package/src/switching-set-alignment.ts +1 -1
- package/test-vectors/align.json +108 -32
- package/test-vectors/bc-provenance-v2.json +1526 -0
- package/test-vectors/catalog/README.md +65 -4
- package/test-vectors/catalog/negative/fec-block-profile-missing.json +1 -1
- package/test-vectors/catalog/negative/fec-block-profile-retired.json +1 -1
- package/test-vectors/catalog/negative/fec-block-profile-unknown.json +1 -1
- package/test-vectors/catalog/negative/fec-iso-symbol-size-below-floor.json +28 -0
- package/test-vectors/catalog/negative/fec-reed-solomon-iso-symbol-size-13.json +28 -0
- package/test-vectors/catalog/negative/fec-reed-solomon-k-plus-p-over-255.json +39 -0
- package/test-vectors/catalog/negative/fec-reed-solomon-overlay-over-255.json +40 -0
- package/test-vectors/catalog/negative/fec-repair-overlay-source-symbols-zero.json +43 -0
- package/test-vectors/catalog/negative/fec-repair-symbols-zero.json +28 -0
- package/test-vectors/catalog/negative/fec-source-symbols-zero.json +28 -0
- package/test-vectors/catalog/negative/fec-symbol-size-zero.json +28 -0
- package/test-vectors/catalog/negative/init-data-inline-without-data.json +22 -0
- package/test-vectors/catalog/negative/mmtp-mode-mpu.json +15 -0
- package/test-vectors/catalog/negative/multicast-amt-dns-without-relay.json +37 -0
- package/test-vectors/catalog/negative/multicast-auth-asm-missing-sender-address.json +77 -0
- package/test-vectors/catalog/negative/multicast-auth-duplicate-first-epoch.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-duplicate-kid.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-endpoint-auth-without-object-auth.json +38 -0
- package/test-vectors/catalog/negative/multicast-auth-endpoint-missing-auth.json +49 -0
- package/test-vectors/catalog/negative/multicast-auth-endpoint-missing-bandwidth.json +55 -0
- package/test-vectors/catalog/negative/multicast-auth-manifest-port-equals-port.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-manifest-timer-out-of-range.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-max-auth-delay-above-max.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-max-auth-delay-below-min.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-root-dotted-key.json +55 -0
- package/test-vectors/catalog/negative/multicast-auth-sender-address-on-ssm.json +57 -0
- package/test-vectors/catalog/negative/multicast-auth-version-1.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-version-3.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-version-missing.json +55 -0
- package/test-vectors/catalog/negative/multicast-endpoint-foreign-namespace-track.json +44 -0
- package/test-vectors/catalog/negative/multicast-endpoint-protocol-amt.json +38 -0
- package/test-vectors/catalog/negative/multicast-endpoint-protocol-atsc3.json +38 -0
- package/test-vectors/catalog/negative/presentation-anchor-unsafe.json +16 -0
- package/test-vectors/catalog/positive/fec-algorithm-unimplemented.json +29 -0
- package/test-vectors/catalog/positive/fec-iso-ssbg1.json +1 -1
- package/test-vectors/catalog/positive/fec-multicast.json +1 -1
- package/test-vectors/catalog/positive/fec-reed-solomon-layered.json +50 -0
- package/test-vectors/catalog/positive/mmt01-12-1-init-ref-anchor.json +29 -0
- package/test-vectors/catalog/positive/multicast-amt-discovery-omitted.json +37 -0
- package/test-vectors/catalog/positive/multicast-amt-dns-relay.json +38 -0
- package/test-vectors/catalog/positive/multicast-amt-manual-relay.json +2 -2
- package/test-vectors/catalog/{negative/multicast-endpoint-missing-protocol-and-source.json → positive/multicast-asm-unprotected.json} +10 -5
- package/test-vectors/catalog/positive/multicast-auth-asm-sender.json +78 -0
- package/test-vectors/catalog/positive/multicast-auth-rotation.json +39 -38
- package/test-vectors/catalog/positive/multicast-draft01-4-1-example.json +81 -0
- package/test-vectors/catalog/positive/multicast-draft01-7-2-6-example.json +70 -0
- package/test-vectors/catalog/positive/presentation-anchor-negative.json +27 -0
- package/test-vectors/catalog/section-codes.json +30 -1
- package/test-vectors/catalog-multicast-auth-v1.json +38 -20
- package/test-vectors/catalog-validation.json +101 -5
- package/test-vectors/catalog-validator-public-api.mjs +14 -9
- package/test-vectors/generate-bc-provenance-v2.mjs +252 -0
- package/dist/fec-codec.d.ts +0 -32
- package/dist/fec-codec.d.ts.map +0 -1
- package/dist/fec-codec.js +0 -47
- package/dist/fec-codec.js.map +0 -7
- package/src/fec-codec.ts +0 -61
package/dist/delivery-catalog.js
CHANGED
|
@@ -24,185 +24,8 @@ function parseFecBlockProfile(value, where) {
|
|
|
24
24
|
throw new Error(`${where} must be "iso-ssbg1-v1" (got ${JSON.stringify(value)})`);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
//
|
|
28
|
-
var
|
|
29
|
-
(function(MoqFecAlgorithm2) {
|
|
30
|
-
MoqFecAlgorithm2[MoqFecAlgorithm2["None"] = 0] = "None";
|
|
31
|
-
MoqFecAlgorithm2[MoqFecAlgorithm2["Xor"] = 1] = "Xor";
|
|
32
|
-
MoqFecAlgorithm2[MoqFecAlgorithm2["RaptorQ"] = 2] = "RaptorQ";
|
|
33
|
-
})(MoqFecAlgorithm || (MoqFecAlgorithm = {}));
|
|
34
|
-
|
|
35
|
-
// node_modules/@blockcast/mmt-base/dist/mmtp.js
|
|
36
|
-
var MPU_HEADER_SIZE2 = 8;
|
|
37
|
-
var MPU_LENGTH_FIELD_SIZE2 = 2;
|
|
38
|
-
var MPU_HEADER_REMAINDER_SIZE2 = MPU_HEADER_SIZE2 - MPU_LENGTH_FIELD_SIZE2;
|
|
39
|
-
var MMTP_SIGNALING_PACKET_ID = 0;
|
|
40
|
-
var MMTP_PACKET_ID_MAX = 65535;
|
|
41
|
-
|
|
42
|
-
// node_modules/@blockcast/mmt-base/dist/net-constants.js
|
|
43
|
-
var DEFAULT_AMT_RELAY_PORT = 2268;
|
|
44
|
-
|
|
45
|
-
// node_modules/@blockcast/mmt-base/dist/ntp-short.js
|
|
46
|
-
var NTP_SHORT_BITS2 = 32;
|
|
47
|
-
var NTP_SHORT_MODULUS2 = 2 ** NTP_SHORT_BITS2;
|
|
48
|
-
var NTP_SHORT_HALF_RANGE2 = 2 ** (NTP_SHORT_BITS2 - 1);
|
|
49
|
-
function isNtpShort(value) {
|
|
50
|
-
return Number.isInteger(value) && value >= 0 && value < NTP_SHORT_MODULUS2;
|
|
51
|
-
}
|
|
52
|
-
function compareNtpShort(a, b) {
|
|
53
|
-
if (!isNtpShort(a) || !isNtpShort(b)) {
|
|
54
|
-
throw new RangeError(`NTP-short values must be integers in [0, 2^${NTP_SHORT_BITS2}), got ${String(a)} and ${String(b)}`);
|
|
55
|
-
}
|
|
56
|
-
if (a === b)
|
|
57
|
-
return "equal";
|
|
58
|
-
const forward = (a - b + NTP_SHORT_MODULUS2) % NTP_SHORT_MODULUS2;
|
|
59
|
-
if (forward < NTP_SHORT_HALF_RANGE2)
|
|
60
|
-
return "after";
|
|
61
|
-
if (forward > NTP_SHORT_HALF_RANGE2)
|
|
62
|
-
return "before";
|
|
63
|
-
return "unordered";
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// node_modules/@blockcast/mmt-base/dist/fec-block-profile.js
|
|
67
|
-
var FEC_BLOCK_PROFILES2 = Object.freeze([
|
|
68
|
-
"iso-ssbg1-v1"
|
|
69
|
-
]);
|
|
70
|
-
|
|
71
|
-
// node_modules/@blockcast/mmt-transport/dist/driad-discovery.js
|
|
72
|
-
var DRIADDiscovery = class {
|
|
73
|
-
cache = /* @__PURE__ */ new Map();
|
|
74
|
-
cacheExpiry = 3e5;
|
|
75
|
-
// 5 minutes
|
|
76
|
-
/**
|
|
77
|
-
* Discover AMT relays for a multicast source address (RFC 8777)
|
|
78
|
-
*
|
|
79
|
-
* @param source - The multicast source IP address (NOT the group!)
|
|
80
|
-
* @returns Array of discovered AMT relays that can tunnel traffic from this source
|
|
81
|
-
*/
|
|
82
|
-
async discoverRelays(source) {
|
|
83
|
-
const cached = this.cache.get(source);
|
|
84
|
-
if (cached) {
|
|
85
|
-
return cached;
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
const reversedSource = source.split(".").reverse().join(".");
|
|
89
|
-
const queryDomain = `${reversedSource}.amt.in-addr.arpa`;
|
|
90
|
-
console.log(`[DRIAD] Discovering relays for source ${source} via ${queryDomain}`);
|
|
91
|
-
const relays = await this.queryDRIADProxy(source);
|
|
92
|
-
if (relays.length > 0) {
|
|
93
|
-
this.cache.set(source, relays);
|
|
94
|
-
setTimeout(() => this.cache.delete(source), this.cacheExpiry);
|
|
95
|
-
}
|
|
96
|
-
return relays;
|
|
97
|
-
} catch (error) {
|
|
98
|
-
console.warn(`[DRIAD] Discovery failed for source ${source}:`, error);
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Query DRIAD proxy service (browser-compatible)
|
|
104
|
-
*/
|
|
105
|
-
async queryDRIADProxy(source) {
|
|
106
|
-
const proxyEndpoints = [
|
|
107
|
-
"https://driad.amt.net/api/v1/relays",
|
|
108
|
-
"https://multicast-gateway.cloudflare.com/driad"
|
|
109
|
-
];
|
|
110
|
-
for (const endpoint of proxyEndpoints) {
|
|
111
|
-
try {
|
|
112
|
-
const response = await fetch(`${endpoint}?source=${encodeURIComponent(source)}`, {
|
|
113
|
-
method: "GET",
|
|
114
|
-
headers: { Accept: "application/json" },
|
|
115
|
-
signal: AbortSignal.timeout(5e3)
|
|
116
|
-
});
|
|
117
|
-
if (response.ok) {
|
|
118
|
-
const data = await response.json();
|
|
119
|
-
return data.relays || [];
|
|
120
|
-
}
|
|
121
|
-
} catch {
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
const dohRelay = await this.queryDNSOverHTTPS(source);
|
|
125
|
-
if (dohRelay) {
|
|
126
|
-
return [dohRelay];
|
|
127
|
-
}
|
|
128
|
-
return [];
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Query DNS-over-HTTPS for DRIAD relay based on source address (RFC 8777)
|
|
132
|
-
*/
|
|
133
|
-
async queryDNSOverHTTPS(source) {
|
|
134
|
-
try {
|
|
135
|
-
const reversedSource = source.split(".").reverse().join(".");
|
|
136
|
-
const queryName = `${reversedSource}.amt.in-addr.arpa`;
|
|
137
|
-
const dohUrl = `https://cloudflare-dns.com/dns-query?name=${queryName}&type=A`;
|
|
138
|
-
const response = await fetch(dohUrl, {
|
|
139
|
-
headers: { Accept: "application/dns-json" },
|
|
140
|
-
signal: AbortSignal.timeout(3e3)
|
|
141
|
-
});
|
|
142
|
-
if (!response.ok) {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
const result = await response.json();
|
|
146
|
-
if (result.Answer && result.Answer.length > 0) {
|
|
147
|
-
return {
|
|
148
|
-
host: result.Answer[0].data,
|
|
149
|
-
port: DEFAULT_AMT_RELAY_PORT,
|
|
150
|
-
priority: 10,
|
|
151
|
-
weight: 100,
|
|
152
|
-
asn: 0
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
return null;
|
|
156
|
-
} catch (error) {
|
|
157
|
-
console.warn("[DRIAD] DNS-over-HTTPS query failed:", error);
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Select best relay based on RTT measurements
|
|
163
|
-
*/
|
|
164
|
-
async selectBestRelay(relays) {
|
|
165
|
-
if (relays.length === 0)
|
|
166
|
-
return null;
|
|
167
|
-
const measured = await Promise.all(relays.map(async (relay) => {
|
|
168
|
-
const rtt = await this.measureRTT(relay.host, relay.port);
|
|
169
|
-
return { ...relay, rtt };
|
|
170
|
-
}));
|
|
171
|
-
measured.sort((a, b) => {
|
|
172
|
-
if (a.priority !== b.priority)
|
|
173
|
-
return a.priority - b.priority;
|
|
174
|
-
return (a.rtt || Infinity) - (b.rtt || Infinity);
|
|
175
|
-
});
|
|
176
|
-
console.log(`[DRIAD] Selected relay: ${measured[0].host} (RTT: ${measured[0].rtt}ms)`);
|
|
177
|
-
return measured[0];
|
|
178
|
-
}
|
|
179
|
-
async measureRTT(host, _port) {
|
|
180
|
-
const start = performance.now();
|
|
181
|
-
try {
|
|
182
|
-
await fetch(`https://${host}/health`, {
|
|
183
|
-
method: "HEAD",
|
|
184
|
-
signal: AbortSignal.timeout(2e3),
|
|
185
|
-
mode: "no-cors"
|
|
186
|
-
});
|
|
187
|
-
return performance.now() - start;
|
|
188
|
-
} catch {
|
|
189
|
-
return Infinity;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Clear the relay cache
|
|
194
|
-
*/
|
|
195
|
-
clearCache() {
|
|
196
|
-
this.cache.clear();
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Get cached relays for a source address
|
|
200
|
-
*/
|
|
201
|
-
getCached(source) {
|
|
202
|
-
return this.cache.get(source);
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
var driadDiscovery = new DRIADDiscovery();
|
|
27
|
+
// ../mmt-base/dist/catalog-fec-source.js
|
|
28
|
+
var ALL_ROLES = Object.freeze(["video", "audio"]);
|
|
206
29
|
|
|
207
30
|
// node_modules/@blockcast/mmt-transport/dist/multicast-tier.js
|
|
208
31
|
function endpointKey(endpoint) {
|
|
@@ -334,8 +157,8 @@ var AdaptiveBitrateController = class {
|
|
|
334
157
|
/**
|
|
335
158
|
* Update FEC statistics for ABR decisions
|
|
336
159
|
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
160
|
+
* ABR uses the effective loss rate (after FEC recovery) rather than the
|
|
161
|
+
* raw transport loss rate.
|
|
339
162
|
*
|
|
340
163
|
* @param stats - FEC statistics from the FEC decoder
|
|
341
164
|
*/
|
|
@@ -411,6 +234,45 @@ var AdaptiveBitrateController = class {
|
|
|
411
234
|
}
|
|
412
235
|
};
|
|
413
236
|
|
|
237
|
+
// node_modules/@blockcast/mmt-base/dist/mmtp.js
|
|
238
|
+
var MPU_HEADER_SIZE2 = 8;
|
|
239
|
+
var MPU_LENGTH_FIELD_SIZE2 = 2;
|
|
240
|
+
var MPU_HEADER_REMAINDER_SIZE2 = MPU_HEADER_SIZE2 - MPU_LENGTH_FIELD_SIZE2;
|
|
241
|
+
var MMTP_SIGNALING_PACKET_ID2 = 0;
|
|
242
|
+
var MMTP_PACKET_ID_MAX = 65535;
|
|
243
|
+
|
|
244
|
+
// node_modules/@blockcast/mmt-base/dist/net-constants.js
|
|
245
|
+
var DEFAULT_AMT_RELAY_PORT = 2268;
|
|
246
|
+
|
|
247
|
+
// node_modules/@blockcast/mmt-base/dist/ntp-short.js
|
|
248
|
+
var NTP_SHORT_BITS2 = 32;
|
|
249
|
+
var NTP_SHORT_MODULUS2 = 2 ** NTP_SHORT_BITS2;
|
|
250
|
+
var NTP_SHORT_HALF_RANGE2 = 2 ** (NTP_SHORT_BITS2 - 1);
|
|
251
|
+
function isNtpShort(value) {
|
|
252
|
+
return Number.isInteger(value) && value >= 0 && value < NTP_SHORT_MODULUS2;
|
|
253
|
+
}
|
|
254
|
+
function compareNtpShort(a, b) {
|
|
255
|
+
if (!isNtpShort(a) || !isNtpShort(b)) {
|
|
256
|
+
throw new RangeError(`NTP-short values must be integers in [0, 2^${NTP_SHORT_BITS2}), got ${String(a)} and ${String(b)}`);
|
|
257
|
+
}
|
|
258
|
+
if (a === b)
|
|
259
|
+
return "equal";
|
|
260
|
+
const forward = (a - b + NTP_SHORT_MODULUS2) % NTP_SHORT_MODULUS2;
|
|
261
|
+
if (forward < NTP_SHORT_HALF_RANGE2)
|
|
262
|
+
return "after";
|
|
263
|
+
if (forward > NTP_SHORT_HALF_RANGE2)
|
|
264
|
+
return "before";
|
|
265
|
+
return "unordered";
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// node_modules/@blockcast/mmt-base/dist/fec-block-profile.js
|
|
269
|
+
var FEC_BLOCK_PROFILES2 = Object.freeze([
|
|
270
|
+
"iso-ssbg1-v1"
|
|
271
|
+
]);
|
|
272
|
+
|
|
273
|
+
// node_modules/@blockcast/mmt-base/dist/catalog-fec-source.js
|
|
274
|
+
var ALL_ROLES2 = Object.freeze(["video", "audio"]);
|
|
275
|
+
|
|
414
276
|
// node_modules/@blockcast/mmt-transport/dist/multicast-orchestrator.js
|
|
415
277
|
var DEFAULT_DWELL_MS = 3e3;
|
|
416
278
|
var DEFAULT_JOIN_DEADLINE_MS = 5e3;
|
|
@@ -648,8 +510,23 @@ function toWindowMulticastSubscribeConfig(input) {
|
|
|
648
510
|
consume: "bytes",
|
|
649
511
|
...input.packetIds?.length ? { packetIds: [...input.packetIds] } : {}
|
|
650
512
|
};
|
|
513
|
+
if (input.atsc3) {
|
|
514
|
+
const { frequency, plpId, serviceId } = input.atsc3;
|
|
515
|
+
if (!Number.isInteger(frequency) || frequency < 1) {
|
|
516
|
+
throw new TypeError(`ATSC3 tuning requires a positive integer frequency in kHz, got ${String(frequency)}`);
|
|
517
|
+
}
|
|
518
|
+
return {
|
|
519
|
+
...base,
|
|
520
|
+
origin: "tuner",
|
|
521
|
+
standard: "atsc3",
|
|
522
|
+
frequency,
|
|
523
|
+
...plpId !== void 0 ? { plpId } : {},
|
|
524
|
+
...serviceId !== void 0 ? { serviceId } : {}
|
|
525
|
+
};
|
|
526
|
+
}
|
|
651
527
|
const relay = input.amtRelay?.trim();
|
|
652
|
-
const
|
|
528
|
+
const driad = !relay && input.amtDiscovery === "driad";
|
|
529
|
+
const wantsAmt = input.mode === "tunnel" || input.mode !== "native" && (relay !== void 0 && relay !== "" || driad);
|
|
653
530
|
if (!wantsAmt) {
|
|
654
531
|
const native = {
|
|
655
532
|
...base,
|
|
@@ -659,6 +536,20 @@ function toWindowMulticastSubscribeConfig(input) {
|
|
|
659
536
|
return native;
|
|
660
537
|
}
|
|
661
538
|
const relayPort = input.amtRelayPort;
|
|
539
|
+
if (driad) {
|
|
540
|
+
if (!base.source)
|
|
541
|
+
throw new TypeError("AMT DRIAD discovery requires a source address");
|
|
542
|
+
if (relayPort !== void 0 && !isPositivePort(relayPort)) {
|
|
543
|
+
throw new TypeError("AMT DRIAD discovery requires a valid relay port when one is given");
|
|
544
|
+
}
|
|
545
|
+
return {
|
|
546
|
+
...base,
|
|
547
|
+
source: base.source,
|
|
548
|
+
origin: "amt",
|
|
549
|
+
discovery: "driad",
|
|
550
|
+
...relayPort !== void 0 ? { relayPort } : {}
|
|
551
|
+
};
|
|
552
|
+
}
|
|
662
553
|
if (!relay || relayPort === void 0 || !isPositivePort(relayPort)) {
|
|
663
554
|
throw new TypeError("AMT requires a resolved relay and a valid relay port");
|
|
664
555
|
}
|
|
@@ -702,7 +593,8 @@ function normalizeMulticastEndpoint(endpoint) {
|
|
|
702
593
|
port: endpoint.port,
|
|
703
594
|
...endpoint.mode ? { mode: endpoint.mode } : {},
|
|
704
595
|
...amtRelay ? { amtRelay } : {},
|
|
705
|
-
...endpoint.amtRelayPort ? { amtRelayPort: endpoint.amtRelayPort } : {}
|
|
596
|
+
...endpoint.amtRelayPort ? { amtRelayPort: endpoint.amtRelayPort } : {},
|
|
597
|
+
...endpoint.amtDiscovery === "driad" ? { amtDiscovery: "driad" } : {}
|
|
706
598
|
};
|
|
707
599
|
}
|
|
708
600
|
function multicastEndpointKey(endpoint) {
|
|
@@ -715,11 +607,13 @@ function multicastEndpointKey(endpoint) {
|
|
|
715
607
|
normalized.port,
|
|
716
608
|
normalized.mode ?? "auto",
|
|
717
609
|
normalized.amtRelay ?? "",
|
|
718
|
-
normalized.amtRelayPort ?? ""
|
|
610
|
+
normalized.amtRelayPort ?? "",
|
|
611
|
+
// A DRIAD join is a different gateway subscription from a native one.
|
|
612
|
+
...normalized.amtDiscovery ? [normalized.amtDiscovery] : []
|
|
719
613
|
]);
|
|
720
614
|
}
|
|
721
615
|
function isMulticastTrackPacketId(value) {
|
|
722
|
-
return Number.isInteger(value) && value >
|
|
616
|
+
return Number.isInteger(value) && value > MMTP_SIGNALING_PACKET_ID2 && value <= MMTP_PACKET_ID_MAX;
|
|
723
617
|
}
|
|
724
618
|
function isValidIpv6MulticastAddress(value) {
|
|
725
619
|
if (!/^[0-9a-f:]+$/.test(value))
|
|
@@ -755,7 +649,8 @@ var MulticastSubscriptionPool = class {
|
|
|
755
649
|
port: config.port,
|
|
756
650
|
mode: config.mode,
|
|
757
651
|
amtRelay: config.amtRelay,
|
|
758
|
-
amtRelayPort: config.amtRelayPort
|
|
652
|
+
amtRelayPort: config.amtRelayPort,
|
|
653
|
+
amtDiscovery: config.amtDiscovery
|
|
759
654
|
});
|
|
760
655
|
if (!endpoint)
|
|
761
656
|
throw new Error("Invalid multicast endpoint");
|
|
@@ -821,7 +716,8 @@ var MulticastSubscriptionPool = class {
|
|
|
821
716
|
port: endpoint.port,
|
|
822
717
|
...endpoint.mode ? { mode: endpoint.mode } : {},
|
|
823
718
|
...endpoint.amtRelay ? { amtRelay: endpoint.amtRelay } : {},
|
|
824
|
-
...endpoint.amtRelayPort ? { amtRelayPort: endpoint.amtRelayPort } : {}
|
|
719
|
+
...endpoint.amtRelayPort ? { amtRelayPort: endpoint.amtRelayPort } : {},
|
|
720
|
+
...endpoint.amtDiscovery ? { amtDiscovery: endpoint.amtDiscovery } : {}
|
|
825
721
|
}));
|
|
826
722
|
const consumers = /* @__PURE__ */ new Map();
|
|
827
723
|
let entry;
|
|
@@ -901,7 +797,6 @@ var TransportManager = class {
|
|
|
901
797
|
};
|
|
902
798
|
capabilities = null;
|
|
903
799
|
subscription = null;
|
|
904
|
-
driad = new DRIADDiscovery();
|
|
905
800
|
/** Built by `connect()` from the caller's ladder; there is no built-in one. */
|
|
906
801
|
abr = null;
|
|
907
802
|
multicastOrchestrator = null;
|
|
@@ -951,8 +846,8 @@ var TransportManager = class {
|
|
|
951
846
|
nativeIGMP: hasGatewayBytes,
|
|
952
847
|
directSockets: typeof win?.UDPSocket !== "undefined",
|
|
953
848
|
amt: false,
|
|
954
|
-
driad:
|
|
955
|
-
//
|
|
849
|
+
driad: hasGatewayBytes,
|
|
850
|
+
// the gateway runs RFC 8777 discovery
|
|
956
851
|
fecDecode: false
|
|
957
852
|
};
|
|
958
853
|
console.log("[Transport] Capabilities:", this.capabilities);
|
|
@@ -963,7 +858,7 @@ var TransportManager = class {
|
|
|
963
858
|
*
|
|
964
859
|
* Promotion hierarchy:
|
|
965
860
|
* 1. window.multicast gateway bytes
|
|
966
|
-
* 2. AMT
|
|
861
|
+
* 2. AMT: a configured relay via the AMT proxy, else gateway DRIAD discovery
|
|
967
862
|
* 3. MOQ WebTransport (final fallback)
|
|
968
863
|
*
|
|
969
864
|
* The ABR ladder (`abrLadder`) and initial rendition (`initialQuality`)
|
|
@@ -1057,7 +952,7 @@ var TransportManager = class {
|
|
|
1057
952
|
/**
|
|
1058
953
|
* Connect via the lowercase window.multicast bytes gateway.
|
|
1059
954
|
*/
|
|
1060
|
-
async connectWindowMulticast(config, generation) {
|
|
955
|
+
async connectWindowMulticast(config, generation, mode = "multicast") {
|
|
1061
956
|
try {
|
|
1062
957
|
const gateway = this.getWindowMulticastGateway();
|
|
1063
958
|
if (typeof gateway?.subscribe !== "function")
|
|
@@ -1092,7 +987,7 @@ var TransportManager = class {
|
|
|
1092
987
|
}
|
|
1093
988
|
};
|
|
1094
989
|
this.state = {
|
|
1095
|
-
mode
|
|
990
|
+
mode,
|
|
1096
991
|
connected: true,
|
|
1097
992
|
group: config.group,
|
|
1098
993
|
source: config.source,
|
|
@@ -1110,29 +1005,19 @@ var TransportManager = class {
|
|
|
1110
1005
|
}
|
|
1111
1006
|
}
|
|
1112
1007
|
/**
|
|
1113
|
-
* Connect via AMT proxy
|
|
1008
|
+
* Connect via AMT: a configured relay goes through the AMT proxy; with no
|
|
1009
|
+
* relay, the window.multicast gateway discovers one per RFC 8777 (DRIAD).
|
|
1114
1010
|
*/
|
|
1115
1011
|
async connectAmt(config, generation) {
|
|
1116
1012
|
try {
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
const relays = await this.driad.discoverRelays(config.source);
|
|
1121
|
-
if (generation !== this.connectionGeneration)
|
|
1122
|
-
return false;
|
|
1123
|
-
const bestRelay = await this.driad.selectBestRelay(relays);
|
|
1124
|
-
if (generation !== this.connectionGeneration)
|
|
1125
|
-
return false;
|
|
1126
|
-
if (bestRelay) {
|
|
1127
|
-
amtRelay = bestRelay.host;
|
|
1128
|
-
this.state.amtRelay = amtRelay;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
if (!amtRelay) {
|
|
1013
|
+
if (config.amtRelay)
|
|
1014
|
+
return await this.connectAmtProxy(config, config.amtRelay, generation);
|
|
1015
|
+
if (config.driadEnabled === false || !config.source || config.mode === "native") {
|
|
1132
1016
|
console.warn("[Transport] No AMT relay available (DRIAD requires source address for SSM)");
|
|
1133
1017
|
return false;
|
|
1134
1018
|
}
|
|
1135
|
-
|
|
1019
|
+
console.log(`[Transport] Asking the gateway for a DRIAD relay for source ${config.source}...`);
|
|
1020
|
+
return await this.connectWindowMulticast({ ...config, amtDiscovery: "driad" }, generation, "amt");
|
|
1136
1021
|
} catch (error) {
|
|
1137
1022
|
console.warn("[Transport] AMT connection failed:", error);
|
|
1138
1023
|
return false;
|
|
@@ -1363,7 +1248,6 @@ var AMTGatewayManager = class {
|
|
|
1363
1248
|
subscriptions = /* @__PURE__ */ new Map();
|
|
1364
1249
|
messageHandler;
|
|
1365
1250
|
pendingPackets = /* @__PURE__ */ new Map();
|
|
1366
|
-
driad = new DRIADDiscovery();
|
|
1367
1251
|
constructor() {
|
|
1368
1252
|
this.messageHandler = (event) => {
|
|
1369
1253
|
const data = event.data;
|
|
@@ -1394,26 +1278,12 @@ var AMTGatewayManager = class {
|
|
|
1394
1278
|
return keyStr;
|
|
1395
1279
|
}
|
|
1396
1280
|
try {
|
|
1397
|
-
|
|
1398
|
-
let discoveryMethod;
|
|
1281
|
+
const relayAddress = config.relayAddress;
|
|
1399
1282
|
const relayPort = config.relayPort || DEFAULT_AMT_RELAY_PORT;
|
|
1400
|
-
if (
|
|
1401
|
-
|
|
1402
|
-
discoveryMethod = "manual";
|
|
1403
|
-
console.log(`[AMT] Using configured relay ${relayAddress}:${relayPort}`);
|
|
1404
|
-
} else if (key.source) {
|
|
1405
|
-
console.log(`[AMT] No relay configured, discovering via DRIAD for source ${key.source}...`);
|
|
1406
|
-
const relays = await this.driad.discoverRelays(key.source);
|
|
1407
|
-
const bestRelay = await this.driad.selectBestRelay(relays);
|
|
1408
|
-
if (!bestRelay) {
|
|
1409
|
-
throw new Error(`AMT relay discovery failed for source ${key.source}. Please specify a relay address in the subscription configuration.`);
|
|
1410
|
-
}
|
|
1411
|
-
relayAddress = bestRelay.host;
|
|
1412
|
-
discoveryMethod = "driad";
|
|
1413
|
-
console.log(`[AMT] Discovered relay via DRIAD: ${relayAddress}:${relayPort}`);
|
|
1414
|
-
} else {
|
|
1415
|
-
throw new Error(`AMT relay discovery requires a source address for SSM (RFC 8777). Please specify either a relay address or source address.`);
|
|
1283
|
+
if (!relayAddress) {
|
|
1284
|
+
throw new Error(`AMT relay address required: this manager does no relay discovery. For RFC 8777 DRIAD discovery, join through window.multicast with amtDiscovery: "driad".`);
|
|
1416
1285
|
}
|
|
1286
|
+
console.log(`[AMT] Using configured relay ${relayAddress}:${relayPort}`);
|
|
1417
1287
|
const subscriptionId = keyStr;
|
|
1418
1288
|
this.pendingPackets.set(subscriptionId, []);
|
|
1419
1289
|
const subscription = {
|
|
@@ -1424,7 +1294,7 @@ var AMTGatewayManager = class {
|
|
|
1424
1294
|
relay: {
|
|
1425
1295
|
address: relayAddress,
|
|
1426
1296
|
port: relayPort,
|
|
1427
|
-
discoveryMethod,
|
|
1297
|
+
discoveryMethod: "manual",
|
|
1428
1298
|
discoveredAt: Date.now()
|
|
1429
1299
|
}
|
|
1430
1300
|
};
|