@blockcast/mmt-container 0.4.0-main.bbd83cb48eff → 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 +31 -17
- 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 +1192 -375
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +67 -31
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +291 -199
- 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 +24 -2
- 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/delivery-catalog.js +18 -12
- package/dist/delivery-catalog.js.map +4 -4
- package/dist/fec-manager.d.ts +49 -1
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +176 -23
- package/dist/fec-manager.js.map +3 -3
- 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 +2 -0
- package/dist/fec-worker-setup.d.ts.map +1 -1
- package/dist/fec-worker-setup.js +2 -1
- package/dist/fec-worker-setup.js.map +2 -2
- 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 +29 -0
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +97 -17
- package/dist/iso-block-locator.js.map +3 -3
- 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.map +2 -2
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +1014 -289
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- 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 +17 -1
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +29 -0
- package/dist/mmtp-router.js.map +2 -2
- 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 +290 -28
- package/dist/multicast-input.js.map +3 -3
- package/dist/multicast-manager.d.ts +40 -5
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +293 -54
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +6 -0
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +18 -11
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js.map +2 -2
- package/dist/no-modules.d.ts +4 -1
- package/dist/no-modules.d.ts.map +1 -1
- package/dist/no-modules.js +964 -274
- 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 +156 -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 +19 -2
- package/dist/repair-layers.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/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.map +2 -2
- package/dist/wasm-mfu-reassembler.js.map +1 -1
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +6 -9
- package/schemas/catalog.schema.json +124 -37
- package/src/align.ts +52 -21
- package/src/carp-catalog.ts +131 -52
- package/src/catalog-fec-params.ts +28 -3
- package/src/catalog-network-source.ts +45 -2
- package/src/catalog-validator.ts +4 -11
- package/src/fec-manager.ts +128 -14
- package/src/fec-state.ts +11 -4
- package/src/fec-worker-setup.ts +4 -1
- package/src/index.ts +24 -10
- package/src/iso-block-locator.ts +97 -6
- package/src/manifest-auth-plan.ts +39 -91
- package/src/mmtp-fec-session.ts +533 -0
- package/src/mmtp-router.ts +57 -0
- package/src/multicast-auth-catalog.ts +131 -238
- package/src/multicast-input.ts +119 -61
- package/src/multicast-manager.ts +115 -14
- package/src/multicast-transport.ts +3 -0
- 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/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 +60 -3
- 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 +6 -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/src/multicast-input.ts
CHANGED
|
@@ -8,7 +8,8 @@ declare const process: { env: Record<string, string | undefined> } | undefined;
|
|
|
8
8
|
/**
|
|
9
9
|
* Multicast catalog input contract — validator + builder.
|
|
10
10
|
*
|
|
11
|
-
* Per draft-ramadan-moq-multicast-
|
|
11
|
+
* Per draft-ramadan-moq-multicast-01 §3 + §4.1 + §7.2.6
|
|
12
|
+
* (Blockcast/moqcast-draft@fd962fd73d21ed281b60219c11ea61cc9e4e91c4), the publisher (FFmpeg,
|
|
12
13
|
* cast bridge, GStreamer, OBS-bridge) populates `multicast.endpoints[]`
|
|
13
14
|
* in the catalog when its output includes a UDP multicast destination.
|
|
14
15
|
*
|
|
@@ -22,17 +23,23 @@ declare const process: { env: Record<string, string | undefined> } | undefined;
|
|
|
22
23
|
* perform.
|
|
23
24
|
*
|
|
24
25
|
* Validation invariants (per codex review of BLO-3323 v2):
|
|
25
|
-
* -
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
26
|
+
* - The emitted mode is the one `sourceAddress` selects (present: SSM,
|
|
27
|
+
* absent: ASM), restated as `protocol`. Input `protocol` "ssm" requires
|
|
28
|
+
* `sourceAddress`, "asm" forbids it.
|
|
29
|
+
* - Input `protocol` "amt" / "atsc3" names a bearer, which draft -01
|
|
30
|
+
* carries as a `networkSource` entry, not a protocol: the `networkSource`
|
|
31
|
+
* entries of that type MOVE onto each endpoint that named it (so they
|
|
32
|
+
* no longer apply to native endpoints) and the protocol is never emitted.
|
|
33
|
+
* An entry of that type is REQUIRED: an AMT one's `relay` only for
|
|
34
|
+
* `discovery: "manual"` ("driad" resolves it at runtime), an ATSC3 one
|
|
35
|
+
* carries the only tuning information an ATSC3 receiver has. A
|
|
36
|
+
* per-endpoint `relayAddress` input is LIFTED into the AMT entry.
|
|
37
|
+
* - Native "ssm" | "asm" requires no `networkSource` entry: a native join
|
|
38
|
+
* describes no alternate bearer (BLO-37926).
|
|
39
|
+
* - `auth` (catalog) and endpoint `auth` follow draft -01 7.2.6 through the
|
|
40
|
+
* shared `multicastCatalogIssues` of `@blockcast/mmt-base`: all or
|
|
41
|
+
* nothing, `senderAddress` on ASM only, bandwidth required, and
|
|
42
|
+
* `(S, G, manifestPort)` clear of every port of its `(S, G)`.
|
|
36
43
|
* - groupAddress is a valid IPv4 multicast group (224.0.0.0/4)
|
|
37
44
|
* or IPv6 multicast group (ff00::/8)
|
|
38
45
|
* - SSM groupAddress MUST be in 232.0.0.0/8 (IPv4) or ff3x::/32 (IPv6),
|
|
@@ -46,23 +53,31 @@ declare const process: { env: Record<string, string | undefined> } | undefined;
|
|
|
46
53
|
* `signaling_packet_id`. The kind string matches cast's
|
|
47
54
|
* `multicast_input.rs` so the two ports report the same reason.
|
|
48
55
|
* - packetIds unique within an endpoint
|
|
49
|
-
* - (
|
|
56
|
+
* - (S, groupAddress, port) tuple unique across endpoints, S being
|
|
57
|
+
* sourceAddress (SSM), auth.senderAddress (protected ASM) or absent
|
|
50
58
|
* - bandwidth (if present) > 0
|
|
51
59
|
* - validUntil (if present) is a positive unix-ms timestamp
|
|
52
60
|
*
|
|
53
|
-
* @see draft-ramadan-moq-multicast-
|
|
61
|
+
* @see draft-ramadan-moq-multicast-01 §4.1, §7.2.6
|
|
54
62
|
* @see .planning/drafts/blo-3323-multicast-catalog-source-of-truth.md
|
|
55
63
|
*/
|
|
56
64
|
|
|
57
|
-
import { MMTP_PACKET_ID_MAX, MMTP_SIGNALING_PACKET_ID } from "@blockcast/mmt-base";
|
|
65
|
+
import { MMTP_PACKET_ID_MAX, MMTP_SIGNALING_PACKET_ID, multicastCatalogIssues } from "@blockcast/mmt-base";
|
|
58
66
|
import {
|
|
59
67
|
type AmtDiscovery,
|
|
60
68
|
type MulticastCatalogConfig,
|
|
61
69
|
type MulticastEndpoint,
|
|
62
|
-
type MulticastProtocol,
|
|
63
70
|
type MulticastTrackObject,
|
|
64
71
|
type NetworkSource,
|
|
65
72
|
} from "./carp-catalog.js";
|
|
73
|
+
import type { EndpointAuthConfig, MulticastAuthConfig } from "./multicast-auth-catalog.js";
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Publisher input protocol. "ssm" / "asm" restate the mode `sourceAddress`
|
|
77
|
+
* selects; "amt" / "atsc3" (draft -00) name a bearer and are mapped onto an
|
|
78
|
+
* endpoint-level `networkSource`, never emitted.
|
|
79
|
+
*/
|
|
80
|
+
export type MulticastInputProtocol = "ssm" | "asm" | "amt" | "atsc3";
|
|
66
81
|
|
|
67
82
|
/**
|
|
68
83
|
* Strict typed input for one multicast endpoint. The publisher provides
|
|
@@ -70,7 +85,7 @@ import {
|
|
|
70
85
|
* lifts it into a `MulticastEndpoint` ready to embed in the catalog.
|
|
71
86
|
*/
|
|
72
87
|
export interface MulticastEndpointInput {
|
|
73
|
-
readonly protocol:
|
|
88
|
+
readonly protocol: MulticastInputProtocol;
|
|
74
89
|
readonly sourceAddress?: string;
|
|
75
90
|
readonly groupAddress: string;
|
|
76
91
|
readonly port: number;
|
|
@@ -88,8 +103,10 @@ export interface MulticastEndpointInput {
|
|
|
88
103
|
* Prefer declaring `MulticastInput.networkSource` directly.
|
|
89
104
|
*/
|
|
90
105
|
readonly relayAddress?: string;
|
|
91
|
-
/** Aggregate bandwidth in bits per second. RECOMMENDED per draft §4.1
|
|
106
|
+
/** Aggregate bandwidth in bits per second. RECOMMENDED per draft §4.1; REQUIRED with `auth`. */
|
|
92
107
|
readonly bandwidth?: number;
|
|
108
|
+
/** Protected-flow parameters (draft -01 7.2.6); REQUIRED exactly when `MulticastInput.auth` is set. */
|
|
109
|
+
readonly auth?: EndpointAuthConfig;
|
|
93
110
|
}
|
|
94
111
|
|
|
95
112
|
/**
|
|
@@ -112,7 +129,9 @@ export interface MulticastInput {
|
|
|
112
129
|
*/
|
|
113
130
|
readonly networkSource?: ReadonlyArray<NetworkSource>;
|
|
114
131
|
/** @deprecated Lifted into `networkSource`; no longer emitted. */
|
|
115
|
-
readonly amtFallback?: { readonly discovery
|
|
132
|
+
readonly amtFallback?: { readonly discovery?: AmtDiscovery; readonly relayDns?: string };
|
|
133
|
+
/** bc-provenance version 2 profile and keys (draft -01 7.2.6). */
|
|
134
|
+
readonly auth?: MulticastAuthConfig;
|
|
116
135
|
readonly version?: number;
|
|
117
136
|
readonly validUntil?: number;
|
|
118
137
|
}
|
|
@@ -127,6 +146,17 @@ export type MulticastInputErrorKind =
|
|
|
127
146
|
*/
|
|
128
147
|
| "invalid_endpoints"
|
|
129
148
|
| "ssm_requires_source"
|
|
149
|
+
/** Input `protocol` "asm" with a `sourceAddress`, which selects SSM. */
|
|
150
|
+
| "protocol_source_mismatch"
|
|
151
|
+
/** `MulticastInput.auth` fails draft -01 7.2.6 (version, keys, a repeated kid or firstEpoch). */
|
|
152
|
+
| "invalid_multicast_auth"
|
|
153
|
+
/**
|
|
154
|
+
* An endpoint's `auth` fails draft -01 7.2.6: present without
|
|
155
|
+
* `MulticastInput.auth` or absent with it, `senderAddress` on SSM or
|
|
156
|
+
* missing on ASM, a timer out of range, no `bandwidth`, or a
|
|
157
|
+
* `manifestPort` that is a port or manifestPort of its `(S, G)`.
|
|
158
|
+
*/
|
|
159
|
+
| "invalid_endpoint_auth"
|
|
130
160
|
/**
|
|
131
161
|
* Deliberately overloaded, unlike its one-site mirror
|
|
132
162
|
* `atsc3_requires_tuning`: an AMT relay can be missing at two layers, and
|
|
@@ -138,8 +168,8 @@ export type MulticastInputErrorKind =
|
|
|
138
168
|
| "amt_requires_relay"
|
|
139
169
|
/**
|
|
140
170
|
* An `atsc3` endpoint with no `networkSource` entry of type `"atsc3"`. The
|
|
141
|
-
* ATSC3 entry carries the frequency
|
|
142
|
-
* tuning information there is — so without it the endpoint names a broadcast
|
|
171
|
+
* ATSC3 entry carries the frequency (kHz; PLP, service id and SLS URI are
|
|
172
|
+
* optional) — the only tuning information there is — so without it the endpoint names a broadcast
|
|
143
173
|
* nobody can tune to. The AMT mirror of this is `amt_requires_relay`; native
|
|
144
174
|
* joins ("ssm", "asm") describe no bearer and are exempt (BLO-37926).
|
|
145
175
|
*/
|
|
@@ -242,8 +272,7 @@ export function multicastFromConfig(input: MulticastInput): MulticastCatalogConf
|
|
|
242
272
|
}
|
|
243
273
|
}
|
|
244
274
|
|
|
245
|
-
const
|
|
246
|
-
const endpoints: MulticastEndpoint[] = input.endpoints.map((ep, idx) => validateEndpoint(ep, idx, seenTuples));
|
|
275
|
+
const endpoints: MulticastEndpoint[] = input.endpoints.map((ep, idx) => validateEndpoint(ep, idx));
|
|
247
276
|
|
|
248
277
|
const out: MulticastCatalogConfig = { endpoints };
|
|
249
278
|
const { entries: networkSource, relayFrom } = resolveNetworkSource(input);
|
|
@@ -312,8 +341,8 @@ export function multicastFromConfig(input: MulticastInput): MulticastCatalogConf
|
|
|
312
341
|
//
|
|
313
342
|
// The two arms are about different values, so they name different
|
|
314
343
|
// fields. The demoted arm is about `discovery`: a derived entry is only
|
|
315
|
-
// `"driad"` when `amtFallback.discovery` said so (
|
|
316
|
-
//
|
|
344
|
+
// `"driad"` when `amtFallback.discovery` said so (there is no default),
|
|
345
|
+
// so `amtFallback` is always the actionable field there.
|
|
317
346
|
// The set clause is about the *relay*, which `resolveNetworkSource`
|
|
318
347
|
// takes from `amtFallback.relayDns` or from the endpoint
|
|
319
348
|
// `relayAddress` values -- and saying "amtFallback" to an operator who
|
|
@@ -375,11 +404,35 @@ export function multicastFromConfig(input: MulticastInput): MulticastCatalogConf
|
|
|
375
404
|
`endpoint[${idx}] protocol=${ep.protocol} requires a multicast.networkSource entry of ` +
|
|
376
405
|
`type "${ep.protocol}"` +
|
|
377
406
|
(ep.protocol === "atsc3"
|
|
378
|
-
? " carrying
|
|
407
|
+
? " carrying at least its frequency (kHz) — an ATSC3 endpoint is not tunable without it"
|
|
379
408
|
: ""),
|
|
380
409
|
);
|
|
381
410
|
});
|
|
382
411
|
|
|
412
|
+
// Draft -01 4.2: a bearer is a networkSource entry. An endpoint that named
|
|
413
|
+
// one as its protocol gets that type's entries as its own networkSource.
|
|
414
|
+
// They are copied, not moved: the catalog-level array already applied to
|
|
415
|
+
// every endpoint under -00 readers, and still does under -01.
|
|
416
|
+
input.endpoints.forEach((ep, idx) => {
|
|
417
|
+
if (ep.protocol !== "amt" && ep.protocol !== "atsc3") return;
|
|
418
|
+
endpoints[idx]!.networkSource = networkSource.filter((s) => s.type === ep.protocol).map((s) => ({ ...s }));
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
if (input.auth !== undefined) out.auth = input.auth;
|
|
422
|
+
const [issue] = multicastCatalogIssues({ multicast: out });
|
|
423
|
+
if (issue) {
|
|
424
|
+
const kind: MulticastInputErrorKind =
|
|
425
|
+
issue.code === "multicast_auth"
|
|
426
|
+
? "invalid_multicast_auth"
|
|
427
|
+
: issue.code === "multicast_endpoint_auth"
|
|
428
|
+
? "invalid_endpoint_auth"
|
|
429
|
+
: issue.path.endsWith(".port")
|
|
430
|
+
? "duplicate_endpoint_tuple"
|
|
431
|
+
: "protocol_source_mismatch";
|
|
432
|
+
const where = issue.endpointIndex === undefined ? "" : `endpoint[${issue.endpointIndex}] `;
|
|
433
|
+
throw new MulticastInputError(kind, issue.endpointIndex ?? null, `${where}${issue.path.replace("$.multicast.", "")}: ${issue.message}`);
|
|
434
|
+
}
|
|
435
|
+
|
|
383
436
|
if (input.enabled !== undefined) out.enabled = input.enabled;
|
|
384
437
|
if (input.version !== undefined) out.version = input.version;
|
|
385
438
|
if (input.validUntil !== undefined) out.validUntil = input.validUntil;
|
|
@@ -391,9 +444,10 @@ export function multicastFromConfig(input: MulticastInput): MulticastCatalogConf
|
|
|
391
444
|
*
|
|
392
445
|
* An explicit `input.networkSource` is authoritative and used as given.
|
|
393
446
|
* Otherwise one AMT entry is derived from the deprecated inputs it replaces:
|
|
394
|
-
* `amtFallback.discovery`/`relayDns` and any endpoint `relayAddress
|
|
395
|
-
* `discovery`
|
|
396
|
-
*
|
|
447
|
+
* `amtFallback.discovery`/`relayDns` and any endpoint `relayAddress`.
|
|
448
|
+
* `discovery` is copied only when given: draft-ramadan-moq-multicast-01 4.2.1
|
|
449
|
+
* reads an omitted `discovery` with a hostname `relay` as `"dns"`, so no
|
|
450
|
+
* default is written. Endpoint relays that disagree with the result
|
|
397
451
|
* are rejected by `multicastFromConfig`, not resolved here.
|
|
398
452
|
*
|
|
399
453
|
* `relayFrom` reports which deprecated input supplied the derived relay, so
|
|
@@ -411,10 +465,10 @@ function resolveNetworkSource(input: MulticastInput): {
|
|
|
411
465
|
|
|
412
466
|
const relayDns = input.amtFallback?.relayDns?.trim();
|
|
413
467
|
const relay = relayDns || input.endpoints.map((ep) => ep.relayAddress?.trim()).find((r) => !!r);
|
|
414
|
-
const discovery = input.amtFallback?.discovery
|
|
415
|
-
if (discovery === undefined) return { entries: [], relayFrom: null };
|
|
468
|
+
const discovery = input.amtFallback?.discovery;
|
|
469
|
+
if (discovery === undefined && !relay) return { entries: [], relayFrom: null };
|
|
416
470
|
return {
|
|
417
|
-
entries: [{ type: "amt", discovery, ...(relay ? { relay } : {}) }],
|
|
471
|
+
entries: [{ type: "amt", ...(discovery ? { discovery } : {}), ...(relay ? { relay } : {}) }],
|
|
418
472
|
relayFrom: !relay ? null : relayDns ? "amtFallback.relayDns" : "endpoint.relayAddress",
|
|
419
473
|
};
|
|
420
474
|
}
|
|
@@ -425,7 +479,7 @@ const ATSC3_SOURCE_KEYS = new Set(["type", "frequency", "plpId", "serviceId", "s
|
|
|
425
479
|
/**
|
|
426
480
|
* One `networkSource[]` entry against `catalog.schema.json` `$defs/networkSource`
|
|
427
481
|
* (and moq-rs `NetworkSource`), plus the one semantic rule the schema leaves
|
|
428
|
-
* out: `discovery: "manual"`
|
|
482
|
+
* out: `discovery: "dns"` and `"manual"` name their relay. These helpers are consumed
|
|
429
483
|
* out-of-tree from plain JS, so the `NetworkSource` type is no guarantee.
|
|
430
484
|
*/
|
|
431
485
|
function validateNetworkSourceEntry(s: NetworkSource, i: number): void {
|
|
@@ -443,8 +497,11 @@ function validateNetworkSourceEntry(s: NetworkSource, i: number): void {
|
|
|
443
497
|
if (extra.length > 0) throw err("invalid_network_source", `has keys the schema rejects: ${extra.join(", ")}`);
|
|
444
498
|
|
|
445
499
|
if (s.type === "amt") {
|
|
446
|
-
if (s.discovery !== "driad" && s.discovery !== "manual") {
|
|
447
|
-
throw err(
|
|
500
|
+
if (s.discovery !== undefined && s.discovery !== "dns" && s.discovery !== "driad" && s.discovery !== "manual") {
|
|
501
|
+
throw err(
|
|
502
|
+
"invalid_amt_discovery",
|
|
503
|
+
`discovery must be "dns", "driad" or "manual" when present; got ${JSON.stringify(s.discovery)}`,
|
|
504
|
+
);
|
|
448
505
|
}
|
|
449
506
|
if (s.relay !== undefined) {
|
|
450
507
|
// Canonicalize, don't just check: the conflict guard in
|
|
@@ -459,8 +516,8 @@ function validateNetworkSourceEntry(s: NetworkSource, i: number): void {
|
|
|
459
516
|
}
|
|
460
517
|
s.relay = relay;
|
|
461
518
|
}
|
|
462
|
-
if (s.discovery === "manual" && s.relay === undefined) {
|
|
463
|
-
throw err("amt_requires_relay", `discovery="
|
|
519
|
+
if ((s.discovery === "dns" || s.discovery === "manual") && s.relay === undefined) {
|
|
520
|
+
throw err("amt_requires_relay", `discovery="${s.discovery}" requires a relay ("driad" resolves it at runtime)`);
|
|
464
521
|
}
|
|
465
522
|
if (s.port !== undefined && (!Number.isInteger(s.port) || s.port < 1 || s.port > 65535)) {
|
|
466
523
|
throw err("invalid_port", `port must be 1..65535; got ${s.port}`);
|
|
@@ -469,13 +526,16 @@ function validateNetworkSourceEntry(s: NetworkSource, i: number): void {
|
|
|
469
526
|
}
|
|
470
527
|
const inRange = (v: number, min: number, max: number) => Number.isInteger(v) && v >= min && v <= max;
|
|
471
528
|
if (!inRange(s.frequency, 1, Number.MAX_SAFE_INTEGER)) {
|
|
472
|
-
throw err("invalid_network_source", `frequency must be a positive integer; got ${s.frequency}`);
|
|
529
|
+
throw err("invalid_network_source", `frequency must be a positive integer in kHz; got ${s.frequency}`);
|
|
530
|
+
}
|
|
531
|
+
// Draft -01 4.2.2: only frequency (kHz) is REQUIRED; the rest are checked when set.
|
|
532
|
+
if (s.plpId !== undefined && !inRange(s.plpId, 0, 63)) {
|
|
533
|
+
throw err("invalid_network_source", `plpId must be 0..63; got ${s.plpId}`);
|
|
473
534
|
}
|
|
474
|
-
if (!inRange(s.
|
|
475
|
-
if (!inRange(s.serviceId, 0, 65535)) {
|
|
535
|
+
if (s.serviceId !== undefined && !inRange(s.serviceId, 0, 65535)) {
|
|
476
536
|
throw err("invalid_network_source", `serviceId must be 0..65535; got ${s.serviceId}`);
|
|
477
537
|
}
|
|
478
|
-
if (typeof s.slsUri !== "string" || !isAbsoluteUri(s.slsUri)) {
|
|
538
|
+
if (s.slsUri !== undefined && (typeof s.slsUri !== "string" || !isAbsoluteUri(s.slsUri))) {
|
|
479
539
|
throw err("invalid_network_source", `slsUri must be an absolute URI; got ${JSON.stringify(s.slsUri)}`);
|
|
480
540
|
}
|
|
481
541
|
}
|
|
@@ -489,11 +549,7 @@ function isAbsoluteUri(value: string): boolean {
|
|
|
489
549
|
}
|
|
490
550
|
}
|
|
491
551
|
|
|
492
|
-
function validateEndpoint(
|
|
493
|
-
ep: MulticastEndpointInput,
|
|
494
|
-
idx: number,
|
|
495
|
-
seenTuples: Set<string>,
|
|
496
|
-
): MulticastEndpoint {
|
|
552
|
+
function validateEndpoint(ep: MulticastEndpointInput, idx: number): MulticastEndpoint {
|
|
497
553
|
if (ep.protocol === "ssm" && (!ep.sourceAddress || ep.sourceAddress.length === 0)) {
|
|
498
554
|
throw new MulticastInputError(
|
|
499
555
|
"ssm_requires_source",
|
|
@@ -501,6 +557,13 @@ function validateEndpoint(
|
|
|
501
557
|
`endpoint[${idx}] protocol=ssm requires sourceAddress`,
|
|
502
558
|
);
|
|
503
559
|
}
|
|
560
|
+
if (ep.protocol === "asm" && ep.sourceAddress !== undefined) {
|
|
561
|
+
throw new MulticastInputError(
|
|
562
|
+
"protocol_source_mismatch",
|
|
563
|
+
idx,
|
|
564
|
+
`endpoint[${idx}] protocol=asm with sourceAddress "${ep.sourceAddress}"; sourceAddress selects SSM (draft -01 4.1)`,
|
|
565
|
+
);
|
|
566
|
+
}
|
|
504
567
|
// NOTE: `protocol: "amt"` no longer requires a per-endpoint relay here. The
|
|
505
568
|
// relay is catalog-level (`multicast.networkSource`), which this function
|
|
506
569
|
// cannot see; `multicastFromConfig` enforces it once both halves are in hand.
|
|
@@ -570,18 +633,12 @@ function validateEndpoint(
|
|
|
570
633
|
);
|
|
571
634
|
}
|
|
572
635
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
idx,
|
|
578
|
-
`endpoint[${idx}] duplicates (sourceAddress, groupAddress, port) tuple "${tupleKey}"`,
|
|
579
|
-
);
|
|
580
|
-
}
|
|
581
|
-
seenTuples.add(tupleKey);
|
|
582
|
-
|
|
636
|
+
// Tuple uniqueness is keyed on S, which needs `auth`; `multicastFromConfig`
|
|
637
|
+
// checks it with the rest of draft -01 4.1 once the catalog is composed.
|
|
638
|
+
// The emitted protocol restates the mode `sourceAddress` selects; a bearer
|
|
639
|
+
// input protocol is never emitted.
|
|
583
640
|
const out: MulticastEndpoint = {
|
|
584
|
-
protocol: ep.
|
|
641
|
+
protocol: ep.sourceAddress === undefined ? "asm" : "ssm",
|
|
585
642
|
groupAddress: ep.groupAddress,
|
|
586
643
|
port: ep.port,
|
|
587
644
|
tracks: ep.tracks.map((t) => ({ name: t.name, packetId: t.packetId })),
|
|
@@ -590,6 +647,7 @@ function validateEndpoint(
|
|
|
590
647
|
// `relayAddress` is deliberately NOT copied: the relay is lifted to
|
|
591
648
|
// catalog-level `multicast.networkSource` by `multicastFromConfig`.
|
|
592
649
|
if (ep.bandwidth !== undefined) out.bandwidth = ep.bandwidth;
|
|
650
|
+
if (ep.auth !== undefined) out.auth = { ...ep.auth };
|
|
593
651
|
return out;
|
|
594
652
|
}
|
|
595
653
|
|
|
@@ -689,9 +747,9 @@ export function multicastFromEnv(
|
|
|
689
747
|
...(hasCatalogAmt
|
|
690
748
|
? {
|
|
691
749
|
amtFallback: {
|
|
692
|
-
//
|
|
693
|
-
//
|
|
694
|
-
discovery:
|
|
750
|
+
// No default: an omitted discovery with a relay hostname is
|
|
751
|
+
// "dns" (draft-ramadan-moq-multicast-01 4.2.1).
|
|
752
|
+
...(amtDiscovery ? { discovery: amtDiscovery as AmtDiscovery } : {}),
|
|
695
753
|
...(amtRelayDns ? { relayDns: amtRelayDns } : {}),
|
|
696
754
|
},
|
|
697
755
|
}
|
|
@@ -757,7 +815,7 @@ function readEndpointAt(env: Record<string, string | undefined>, idx: number): M
|
|
|
757
815
|
const relay = lookup("RELAY");
|
|
758
816
|
|
|
759
817
|
return {
|
|
760
|
-
protocol: lookup("PROTOCOL") as
|
|
818
|
+
protocol: lookup("PROTOCOL") as MulticastInputProtocol,
|
|
761
819
|
groupAddress: lookup("GROUP") ?? "",
|
|
762
820
|
port,
|
|
763
821
|
tracks,
|
package/src/multicast-manager.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
type FecFallbackDecoder,
|
|
19
19
|
type MulticastSymbolDelivery,
|
|
20
20
|
type RepairVia,
|
|
21
|
+
type UndelimitedIsoLoss,
|
|
21
22
|
} from "./fec-manager.js";
|
|
22
23
|
import {
|
|
23
24
|
deriveBlockClassifierGeometry,
|
|
@@ -31,8 +32,10 @@ import {
|
|
|
31
32
|
type TrackKind,
|
|
32
33
|
} from "./block-policy.js";
|
|
33
34
|
import type {
|
|
35
|
+
RepairDeadlineBound,
|
|
34
36
|
RepairFetchHost,
|
|
35
37
|
RepairPriorityReason,
|
|
38
|
+
RepairSendMeasurement,
|
|
36
39
|
RepairSkipReason,
|
|
37
40
|
RepairSubscribeCallback,
|
|
38
41
|
} from "./repair-fetch.js";
|
|
@@ -332,6 +335,9 @@ interface RepairSymbolCounts {
|
|
|
332
335
|
* class.
|
|
333
336
|
* - `recovered` / `failed`: every block that could not complete from its
|
|
334
337
|
* first-arrival source symbols resolves with exactly one of these.
|
|
338
|
+
* - `repair-sent`: the scheduler admitted and sent a repair FETCH; carries
|
|
339
|
+
* the admission inputs (RTT, time left to the deadline, which term set
|
|
340
|
+
* the deadline) so a harness reads the budget instead of inferring it.
|
|
335
341
|
* - `repair-preempted` / `repair-deferred`: the scheduler aborted a delta
|
|
336
342
|
* repair for keyframe work, or never ran it before its block resolved.
|
|
337
343
|
* - `repair-priority`: the catalog could not supply the SUBSCRIBER_PRIORITY a
|
|
@@ -379,6 +385,23 @@ export type RepairLifecycleEvent =
|
|
|
379
385
|
readonly type: "repair-preempted" | "repair-deferred";
|
|
380
386
|
readonly block: RepairBlockIdentity;
|
|
381
387
|
}
|
|
388
|
+
| {
|
|
389
|
+
readonly version: 2;
|
|
390
|
+
/**
|
|
391
|
+
* The scheduler sent a FETCH (BLO-33597): every attempt, a retry or a
|
|
392
|
+
* reprioritised restart included. `budgetMs` is the time left to the
|
|
393
|
+
* deadline at send, `bound` which term set that deadline; `delayMs` and
|
|
394
|
+
* `blockAgeMs` are null for a block with no anchor.
|
|
395
|
+
*/
|
|
396
|
+
readonly type: "repair-sent";
|
|
397
|
+
readonly block: RepairBlockIdentity;
|
|
398
|
+
readonly priority: RepairPriority;
|
|
399
|
+
readonly rttMs: number;
|
|
400
|
+
readonly budgetMs: number;
|
|
401
|
+
readonly delayMs: number | null;
|
|
402
|
+
readonly blockAgeMs: number | null;
|
|
403
|
+
readonly bound: RepairDeadlineBound;
|
|
404
|
+
}
|
|
382
405
|
| {
|
|
383
406
|
readonly version: 2;
|
|
384
407
|
/**
|
|
@@ -459,6 +482,11 @@ export interface BlockPolicyStats {
|
|
|
459
482
|
repairsSkippedRttExceedsBudget: number;
|
|
460
483
|
/** `repairsSkipped` by reason: the player gave no presentation delay. */
|
|
461
484
|
repairsSkippedPresentationDelayUnavailable: number;
|
|
485
|
+
/**
|
|
486
|
+
* `repairsSkipped` by reason: a lost SS_ID in an undelimited span had no
|
|
487
|
+
* §7.5 anchor (no epoch reference, or none it could be extended from).
|
|
488
|
+
*/
|
|
489
|
+
repairsSkippedRangeNoAnchor: number;
|
|
462
490
|
/**
|
|
463
491
|
* The most recent skip: its reason, the measured RTT (null when
|
|
464
492
|
* unmeasured), the time that was left to the deadline, and the request's
|
|
@@ -473,6 +501,8 @@ export interface BlockPolicyStats {
|
|
|
473
501
|
} | null;
|
|
474
502
|
/** Repair FETCHes sent for keyframe/unknown (P0) blocks, every attempt counted. */
|
|
475
503
|
keyframeRepairFetchesSent: number;
|
|
504
|
+
/** Range repair FETCHes (draft-ramadan-moq-fec §7.5 lost SS_ID) sent, every attempt counted. */
|
|
505
|
+
rangeRepairFetchesSent: number;
|
|
476
506
|
/**
|
|
477
507
|
* Requests the keyframe late-repair budget extended past the presentation
|
|
478
508
|
* deadline (each one can hold the stream behind its block that long).
|
|
@@ -517,8 +547,10 @@ function newBlockPolicyStats(
|
|
|
517
547
|
repairsSkippedRttUnmeasured: 0,
|
|
518
548
|
repairsSkippedRttExceedsBudget: 0,
|
|
519
549
|
repairsSkippedPresentationDelayUnavailable: 0,
|
|
550
|
+
repairsSkippedRangeNoAnchor: 0,
|
|
520
551
|
lastRepairSkip: null,
|
|
521
552
|
keyframeRepairFetchesSent: 0,
|
|
553
|
+
rangeRepairFetchesSent: 0,
|
|
522
554
|
keyframeBudgetHolds: 0,
|
|
523
555
|
keyframeBudgetHoldMs: 0,
|
|
524
556
|
deltaBlocksFailed: 0,
|
|
@@ -664,6 +696,12 @@ const REPAIR_PRIORITY_REASONS: ReadonlySet<unknown> = new Set([
|
|
|
664
696
|
"repair-priority-absent",
|
|
665
697
|
"repair-priority-invalid",
|
|
666
698
|
]);
|
|
699
|
+
const REPAIR_SKIP_REASONS: ReadonlySet<unknown> = new Set([
|
|
700
|
+
"rtt-unmeasured",
|
|
701
|
+
"rtt-exceeds-budget",
|
|
702
|
+
"presentation-delay-unavailable",
|
|
703
|
+
]);
|
|
704
|
+
const REPAIR_DEADLINE_BOUNDS: ReadonlySet<unknown> = new Set(["wait", "presentation", "keyframe", "retention"]);
|
|
667
705
|
const GAP_REASONS: Readonly<Record<string, "stall" | "conceal">> = {
|
|
668
706
|
"rap-lost": "stall",
|
|
669
707
|
"rap-unknown": "stall",
|
|
@@ -696,6 +734,10 @@ function isNullableNonNegative(value: unknown): boolean {
|
|
|
696
734
|
return value === null || (typeof value === "number" && Number.isFinite(value) && value >= 0);
|
|
697
735
|
}
|
|
698
736
|
|
|
737
|
+
function isFiniteNumber(value: unknown): boolean {
|
|
738
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
739
|
+
}
|
|
740
|
+
|
|
699
741
|
/** Runtime guard for observer, DOM-event, and cross-realm consumers. */
|
|
700
742
|
export function isRepairLifecycleEvent(
|
|
701
743
|
value: unknown,
|
|
@@ -738,6 +780,40 @@ export function isRepairLifecycleEvent(
|
|
|
738
780
|
case "repair-preempted":
|
|
739
781
|
case "repair-deferred":
|
|
740
782
|
return hasExactKeys(value, ["version", "type", "block"]) && isRepairBlockIdentity(block);
|
|
783
|
+
case "repair-sent":
|
|
784
|
+
// Admission sends only when 0 < rttMs < budgetMs.
|
|
785
|
+
return (
|
|
786
|
+
hasExactKeys(value, [
|
|
787
|
+
"version",
|
|
788
|
+
"type",
|
|
789
|
+
"block",
|
|
790
|
+
"priority",
|
|
791
|
+
"rttMs",
|
|
792
|
+
"budgetMs",
|
|
793
|
+
"delayMs",
|
|
794
|
+
"blockAgeMs",
|
|
795
|
+
"bound",
|
|
796
|
+
]) &&
|
|
797
|
+
isRepairBlockIdentity(block) &&
|
|
798
|
+
(value["priority"] === 0 || value["priority"] === 1 || value["priority"] === 2) &&
|
|
799
|
+
isFiniteNumber(value["rttMs"]) &&
|
|
800
|
+
(value["rttMs"] as number) > 0 &&
|
|
801
|
+
isFiniteNumber(value["budgetMs"]) &&
|
|
802
|
+
(value["budgetMs"] as number) > (value["rttMs"] as number) &&
|
|
803
|
+
isNullableNonNegative(value["delayMs"]) &&
|
|
804
|
+
isNullableNonNegative(value["blockAgeMs"]) &&
|
|
805
|
+
(value["delayMs"] === null) === (value["blockAgeMs"] === null) &&
|
|
806
|
+
REPAIR_DEADLINE_BOUNDS.has(value["bound"])
|
|
807
|
+
);
|
|
808
|
+
case "repair-skipped":
|
|
809
|
+
// budgetMs may be negative: the deadline can already have passed.
|
|
810
|
+
return (
|
|
811
|
+
hasExactKeys(value, ["version", "type", "block", "reason", "rttMs", "budgetMs"]) &&
|
|
812
|
+
isRepairBlockIdentity(block) &&
|
|
813
|
+
REPAIR_SKIP_REASONS.has(value["reason"]) &&
|
|
814
|
+
isNullableNonNegative(value["rttMs"]) &&
|
|
815
|
+
isFiniteNumber(value["budgetMs"])
|
|
816
|
+
);
|
|
741
817
|
case "repair-priority": {
|
|
742
818
|
const blockClass = value["blockClass"];
|
|
743
819
|
const action = value["action"];
|
|
@@ -2465,7 +2541,7 @@ export class MulticastManager {
|
|
|
2465
2541
|
*
|
|
2466
2542
|
* D-04: Validates completeness via validateSwitchingSet — throws if incomplete.
|
|
2467
2543
|
* D-07: Applies per-track FEC configs (base+delta get decoders; repair does not).
|
|
2468
|
-
* D-17: Builds altGroup → track-name index for getSwitchingSet().
|
|
2544
|
+
* D-17: Builds altGroup → track-name index for getSwitchingSet() (repair legs excluded).
|
|
2469
2545
|
* D-26: Registers packetId → TrackRole on MmtpRouter for block-complete fanout.
|
|
2470
2546
|
*
|
|
2471
2547
|
* FEC availability is per track (draft-ramadan-moq-fec §5.1). A media track
|
|
@@ -2545,11 +2621,9 @@ export class MulticastManager {
|
|
|
2545
2621
|
}
|
|
2546
2622
|
}
|
|
2547
2623
|
const repairOwnerGroup = new Map<string, string>();
|
|
2548
|
-
const repairOwnerAltGroup = new Map<string, number | undefined>();
|
|
2549
2624
|
for (const track of catalog.tracks) {
|
|
2550
2625
|
for (const repairName of repairNamesBySource.get(track.name) ?? []) {
|
|
2551
2626
|
repairOwnerGroup.set(repairName, altGroupKey(track));
|
|
2552
|
-
repairOwnerAltGroup.set(repairName, track.altGroup);
|
|
2553
2627
|
}
|
|
2554
2628
|
}
|
|
2555
2629
|
const groupKeyFor = (track: MultiTrackCatalogTrack): string =>
|
|
@@ -2682,15 +2756,13 @@ export class MulticastManager {
|
|
|
2682
2756
|
const track = catalog.tracks[i]!;
|
|
2683
2757
|
const role = resolvedRoles[i]!;
|
|
2684
2758
|
|
|
2685
|
-
// D-17: Build altGroup → track-name index.
|
|
2686
|
-
//
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
if (altGroup !== undefined) {
|
|
2691
|
-
const existing = this.#switchingSets.get(altGroup) ?? [];
|
|
2759
|
+
// D-17: Build altGroup → track-name index. Members are the tracks that
|
|
2760
|
+
// carry equal altGroup; a repair leg is in no switching set, whatever it
|
|
2761
|
+
// declares (draft-ramadan-moq-mmt-01 Switching Sets).
|
|
2762
|
+
if (role !== "repair" && track.altGroup !== undefined) {
|
|
2763
|
+
const existing = this.#switchingSets.get(track.altGroup) ?? [];
|
|
2692
2764
|
existing.push(track.name);
|
|
2693
|
-
this.#switchingSets.set(altGroup, existing);
|
|
2765
|
+
this.#switchingSets.set(track.altGroup, existing);
|
|
2694
2766
|
}
|
|
2695
2767
|
|
|
2696
2768
|
// D-26: Register packetId → role on MmtpRouter (if packetId provided at ingest time).
|
|
@@ -2784,7 +2856,7 @@ export class MulticastManager {
|
|
|
2784
2856
|
|
|
2785
2857
|
/**
|
|
2786
2858
|
* Return the track names belonging to the given altGroup switching set.
|
|
2787
|
-
* D-17:
|
|
2859
|
+
* D-17: tracks with equal altGroup form one switching set; repair legs are in none.
|
|
2788
2860
|
*
|
|
2789
2861
|
* @param altGroup - The altGroup number to look up.
|
|
2790
2862
|
* @returns Array of track names in that switching set (empty if none).
|
|
@@ -2814,6 +2886,21 @@ export class MulticastManager {
|
|
|
2814
2886
|
};
|
|
2815
2887
|
}
|
|
2816
2888
|
|
|
2889
|
+
/**
|
|
2890
|
+
* Register the range repair scheduler (draft-ramadan-moq-fec §7.5): from now
|
|
2891
|
+
* on an iso-ssbg1-v1 gap missing a source and every repair is kept as a
|
|
2892
|
+
* pending hole and reported here, and `closeIsoHoles` must be called for it
|
|
2893
|
+
* once its range FETCH ends (or none is sent).
|
|
2894
|
+
*/
|
|
2895
|
+
onUndelimitedLoss(cb: (loss: UndelimitedIsoLoss) => void): void {
|
|
2896
|
+
this.#fec.setUndelimitedLossHandler(cb);
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
/** End a pending hole's range repair: feed what no repair stated as spans. */
|
|
2900
|
+
closeIsoHoles(packetId: number, catalogTrackName: string | undefined, start: number, length: number): void {
|
|
2901
|
+
this.#router.closeIsoHoles(packetId, catalogTrackName, start, length);
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2817
2904
|
/**
|
|
2818
2905
|
* Record a repair request whose SUBSCRIBER_PRIORITY the catalog could not
|
|
2819
2906
|
* supply (draft-ramadan-moq-fec §11.4.5): sent without the parameter, or
|
|
@@ -2849,6 +2936,7 @@ export class MulticastManager {
|
|
|
2849
2936
|
stats.repairsSkipped++;
|
|
2850
2937
|
if (reason === "rtt-unmeasured") stats.repairsSkippedRttUnmeasured++;
|
|
2851
2938
|
else if (reason === "rtt-exceeds-budget") stats.repairsSkippedRttExceedsBudget++;
|
|
2939
|
+
else if (reason === "range-no-anchor") stats.repairsSkippedRangeNoAnchor++;
|
|
2852
2940
|
else stats.repairsSkippedPresentationDelayUnavailable++;
|
|
2853
2941
|
stats.lastRepairSkip = {
|
|
2854
2942
|
reason,
|
|
@@ -2890,11 +2978,24 @@ export class MulticastManager {
|
|
|
2890
2978
|
/** Record a repair FETCH the scheduler admitted and sent. */
|
|
2891
2979
|
noteRepairFetchSent(
|
|
2892
2980
|
priority: RepairPriority,
|
|
2893
|
-
|
|
2981
|
+
sbn: number,
|
|
2894
2982
|
packetId: number,
|
|
2895
|
-
catalogTrackName
|
|
2983
|
+
catalogTrackName: string | undefined,
|
|
2984
|
+
measurement: RepairSendMeasurement,
|
|
2896
2985
|
): void {
|
|
2897
2986
|
if (priority === 0) this.#statsFor(packetId, catalogTrackName).keyframeRepairFetchesSent++;
|
|
2987
|
+
if (measurement.range) this.#statsFor(packetId, catalogTrackName).rangeRepairFetchesSent++;
|
|
2988
|
+
this.#emitRepairLifecycle({
|
|
2989
|
+
version: 2,
|
|
2990
|
+
type: "repair-sent",
|
|
2991
|
+
block: repairBlockIdentity(packetId, sbn, catalogTrackName),
|
|
2992
|
+
priority,
|
|
2993
|
+
rttMs: measurement.rttMs,
|
|
2994
|
+
budgetMs: measurement.budgetMs,
|
|
2995
|
+
delayMs: measurement.delayMs,
|
|
2996
|
+
blockAgeMs: measurement.blockAgeMs,
|
|
2997
|
+
bound: measurement.bound,
|
|
2998
|
+
});
|
|
2898
2999
|
}
|
|
2899
3000
|
|
|
2900
3001
|
/**
|
|
@@ -29,6 +29,8 @@ export interface MulticastTransportConfig {
|
|
|
29
29
|
amtDiscovery?: 'driad'
|
|
30
30
|
packetIds?: number[]
|
|
31
31
|
tracks?: { name: string; packetId: number }[]
|
|
32
|
+
/** ATSC 3.0 tuning (`catalogAtsc3NetworkSource`); when set the join is the tuner. */
|
|
33
|
+
atsc3?: { frequency: number; plpId?: number; serviceId?: number }
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export type ResolvedMulticastTransport = 'native' | 'amt'
|
|
@@ -378,6 +380,7 @@ export class MulticastTransport<TPacketContext = never> {
|
|
|
378
380
|
amtDiscovery: config.amtDiscovery,
|
|
379
381
|
packetIds: config.packetIds,
|
|
380
382
|
tracks: config.tracks,
|
|
383
|
+
atsc3: config.atsc3,
|
|
381
384
|
})
|
|
382
385
|
failure = 'provider-rejected'
|
|
383
386
|
const subscription = await gateway.subscribe(subscribeConfig)
|
package/src/no-modules.ts
CHANGED
|
@@ -10,9 +10,15 @@ export {
|
|
|
10
10
|
CmsfCatalogValidationError,
|
|
11
11
|
resolveGroupDurationMs,
|
|
12
12
|
} from './carp-catalog.js'
|
|
13
|
-
export { catalogFecInterleaveMs,
|
|
13
|
+
export { catalogFecInterleaveMs, fecBlockBudgetMs, fecBlockDeadlineMs } from '@blockcast/mmt-fec'
|
|
14
14
|
export { FEC_INACTIVE_REASONS, catalogDeclaresFec, resolveFecState } from './fec-state.js'
|
|
15
|
+
export { MmtpFecSession } from './mmtp-fec-session.js'
|
|
16
|
+
export { catalogAmtNetworkSource, catalogAtsc3NetworkSource } from './catalog-network-source.js'
|
|
15
17
|
export { MmtpToCmaf } from './mmtp-to-cmaf.js'
|
|
18
|
+
// Catalog initData contract check (mmt-01 4.5). Shaka's Closure build can
|
|
19
|
+
// reach only this classic-script surface, so it has to be exported here as
|
|
20
|
+
// well as from the barrel (BLO-49943).
|
|
21
|
+
export { isFmp4InitSegment } from './codec-utils.js'
|
|
16
22
|
export { createManifestAuthPlan } from './manifest-auth-plan.js'
|
|
17
23
|
export {
|
|
18
24
|
ManifestVerifier,
|