@blockcast/mmt-container 0.4.0 → 0.4.1-main.2e0aa69d293d
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 +37 -21
- 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 +5070 -908
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +76 -39
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +321 -205
- package/dist/carp-catalog.js.map +3 -3
- package/dist/catalog-fec-params.d.ts +12 -4
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +40 -17
- package/dist/catalog-fec-params.js.map +3 -3
- package/dist/catalog-network-source.d.ts +28 -7
- package/dist/catalog-network-source.d.ts.map +1 -1
- package/dist/catalog-network-source.js +21 -1
- package/dist/catalog-network-source.js.map +2 -2
- 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/cmcd-producer.d.ts +13 -1
- package/dist/cmcd-producer.d.ts.map +1 -1
- package/dist/cmcd-producer.js +14 -0
- package/dist/cmcd-producer.js.map +2 -2
- package/dist/delivery-catalog.js +115 -235
- package/dist/delivery-catalog.js.map +4 -4
- package/dist/fec-manager.d.ts +113 -1
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +464 -66
- package/dist/fec-manager.js.map +4 -4
- package/dist/fec-state.d.ts +2 -1
- package/dist/fec-state.d.ts.map +1 -1
- package/dist/fec-state.js +18 -3
- package/dist/fec-state.js.map +3 -3
- package/dist/fec-worker-setup.d.ts +10 -0
- package/dist/fec-worker-setup.d.ts.map +1 -1
- package/dist/fec-worker-setup.js +15 -4
- package/dist/fec-worker-setup.js.map +2 -2
- package/dist/held-layer-admission.d.ts +58 -0
- package/dist/held-layer-admission.d.ts.map +1 -0
- package/dist/held-layer-admission.js +105 -0
- package/dist/held-layer-admission.js.map +7 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.d.ts +39 -1
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +109 -17
- package/dist/iso-block-locator.js.map +3 -3
- package/dist/mfu-reassembler.js +21 -13
- package/dist/mfu-reassembler.js.map +2 -2
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +93 -22
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +3692 -1213
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +93 -22
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-fec-session.d.ts +192 -0
- package/dist/mmtp-fec-session.d.ts.map +1 -0
- package/dist/mmtp-fec-session.js +640 -0
- package/dist/mmtp-fec-session.js.map +7 -0
- package/dist/mmtp-router.d.ts +101 -32
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +422 -189
- package/dist/mmtp-router.js.map +2 -2
- package/dist/multicast-auth-catalog.d.ts +94 -92
- package/dist/multicast-auth-catalog.d.ts.map +1 -1
- package/dist/multicast-auth-catalog.js +746 -131
- package/dist/multicast-auth-catalog.js.map +4 -4
- package/dist/multicast-input.d.ts +31 -8
- package/dist/multicast-input.d.ts.map +1 -1
- package/dist/multicast-input.js +299 -35
- package/dist/multicast-input.js.map +3 -3
- package/dist/multicast-manager.d.ts +140 -12
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +4104 -605
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +16 -3
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +127 -240
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js +21 -13
- package/dist/multicast-unwrap.js.map +2 -2
- package/dist/no-modules.d.ts +5 -3
- package/dist/no-modules.d.ts.map +1 -1
- package/dist/no-modules.js +3643 -1197
- 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 +90 -6
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +160 -32
- 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 +19 -2
- package/dist/repair-layers.js.map +2 -2
- 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 +3 -3
- package/dist/signaling.js.map +2 -2
- package/dist/switching-set-alignment.d.ts +1 -1
- package/dist/switching-set-alignment.js.map +1 -1
- package/dist/timestamp-codec.js +21 -13
- package/dist/timestamp-codec.js.map +2 -2
- package/dist/wasm-mfu-reassembler.js.map +1 -1
- package/dist/wasm-mmtp-container-parser.js +93 -22
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +6 -18
- package/schemas/catalog.schema.json +133 -38
- package/src/align.ts +52 -21
- package/src/carp-catalog.ts +188 -68
- package/src/catalog-fec-params.ts +28 -3
- package/src/catalog-network-source.ts +49 -7
- package/src/catalog-validator.ts +4 -11
- package/src/cmcd-producer.ts +23 -1
- package/src/fec-manager.ts +378 -63
- package/src/fec-state.ts +11 -4
- package/src/fec-worker-setup.ts +30 -2
- package/src/held-layer-admission.ts +161 -0
- package/src/index.ts +32 -19
- package/src/iso-block-locator.ts +110 -7
- package/src/mmtp-container-parser.ts +75 -7
- package/src/mmtp-fec-session.ts +606 -0
- package/src/mmtp-router.ts +453 -236
- package/src/multicast-auth-catalog.ts +196 -231
- package/src/multicast-input.ts +148 -124
- package/src/multicast-manager.ts +447 -53
- package/src/multicast-transport.ts +23 -5
- package/src/no-modules.ts +8 -7
- package/src/phase14-catalog-override.ts +3 -3
- package/src/repair-fetch.ts +306 -42
- 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 +71 -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-amt-driad-with-relay.json +38 -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 +3 -3
- 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 +31 -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/dist/manifest-auth-plan.d.ts +0 -30
- package/dist/manifest-auth-plan.d.ts.map +0 -1
- package/dist/manifest-auth-plan.js +0 -1266
- package/dist/manifest-auth-plan.js.map +0 -7
- package/dist/source-auth.d.ts +0 -2
- package/dist/source-auth.d.ts.map +0 -1
- package/dist/source-auth.js +0 -1209
- package/dist/source-auth.js.map +0 -7
- package/src/fec-codec.ts +0 -61
- package/src/manifest-auth-plan.ts +0 -107
- package/src/source-auth.ts +0 -1
- package/test-vectors/generate-source-auth-fixture.mjs +0 -114
- package/test-vectors/source-auth-v1.json +0 -61
|
@@ -3,19 +3,30 @@
|
|
|
3
3
|
* takeover/failback. Delegates raw packets to a callback (MmtpRouter
|
|
4
4
|
* or any direct consumer).
|
|
5
5
|
*/
|
|
6
|
-
import { type WindowMulticastDelivery } from '@blockcast/mmt-transport';
|
|
6
|
+
import { type WindowMulticastDelivery, type WindowMulticastGateway } from '@blockcast/mmt-transport';
|
|
7
7
|
export interface MulticastTransportConfig {
|
|
8
|
-
|
|
8
|
+
/** SSM source; omitted on ASM. */
|
|
9
|
+
sourceAddress?: string;
|
|
10
|
+
/** ASM sender filter (multicast-contract 1.1.0 `senderAddress`); never beside `sourceAddress`. */
|
|
11
|
+
senderAddress?: string;
|
|
9
12
|
groupAddress: string;
|
|
10
13
|
port: number;
|
|
11
14
|
mode?: 'auto' | 'native' | 'tunnel';
|
|
12
15
|
amtRelay?: string;
|
|
13
16
|
amtRelayPort?: number;
|
|
17
|
+
/** `'driad'`: with no relay, the gateway discovers one per RFC 8777. */
|
|
18
|
+
amtDiscovery?: 'driad';
|
|
14
19
|
packetIds?: number[];
|
|
15
20
|
tracks?: {
|
|
16
21
|
name: string;
|
|
17
22
|
packetId: number;
|
|
18
23
|
}[];
|
|
24
|
+
/** ATSC 3.0 tuning (`catalogAtsc3NetworkSource`); when set the join is the tuner. */
|
|
25
|
+
atsc3?: {
|
|
26
|
+
frequency: number;
|
|
27
|
+
plpId?: number;
|
|
28
|
+
serviceId?: number;
|
|
29
|
+
};
|
|
19
30
|
}
|
|
20
31
|
export type ResolvedMulticastTransport = 'native' | 'amt';
|
|
21
32
|
/**
|
|
@@ -122,7 +133,9 @@ export interface MulticastJoinStats {
|
|
|
122
133
|
}
|
|
123
134
|
export declare class MulticastTransport<TPacketContext = never> {
|
|
124
135
|
#private;
|
|
125
|
-
constructor(onPacket: (packet: Uint8Array, context?: TPacketContext) => void
|
|
136
|
+
constructor(onPacket: (packet: Uint8Array, context?: TPacketContext) => void, options?: {
|
|
137
|
+
gateway?: WindowMulticastGateway;
|
|
138
|
+
});
|
|
126
139
|
static isAvailable(): boolean;
|
|
127
140
|
join(config: MulticastTransportConfig, context?: TPacketContext): Promise<boolean>;
|
|
128
141
|
/** Feed a raw packet from an external source (e.g., AMT tunnel or ASM subscription). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multicast-transport.d.ts","sourceRoot":"","sources":["../src/multicast-transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIL,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"multicast-transport.d.ts","sourceRoot":"","sources":["../src/multicast-transport.ts"],"names":[],"mappings":"AAAA;;;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ED;;;OAGG;IACH,IAAI,OAAO,IAAI,cAAc,GAAG,SAAS,CAExC;IAED;;;OAGG;IACH,IAAI,SAAS,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAE1C;IAED;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IASzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,YAAY,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAyEzD,IAAI,iBAAiB,IAAI,0BAA0B,GAAG,SAAS,CAE9D;IAED,OAAO,IAAI,IAAI;CAgKhB"}
|
|
@@ -1,186 +1,3 @@
|
|
|
1
|
-
// node_modules/@blockcast/mmt-transport/dist/types.js
|
|
2
|
-
var MoqFecAlgorithm;
|
|
3
|
-
(function(MoqFecAlgorithm2) {
|
|
4
|
-
MoqFecAlgorithm2[MoqFecAlgorithm2["None"] = 0] = "None";
|
|
5
|
-
MoqFecAlgorithm2[MoqFecAlgorithm2["Xor"] = 1] = "Xor";
|
|
6
|
-
MoqFecAlgorithm2[MoqFecAlgorithm2["RaptorQ"] = 2] = "RaptorQ";
|
|
7
|
-
})(MoqFecAlgorithm || (MoqFecAlgorithm = {}));
|
|
8
|
-
|
|
9
|
-
// node_modules/@blockcast/mmt-base/dist/mmtp.js
|
|
10
|
-
var MPU_HEADER_SIZE = 8;
|
|
11
|
-
var MPU_LENGTH_FIELD_SIZE = 2;
|
|
12
|
-
var MPU_HEADER_REMAINDER_SIZE = MPU_HEADER_SIZE - MPU_LENGTH_FIELD_SIZE;
|
|
13
|
-
var MMTP_SIGNALING_PACKET_ID = 0;
|
|
14
|
-
var MMTP_PACKET_ID_MAX = 65535;
|
|
15
|
-
|
|
16
|
-
// node_modules/@blockcast/mmt-base/dist/net-constants.js
|
|
17
|
-
var DEFAULT_AMT_RELAY_PORT = 2268;
|
|
18
|
-
|
|
19
|
-
// node_modules/@blockcast/mmt-base/dist/ntp-short.js
|
|
20
|
-
var NTP_SHORT_BITS = 32;
|
|
21
|
-
var NTP_SHORT_MODULUS = 2 ** NTP_SHORT_BITS;
|
|
22
|
-
var NTP_SHORT_HALF_RANGE = 2 ** (NTP_SHORT_BITS - 1);
|
|
23
|
-
function isNtpShort(value) {
|
|
24
|
-
return Number.isInteger(value) && value >= 0 && value < NTP_SHORT_MODULUS;
|
|
25
|
-
}
|
|
26
|
-
function compareNtpShort(a, b) {
|
|
27
|
-
if (!isNtpShort(a) || !isNtpShort(b)) {
|
|
28
|
-
throw new RangeError(`NTP-short values must be integers in [0, 2^${NTP_SHORT_BITS}), got ${String(a)} and ${String(b)}`);
|
|
29
|
-
}
|
|
30
|
-
if (a === b)
|
|
31
|
-
return "equal";
|
|
32
|
-
const forward = (a - b + NTP_SHORT_MODULUS) % NTP_SHORT_MODULUS;
|
|
33
|
-
if (forward < NTP_SHORT_HALF_RANGE)
|
|
34
|
-
return "after";
|
|
35
|
-
if (forward > NTP_SHORT_HALF_RANGE)
|
|
36
|
-
return "before";
|
|
37
|
-
return "unordered";
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// node_modules/@blockcast/mmt-base/dist/fec-block-profile.js
|
|
41
|
-
var FEC_BLOCK_PROFILES = Object.freeze([
|
|
42
|
-
"iso-ssbg1-v1"
|
|
43
|
-
]);
|
|
44
|
-
|
|
45
|
-
// node_modules/@blockcast/mmt-base/dist/catalog-fec-source.js
|
|
46
|
-
var ALL_ROLES = Object.freeze(["video", "audio"]);
|
|
47
|
-
|
|
48
|
-
// node_modules/@blockcast/mmt-transport/dist/driad-discovery.js
|
|
49
|
-
var DRIADDiscovery = class {
|
|
50
|
-
cache = /* @__PURE__ */ new Map();
|
|
51
|
-
cacheExpiry = 3e5;
|
|
52
|
-
// 5 minutes
|
|
53
|
-
/**
|
|
54
|
-
* Discover AMT relays for a multicast source address (RFC 8777)
|
|
55
|
-
*
|
|
56
|
-
* @param source - The multicast source IP address (NOT the group!)
|
|
57
|
-
* @returns Array of discovered AMT relays that can tunnel traffic from this source
|
|
58
|
-
*/
|
|
59
|
-
async discoverRelays(source) {
|
|
60
|
-
const cached = this.cache.get(source);
|
|
61
|
-
if (cached) {
|
|
62
|
-
return cached;
|
|
63
|
-
}
|
|
64
|
-
try {
|
|
65
|
-
const reversedSource = source.split(".").reverse().join(".");
|
|
66
|
-
const queryDomain = `${reversedSource}.amt.in-addr.arpa`;
|
|
67
|
-
console.log(`[DRIAD] Discovering relays for source ${source} via ${queryDomain}`);
|
|
68
|
-
const relays = await this.queryDRIADProxy(source);
|
|
69
|
-
if (relays.length > 0) {
|
|
70
|
-
this.cache.set(source, relays);
|
|
71
|
-
setTimeout(() => this.cache.delete(source), this.cacheExpiry);
|
|
72
|
-
}
|
|
73
|
-
return relays;
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.warn(`[DRIAD] Discovery failed for source ${source}:`, error);
|
|
76
|
-
return [];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Query DRIAD proxy service (browser-compatible)
|
|
81
|
-
*/
|
|
82
|
-
async queryDRIADProxy(source) {
|
|
83
|
-
const proxyEndpoints = [
|
|
84
|
-
"https://driad.amt.net/api/v1/relays",
|
|
85
|
-
"https://multicast-gateway.cloudflare.com/driad"
|
|
86
|
-
];
|
|
87
|
-
for (const endpoint of proxyEndpoints) {
|
|
88
|
-
try {
|
|
89
|
-
const response = await fetch(`${endpoint}?source=${encodeURIComponent(source)}`, {
|
|
90
|
-
method: "GET",
|
|
91
|
-
headers: { Accept: "application/json" },
|
|
92
|
-
signal: AbortSignal.timeout(5e3)
|
|
93
|
-
});
|
|
94
|
-
if (response.ok) {
|
|
95
|
-
const data = await response.json();
|
|
96
|
-
return data.relays || [];
|
|
97
|
-
}
|
|
98
|
-
} catch {
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
const dohRelay = await this.queryDNSOverHTTPS(source);
|
|
102
|
-
if (dohRelay) {
|
|
103
|
-
return [dohRelay];
|
|
104
|
-
}
|
|
105
|
-
return [];
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Query DNS-over-HTTPS for DRIAD relay based on source address (RFC 8777)
|
|
109
|
-
*/
|
|
110
|
-
async queryDNSOverHTTPS(source) {
|
|
111
|
-
try {
|
|
112
|
-
const reversedSource = source.split(".").reverse().join(".");
|
|
113
|
-
const queryName = `${reversedSource}.amt.in-addr.arpa`;
|
|
114
|
-
const dohUrl = `https://cloudflare-dns.com/dns-query?name=${queryName}&type=A`;
|
|
115
|
-
const response = await fetch(dohUrl, {
|
|
116
|
-
headers: { Accept: "application/dns-json" },
|
|
117
|
-
signal: AbortSignal.timeout(3e3)
|
|
118
|
-
});
|
|
119
|
-
if (!response.ok) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
const result = await response.json();
|
|
123
|
-
if (result.Answer && result.Answer.length > 0) {
|
|
124
|
-
return {
|
|
125
|
-
host: result.Answer[0].data,
|
|
126
|
-
port: DEFAULT_AMT_RELAY_PORT,
|
|
127
|
-
priority: 10,
|
|
128
|
-
weight: 100,
|
|
129
|
-
asn: 0
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
return null;
|
|
133
|
-
} catch (error) {
|
|
134
|
-
console.warn("[DRIAD] DNS-over-HTTPS query failed:", error);
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Select best relay based on RTT measurements
|
|
140
|
-
*/
|
|
141
|
-
async selectBestRelay(relays) {
|
|
142
|
-
if (relays.length === 0)
|
|
143
|
-
return null;
|
|
144
|
-
const measured = await Promise.all(relays.map(async (relay) => {
|
|
145
|
-
const rtt = await this.measureRTT(relay.host, relay.port);
|
|
146
|
-
return { ...relay, rtt };
|
|
147
|
-
}));
|
|
148
|
-
measured.sort((a, b) => {
|
|
149
|
-
if (a.priority !== b.priority)
|
|
150
|
-
return a.priority - b.priority;
|
|
151
|
-
return (a.rtt || Infinity) - (b.rtt || Infinity);
|
|
152
|
-
});
|
|
153
|
-
console.log(`[DRIAD] Selected relay: ${measured[0].host} (RTT: ${measured[0].rtt}ms)`);
|
|
154
|
-
return measured[0];
|
|
155
|
-
}
|
|
156
|
-
async measureRTT(host, _port) {
|
|
157
|
-
const start = performance.now();
|
|
158
|
-
try {
|
|
159
|
-
await fetch(`https://${host}/health`, {
|
|
160
|
-
method: "HEAD",
|
|
161
|
-
signal: AbortSignal.timeout(2e3),
|
|
162
|
-
mode: "no-cors"
|
|
163
|
-
});
|
|
164
|
-
return performance.now() - start;
|
|
165
|
-
} catch {
|
|
166
|
-
return Infinity;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Clear the relay cache
|
|
171
|
-
*/
|
|
172
|
-
clearCache() {
|
|
173
|
-
this.cache.clear();
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Get cached relays for a source address
|
|
177
|
-
*/
|
|
178
|
-
getCached(source) {
|
|
179
|
-
return this.cache.get(source);
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
var driadDiscovery = new DRIADDiscovery();
|
|
183
|
-
|
|
184
1
|
// node_modules/@blockcast/mmt-transport/dist/multicast-tier.js
|
|
185
2
|
function endpointKey(endpoint) {
|
|
186
3
|
return `${endpoint.sourceAddress ?? ""}|${endpoint.groupAddress}|${endpoint.port}`;
|
|
@@ -311,8 +128,8 @@ var AdaptiveBitrateController = class {
|
|
|
311
128
|
/**
|
|
312
129
|
* Update FEC statistics for ABR decisions
|
|
313
130
|
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
131
|
+
* ABR uses the effective loss rate (after FEC recovery) rather than the
|
|
132
|
+
* raw transport loss rate.
|
|
316
133
|
*
|
|
317
134
|
* @param stats - FEC statistics from the FEC decoder
|
|
318
135
|
*/
|
|
@@ -388,6 +205,45 @@ var AdaptiveBitrateController = class {
|
|
|
388
205
|
}
|
|
389
206
|
};
|
|
390
207
|
|
|
208
|
+
// node_modules/@blockcast/mmt-base/dist/mmtp.js
|
|
209
|
+
var MPU_HEADER_SIZE = 8;
|
|
210
|
+
var MPU_LENGTH_FIELD_SIZE = 2;
|
|
211
|
+
var MPU_HEADER_REMAINDER_SIZE = MPU_HEADER_SIZE - MPU_LENGTH_FIELD_SIZE;
|
|
212
|
+
var MMTP_SIGNALING_PACKET_ID = 0;
|
|
213
|
+
var MMTP_PACKET_ID_MAX = 65535;
|
|
214
|
+
|
|
215
|
+
// node_modules/@blockcast/mmt-base/dist/net-constants.js
|
|
216
|
+
var DEFAULT_AMT_RELAY_PORT = 2268;
|
|
217
|
+
|
|
218
|
+
// node_modules/@blockcast/mmt-base/dist/ntp-short.js
|
|
219
|
+
var NTP_SHORT_BITS = 32;
|
|
220
|
+
var NTP_SHORT_MODULUS = 2 ** NTP_SHORT_BITS;
|
|
221
|
+
var NTP_SHORT_HALF_RANGE = 2 ** (NTP_SHORT_BITS - 1);
|
|
222
|
+
function isNtpShort(value) {
|
|
223
|
+
return Number.isInteger(value) && value >= 0 && value < NTP_SHORT_MODULUS;
|
|
224
|
+
}
|
|
225
|
+
function compareNtpShort(a, b) {
|
|
226
|
+
if (!isNtpShort(a) || !isNtpShort(b)) {
|
|
227
|
+
throw new RangeError(`NTP-short values must be integers in [0, 2^${NTP_SHORT_BITS}), got ${String(a)} and ${String(b)}`);
|
|
228
|
+
}
|
|
229
|
+
if (a === b)
|
|
230
|
+
return "equal";
|
|
231
|
+
const forward = (a - b + NTP_SHORT_MODULUS) % NTP_SHORT_MODULUS;
|
|
232
|
+
if (forward < NTP_SHORT_HALF_RANGE)
|
|
233
|
+
return "after";
|
|
234
|
+
if (forward > NTP_SHORT_HALF_RANGE)
|
|
235
|
+
return "before";
|
|
236
|
+
return "unordered";
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// node_modules/@blockcast/mmt-base/dist/fec-block-profile.js
|
|
240
|
+
var FEC_BLOCK_PROFILES = Object.freeze([
|
|
241
|
+
"iso-ssbg1-v1"
|
|
242
|
+
]);
|
|
243
|
+
|
|
244
|
+
// node_modules/@blockcast/mmt-base/dist/catalog-fec-source.js
|
|
245
|
+
var ALL_ROLES = Object.freeze(["video", "audio"]);
|
|
246
|
+
|
|
391
247
|
// node_modules/@blockcast/mmt-transport/dist/multicast-orchestrator.js
|
|
392
248
|
var DEFAULT_DWELL_MS = 3e3;
|
|
393
249
|
var DEFAULT_JOIN_DEADLINE_MS = 5e3;
|
|
@@ -618,29 +474,68 @@ function toWindowMulticastSubscribeConfig(input) {
|
|
|
618
474
|
if (input.packetIds?.some((id) => !isMulticastTrackPacketId(id)) || input.tracks?.some((track) => !isMulticastTrackPacketId(track.packetId))) {
|
|
619
475
|
throw new RangeError(`multicast packetId must be an integer from 1 to ${MMTP_PACKET_ID_MAX}; packetId 0 is the MMTP signaling flow and is never a track's`);
|
|
620
476
|
}
|
|
477
|
+
const source = input.source?.trim() || void 0;
|
|
478
|
+
const senderAddress = input.senderAddress?.trim() || void 0;
|
|
479
|
+
if (source && senderAddress) {
|
|
480
|
+
throw new TypeError("multicast senderAddress is an ASM filter and never appears beside source");
|
|
481
|
+
}
|
|
621
482
|
const base = {
|
|
622
483
|
group: input.group,
|
|
623
484
|
port: input.port,
|
|
624
|
-
...
|
|
485
|
+
...source ? { source } : {},
|
|
625
486
|
consume: "bytes",
|
|
626
487
|
...input.packetIds?.length ? { packetIds: [...input.packetIds] } : {}
|
|
627
488
|
};
|
|
489
|
+
const filter = senderAddress ? { senderAddress } : {};
|
|
490
|
+
if (input.atsc3) {
|
|
491
|
+
if (senderAddress)
|
|
492
|
+
throw new TypeError("an ATSC3 tuner request carries no senderAddress");
|
|
493
|
+
const { frequency, plpId, serviceId } = input.atsc3;
|
|
494
|
+
if (!Number.isInteger(frequency) || frequency < 1) {
|
|
495
|
+
throw new TypeError(`ATSC3 tuning requires a positive integer frequency in kHz, got ${String(frequency)}`);
|
|
496
|
+
}
|
|
497
|
+
return {
|
|
498
|
+
...base,
|
|
499
|
+
origin: "tuner",
|
|
500
|
+
standard: "atsc3",
|
|
501
|
+
frequency,
|
|
502
|
+
...plpId !== void 0 ? { plpId } : {},
|
|
503
|
+
...serviceId !== void 0 ? { serviceId } : {}
|
|
504
|
+
};
|
|
505
|
+
}
|
|
628
506
|
const relay = input.amtRelay?.trim();
|
|
629
|
-
const
|
|
507
|
+
const driad = !relay && input.amtDiscovery === "driad";
|
|
508
|
+
const wantsAmt = input.mode === "tunnel" || input.mode !== "native" && (relay !== void 0 && relay !== "" || driad);
|
|
630
509
|
if (!wantsAmt) {
|
|
631
510
|
const native = {
|
|
632
511
|
...base,
|
|
512
|
+
...filter,
|
|
633
513
|
origin: "ip-multicast",
|
|
634
514
|
...input.tracks?.length ? { tracks: input.tracks.map(({ name, packetId }) => ({ name, packetId })) } : {}
|
|
635
515
|
};
|
|
636
516
|
return native;
|
|
637
517
|
}
|
|
638
518
|
const relayPort = input.amtRelayPort;
|
|
519
|
+
if (driad) {
|
|
520
|
+
if (!base.source)
|
|
521
|
+
throw new TypeError("AMT DRIAD discovery requires a source address");
|
|
522
|
+
if (relayPort !== void 0 && !isPositivePort(relayPort)) {
|
|
523
|
+
throw new TypeError("AMT DRIAD discovery requires a valid relay port when one is given");
|
|
524
|
+
}
|
|
525
|
+
return {
|
|
526
|
+
...base,
|
|
527
|
+
source: base.source,
|
|
528
|
+
origin: "amt",
|
|
529
|
+
discovery: "driad",
|
|
530
|
+
...relayPort !== void 0 ? { relayPort } : {}
|
|
531
|
+
};
|
|
532
|
+
}
|
|
639
533
|
if (!relay || relayPort === void 0 || !isPositivePort(relayPort)) {
|
|
640
534
|
throw new TypeError("AMT requires a resolved relay and a valid relay port");
|
|
641
535
|
}
|
|
642
536
|
return {
|
|
643
537
|
...base,
|
|
538
|
+
...filter,
|
|
644
539
|
origin: "amt",
|
|
645
540
|
relay,
|
|
646
541
|
relayPort
|
|
@@ -666,6 +561,9 @@ function isValidMulticastGroupAddress(address) {
|
|
|
666
561
|
function normalizeMulticastEndpoint(endpoint) {
|
|
667
562
|
const groupAddress = endpoint.groupAddress.trim().toLowerCase();
|
|
668
563
|
const sourceAddress = endpoint.sourceAddress?.trim().toLowerCase() || void 0;
|
|
564
|
+
const senderAddress = endpoint.senderAddress?.trim().toLowerCase() || void 0;
|
|
565
|
+
if (sourceAddress && senderAddress)
|
|
566
|
+
return void 0;
|
|
669
567
|
const amtRelay = endpoint.amtRelay?.trim().toLowerCase() || void 0;
|
|
670
568
|
if (!isValidMulticastGroupAddress(groupAddress) || !isPositivePort(endpoint.port))
|
|
671
569
|
return void 0;
|
|
@@ -676,10 +574,12 @@ function normalizeMulticastEndpoint(endpoint) {
|
|
|
676
574
|
return {
|
|
677
575
|
groupAddress,
|
|
678
576
|
...sourceAddress ? { sourceAddress } : {},
|
|
577
|
+
...senderAddress ? { senderAddress } : {},
|
|
679
578
|
port: endpoint.port,
|
|
680
579
|
...endpoint.mode ? { mode: endpoint.mode } : {},
|
|
681
580
|
...amtRelay ? { amtRelay } : {},
|
|
682
|
-
...endpoint.amtRelayPort ? { amtRelayPort: endpoint.amtRelayPort } : {}
|
|
581
|
+
...endpoint.amtRelayPort ? { amtRelayPort: endpoint.amtRelayPort } : {},
|
|
582
|
+
...endpoint.amtDiscovery === "driad" ? { amtDiscovery: "driad" } : {}
|
|
683
583
|
};
|
|
684
584
|
}
|
|
685
585
|
function multicastEndpointKey(endpoint) {
|
|
@@ -692,7 +592,11 @@ function multicastEndpointKey(endpoint) {
|
|
|
692
592
|
normalized.port,
|
|
693
593
|
normalized.mode ?? "auto",
|
|
694
594
|
normalized.amtRelay ?? "",
|
|
695
|
-
normalized.amtRelayPort ?? ""
|
|
595
|
+
normalized.amtRelayPort ?? "",
|
|
596
|
+
// A DRIAD join is a different gateway subscription from a native one.
|
|
597
|
+
...normalized.amtDiscovery ? [normalized.amtDiscovery] : [],
|
|
598
|
+
// An ASM sender filter is a different subscription from the unfiltered join.
|
|
599
|
+
...normalized.senderAddress ? [{ senderAddress: normalized.senderAddress }] : []
|
|
696
600
|
]);
|
|
697
601
|
}
|
|
698
602
|
function isMulticastTrackPacketId(value) {
|
|
@@ -732,7 +636,8 @@ var MulticastSubscriptionPool = class {
|
|
|
732
636
|
port: config.port,
|
|
733
637
|
mode: config.mode,
|
|
734
638
|
amtRelay: config.amtRelay,
|
|
735
|
-
amtRelayPort: config.amtRelayPort
|
|
639
|
+
amtRelayPort: config.amtRelayPort,
|
|
640
|
+
amtDiscovery: config.amtDiscovery
|
|
736
641
|
});
|
|
737
642
|
if (!endpoint)
|
|
738
643
|
throw new Error("Invalid multicast endpoint");
|
|
@@ -798,7 +703,8 @@ var MulticastSubscriptionPool = class {
|
|
|
798
703
|
port: endpoint.port,
|
|
799
704
|
...endpoint.mode ? { mode: endpoint.mode } : {},
|
|
800
705
|
...endpoint.amtRelay ? { amtRelay: endpoint.amtRelay } : {},
|
|
801
|
-
...endpoint.amtRelayPort ? { amtRelayPort: endpoint.amtRelayPort } : {}
|
|
706
|
+
...endpoint.amtRelayPort ? { amtRelayPort: endpoint.amtRelayPort } : {},
|
|
707
|
+
...endpoint.amtDiscovery ? { amtDiscovery: endpoint.amtDiscovery } : {}
|
|
802
708
|
}));
|
|
803
709
|
const consumers = /* @__PURE__ */ new Map();
|
|
804
710
|
let entry;
|
|
@@ -878,7 +784,6 @@ var TransportManager = class {
|
|
|
878
784
|
};
|
|
879
785
|
capabilities = null;
|
|
880
786
|
subscription = null;
|
|
881
|
-
driad = new DRIADDiscovery();
|
|
882
787
|
/** Built by `connect()` from the caller's ladder; there is no built-in one. */
|
|
883
788
|
abr = null;
|
|
884
789
|
multicastOrchestrator = null;
|
|
@@ -928,8 +833,8 @@ var TransportManager = class {
|
|
|
928
833
|
nativeIGMP: hasGatewayBytes,
|
|
929
834
|
directSockets: typeof win?.UDPSocket !== "undefined",
|
|
930
835
|
amt: false,
|
|
931
|
-
driad:
|
|
932
|
-
//
|
|
836
|
+
driad: hasGatewayBytes,
|
|
837
|
+
// the gateway runs RFC 8777 discovery
|
|
933
838
|
fecDecode: false
|
|
934
839
|
};
|
|
935
840
|
console.log("[Transport] Capabilities:", this.capabilities);
|
|
@@ -940,7 +845,7 @@ var TransportManager = class {
|
|
|
940
845
|
*
|
|
941
846
|
* Promotion hierarchy:
|
|
942
847
|
* 1. window.multicast gateway bytes
|
|
943
|
-
* 2. AMT
|
|
848
|
+
* 2. AMT: a configured relay via the AMT proxy, else gateway DRIAD discovery
|
|
944
849
|
* 3. MOQ WebTransport (final fallback)
|
|
945
850
|
*
|
|
946
851
|
* The ABR ladder (`abrLadder`) and initial rendition (`initialQuality`)
|
|
@@ -1034,7 +939,7 @@ var TransportManager = class {
|
|
|
1034
939
|
/**
|
|
1035
940
|
* Connect via the lowercase window.multicast bytes gateway.
|
|
1036
941
|
*/
|
|
1037
|
-
async connectWindowMulticast(config, generation) {
|
|
942
|
+
async connectWindowMulticast(config, generation, mode = "multicast") {
|
|
1038
943
|
try {
|
|
1039
944
|
const gateway = this.getWindowMulticastGateway();
|
|
1040
945
|
if (typeof gateway?.subscribe !== "function")
|
|
@@ -1069,7 +974,7 @@ var TransportManager = class {
|
|
|
1069
974
|
}
|
|
1070
975
|
};
|
|
1071
976
|
this.state = {
|
|
1072
|
-
mode
|
|
977
|
+
mode,
|
|
1073
978
|
connected: true,
|
|
1074
979
|
group: config.group,
|
|
1075
980
|
source: config.source,
|
|
@@ -1087,29 +992,19 @@ var TransportManager = class {
|
|
|
1087
992
|
}
|
|
1088
993
|
}
|
|
1089
994
|
/**
|
|
1090
|
-
* Connect via AMT proxy
|
|
995
|
+
* Connect via AMT: a configured relay goes through the AMT proxy; with no
|
|
996
|
+
* relay, the window.multicast gateway discovers one per RFC 8777 (DRIAD).
|
|
1091
997
|
*/
|
|
1092
998
|
async connectAmt(config, generation) {
|
|
1093
999
|
try {
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
const relays = await this.driad.discoverRelays(config.source);
|
|
1098
|
-
if (generation !== this.connectionGeneration)
|
|
1099
|
-
return false;
|
|
1100
|
-
const bestRelay = await this.driad.selectBestRelay(relays);
|
|
1101
|
-
if (generation !== this.connectionGeneration)
|
|
1102
|
-
return false;
|
|
1103
|
-
if (bestRelay) {
|
|
1104
|
-
amtRelay = bestRelay.host;
|
|
1105
|
-
this.state.amtRelay = amtRelay;
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
if (!amtRelay) {
|
|
1000
|
+
if (config.amtRelay)
|
|
1001
|
+
return await this.connectAmtProxy(config, config.amtRelay, generation);
|
|
1002
|
+
if (config.driadEnabled === false || !config.source || config.mode === "native") {
|
|
1109
1003
|
console.warn("[Transport] No AMT relay available (DRIAD requires source address for SSM)");
|
|
1110
1004
|
return false;
|
|
1111
1005
|
}
|
|
1112
|
-
|
|
1006
|
+
console.log(`[Transport] Asking the gateway for a DRIAD relay for source ${config.source}...`);
|
|
1007
|
+
return await this.connectWindowMulticast({ ...config, amtDiscovery: "driad" }, generation, "amt");
|
|
1113
1008
|
} catch (error) {
|
|
1114
1009
|
console.warn("[Transport] AMT connection failed:", error);
|
|
1115
1010
|
return false;
|
|
@@ -1340,7 +1235,6 @@ var AMTGatewayManager = class {
|
|
|
1340
1235
|
subscriptions = /* @__PURE__ */ new Map();
|
|
1341
1236
|
messageHandler;
|
|
1342
1237
|
pendingPackets = /* @__PURE__ */ new Map();
|
|
1343
|
-
driad = new DRIADDiscovery();
|
|
1344
1238
|
constructor() {
|
|
1345
1239
|
this.messageHandler = (event) => {
|
|
1346
1240
|
const data = event.data;
|
|
@@ -1371,26 +1265,12 @@ var AMTGatewayManager = class {
|
|
|
1371
1265
|
return keyStr;
|
|
1372
1266
|
}
|
|
1373
1267
|
try {
|
|
1374
|
-
|
|
1375
|
-
let discoveryMethod;
|
|
1268
|
+
const relayAddress = config.relayAddress;
|
|
1376
1269
|
const relayPort = config.relayPort || DEFAULT_AMT_RELAY_PORT;
|
|
1377
|
-
if (
|
|
1378
|
-
|
|
1379
|
-
discoveryMethod = "manual";
|
|
1380
|
-
console.log(`[AMT] Using configured relay ${relayAddress}:${relayPort}`);
|
|
1381
|
-
} else if (key.source) {
|
|
1382
|
-
console.log(`[AMT] No relay configured, discovering via DRIAD for source ${key.source}...`);
|
|
1383
|
-
const relays = await this.driad.discoverRelays(key.source);
|
|
1384
|
-
const bestRelay = await this.driad.selectBestRelay(relays);
|
|
1385
|
-
if (!bestRelay) {
|
|
1386
|
-
throw new Error(`AMT relay discovery failed for source ${key.source}. Please specify a relay address in the subscription configuration.`);
|
|
1387
|
-
}
|
|
1388
|
-
relayAddress = bestRelay.host;
|
|
1389
|
-
discoveryMethod = "driad";
|
|
1390
|
-
console.log(`[AMT] Discovered relay via DRIAD: ${relayAddress}:${relayPort}`);
|
|
1391
|
-
} else {
|
|
1392
|
-
throw new Error(`AMT relay discovery requires a source address for SSM (RFC 8777). Please specify either a relay address or source address.`);
|
|
1270
|
+
if (!relayAddress) {
|
|
1271
|
+
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".`);
|
|
1393
1272
|
}
|
|
1273
|
+
console.log(`[AMT] Using configured relay ${relayAddress}:${relayPort}`);
|
|
1394
1274
|
const subscriptionId = keyStr;
|
|
1395
1275
|
this.pendingPackets.set(subscriptionId, []);
|
|
1396
1276
|
const subscription = {
|
|
@@ -1401,7 +1281,7 @@ var AMTGatewayManager = class {
|
|
|
1401
1281
|
relay: {
|
|
1402
1282
|
address: relayAddress,
|
|
1403
1283
|
port: relayPort,
|
|
1404
|
-
discoveryMethod,
|
|
1284
|
+
discoveryMethod: "manual",
|
|
1405
1285
|
discoveredAt: Date.now()
|
|
1406
1286
|
}
|
|
1407
1287
|
};
|
|
@@ -1599,7 +1479,7 @@ function sameIds(a, b) {
|
|
|
1599
1479
|
for (const id of a) if (!b.has(id)) return false;
|
|
1600
1480
|
return true;
|
|
1601
1481
|
}
|
|
1602
|
-
var MulticastTransport = class
|
|
1482
|
+
var MulticastTransport = class {
|
|
1603
1483
|
#onPacket;
|
|
1604
1484
|
#subscription = null;
|
|
1605
1485
|
#packetListener = null;
|
|
@@ -1671,8 +1551,11 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
1671
1551
|
// droppedPacketIds.
|
|
1672
1552
|
#unadvertisedPacketIds = /* @__PURE__ */ new Set();
|
|
1673
1553
|
#joinGeneration = 0;
|
|
1674
|
-
|
|
1554
|
+
// The provider to subscribe through; window.multicast when unset.
|
|
1555
|
+
#gateway;
|
|
1556
|
+
constructor(onPacket, options = {}) {
|
|
1675
1557
|
this.#onPacket = onPacket;
|
|
1558
|
+
this.#gateway = options.gateway;
|
|
1676
1559
|
}
|
|
1677
1560
|
static isAvailable() {
|
|
1678
1561
|
return hasMulticastGateway();
|
|
@@ -1682,7 +1565,8 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
1682
1565
|
this.#releaseSubscription();
|
|
1683
1566
|
this.#dataPlaneLive = false;
|
|
1684
1567
|
if (this.#disposed) return this.#declined(generation, "disposed");
|
|
1685
|
-
|
|
1568
|
+
const gateway = this.#gateway ?? getMulticastGlobals().multicast;
|
|
1569
|
+
if (typeof gateway?.subscribe !== "function") {
|
|
1686
1570
|
console.warn("[MulticastTransport] Multicast API not available");
|
|
1687
1571
|
return this.#declined(generation, "unavailable");
|
|
1688
1572
|
}
|
|
@@ -1690,20 +1574,23 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
1690
1574
|
try {
|
|
1691
1575
|
const packetIds = config.packetIds?.length ? new Set(config.packetIds) : null;
|
|
1692
1576
|
console.log(
|
|
1693
|
-
`[MulticastTransport] window.multicast.subscribe(${config.sourceAddress}, ${config.groupAddress}, ${config.port})`
|
|
1577
|
+
`[MulticastTransport] window.multicast.subscribe(${config.sourceAddress ?? config.senderAddress ?? "*"}, ${config.groupAddress}, ${config.port})`
|
|
1694
1578
|
);
|
|
1695
1579
|
const subscribeConfig = toWindowMulticastSubscribeConfig({
|
|
1696
1580
|
source: config.sourceAddress,
|
|
1581
|
+
senderAddress: config.senderAddress,
|
|
1697
1582
|
group: config.groupAddress,
|
|
1698
1583
|
port: config.port,
|
|
1699
1584
|
mode: config.mode,
|
|
1700
1585
|
amtRelay: config.amtRelay,
|
|
1701
1586
|
amtRelayPort: config.amtRelayPort,
|
|
1587
|
+
amtDiscovery: config.amtDiscovery,
|
|
1702
1588
|
packetIds: config.packetIds,
|
|
1703
|
-
tracks: config.tracks
|
|
1589
|
+
tracks: config.tracks,
|
|
1590
|
+
atsc3: config.atsc3
|
|
1704
1591
|
});
|
|
1705
1592
|
failure = "provider-rejected";
|
|
1706
|
-
const subscription = await
|
|
1593
|
+
const subscription = await gateway.subscribe(subscribeConfig);
|
|
1707
1594
|
failure = "invalid-subscription";
|
|
1708
1595
|
console.log(`[MulticastTransport] window.multicast.subscribe returned:`, !!subscription);
|
|
1709
1596
|
if (this.#disposed || generation !== this.#joinGeneration) {
|