@blockcast/mmt-container 2.2.0-main.a88c3a0aa4f3 → 2.2.0-main.aee8d33d2cc8
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 +34 -19
- package/dist/block-policy.d.ts +55 -13
- package/dist/block-policy.d.ts.map +1 -1
- package/dist/block-policy.js +104 -32
- package/dist/block-policy.js.map +2 -2
- package/dist/browser-runtime.js +2094 -385
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.js.map +2 -2
- package/dist/catalog-fec-params.d.ts +18 -2
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +29 -1
- package/dist/catalog-fec-params.js.map +2 -2
- package/dist/catalog-network-source.js.map +2 -2
- package/dist/cmaf-block-assembler.js +92 -1
- package/dist/cmaf-block-assembler.js.map +2 -2
- package/dist/cmcd-producer.d.ts +60 -47
- package/dist/cmcd-producer.d.ts.map +1 -1
- package/dist/cmcd-producer.js +138 -109
- package/dist/cmcd-producer.js.map +2 -2
- package/dist/codec-utils.d.ts.map +1 -1
- package/dist/codec-utils.js +92 -1
- package/dist/codec-utils.js.map +2 -2
- package/dist/delivery-catalog.js +26 -16
- package/dist/delivery-catalog.js.map +2 -2
- package/dist/delta-fallback-config.js +5 -1
- package/dist/delta-fallback-config.js.map +3 -3
- package/dist/fec-manager.d.ts +114 -15
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +639 -95
- package/dist/fec-manager.js.map +2 -2
- package/dist/fec-state.js +5 -1
- package/dist/fec-state.js.map +2 -2
- package/dist/fec-worker-setup.d.ts +1 -1
- package/dist/fec-worker-setup.js +1 -1
- package/dist/fec-worker-setup.js.map +2 -2
- package/dist/held-layer-admission.js.map +2 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.d.ts +48 -13
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +97 -25
- package/dist/iso-block-locator.js.map +2 -2
- package/dist/iso-bmff-timing.d.ts +10 -1
- package/dist/iso-bmff-timing.d.ts.map +1 -1
- package/dist/iso-bmff-timing.js +36 -2
- package/dist/iso-bmff-timing.js.map +2 -2
- package/dist/media-router.js.map +1 -1
- package/dist/mfu-reassembler.js +12 -19
- package/dist/mfu-reassembler.js.map +2 -2
- package/dist/mmtp-container-parser.d.ts +106 -12
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +324 -46
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +466 -66
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +323 -46
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-fec-session.d.ts +41 -3
- package/dist/mmtp-fec-session.d.ts.map +1 -1
- package/dist/mmtp-fec-session.js +118 -13
- package/dist/mmtp-fec-session.js.map +3 -3
- package/dist/mmtp-router.d.ts +36 -8
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +716 -100
- package/dist/mmtp-router.js.map +3 -3
- package/dist/multicast-auth-catalog.js.map +2 -2
- package/dist/multicast-input.js.map +2 -2
- package/dist/multicast-manager.d.ts +28 -3
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +1451 -215
- package/dist/multicast-manager.js.map +3 -3
- package/dist/multicast-transport.js +28 -18
- package/dist/multicast-transport.js.map +2 -2
- package/dist/multicast-unwrap.js +12 -19
- package/dist/multicast-unwrap.js.map +2 -2
- package/dist/no-modules.d.ts +1 -0
- package/dist/no-modules.d.ts.map +1 -1
- package/dist/no-modules.js +463 -64
- package/dist/no-modules.js.map +4 -4
- package/dist/repair-fetch.d.ts +38 -8
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +286 -27
- package/dist/repair-fetch.js.map +3 -3
- package/dist/repair-layer-subscriptions.d.ts +82 -0
- package/dist/repair-layer-subscriptions.d.ts.map +1 -0
- package/dist/repair-layer-subscriptions.js +192 -0
- package/dist/repair-layer-subscriptions.js.map +7 -0
- package/dist/signaling.js.map +2 -2
- package/dist/timestamp-codec.js +12 -19
- package/dist/timestamp-codec.js.map +2 -2
- package/dist/track-session.d.ts +1 -1
- package/dist/track-session.d.ts.map +1 -1
- package/dist/track-session.js +1 -0
- package/dist/track-session.js.map +2 -2
- package/dist/wasm-mfu-reassembler.js.map +2 -2
- package/dist/wasm-mmtp-container-parser.js +323 -46
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +8 -5
- package/schemas/catalog.schema.json +4 -0
- package/src/block-policy.ts +216 -52
- package/src/catalog-fec-params.ts +37 -1
- package/src/cmcd-producer.ts +189 -179
- package/src/codec-utils.ts +121 -1
- package/src/fec-manager.ts +619 -37
- package/src/fec-worker-setup.ts +2 -2
- package/src/index.ts +22 -2
- package/src/iso-block-locator.ts +133 -31
- package/src/iso-bmff-timing.ts +40 -1
- package/src/mmtp-container-parser.ts +353 -32
- package/src/mmtp-fec-session.ts +115 -15
- package/src/mmtp-router.ts +618 -44
- package/src/multicast-manager.ts +139 -16
- package/src/no-modules.ts +3 -0
- package/src/repair-fetch.ts +366 -50
- package/src/repair-layer-subscriptions.ts +261 -0
- package/src/track-session.ts +4 -1
package/src/multicast-manager.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - MulticastTransport — SSM join/socket/watchdog
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { canonicalIpAddress, parseFecBlockProfile, resolveFecBindings, sameIpAddress, type FecBlockProfile, type FecSourceBinding } from "@blockcast/mmt-base";
|
|
11
|
+
import { canonicalIpAddress, parseFecBlockProfile, resolveFecBindings, sameIpAddress, type FecBlockProfile, type FecInstanceGeometry, type FecSourceBinding } from "@blockcast/mmt-base";
|
|
12
12
|
import {
|
|
13
13
|
FECManager,
|
|
14
14
|
MIN_INTERLEAVE_DEPTH_MS,
|
|
@@ -18,8 +18,10 @@ import {
|
|
|
18
18
|
type FecFallbackDecoder,
|
|
19
19
|
type MulticastSymbolDelivery,
|
|
20
20
|
type RepairVia,
|
|
21
|
+
type ExpiredIsoHole,
|
|
21
22
|
type UndelimitedIsoLoss,
|
|
22
23
|
type FecFailClosedEvent,
|
|
24
|
+
type IsoSpanFailure,
|
|
23
25
|
} from "./fec-manager.js";
|
|
24
26
|
import {
|
|
25
27
|
deriveBlockClassifierGeometry,
|
|
@@ -98,6 +100,8 @@ export interface MulticastRepairEndpoint {
|
|
|
98
100
|
mode?: string;
|
|
99
101
|
amtRelay?: string;
|
|
100
102
|
amtRelayPort?: number;
|
|
103
|
+
/** The media join's `'driad'` discovery (no relay pinned), carried so the repair group rides the same relay. */
|
|
104
|
+
amtDiscovery?: 'driad';
|
|
101
105
|
/** The repair packet IDs this group carries. */
|
|
102
106
|
packetIds: number[];
|
|
103
107
|
/** Each repair packet ID bound to the media packet ID it repairs. */
|
|
@@ -106,6 +110,13 @@ export interface MulticastRepairEndpoint {
|
|
|
106
110
|
tracks: MmtpIngressContext["tracks"];
|
|
107
111
|
/** The protected flow (`MmtpRouter.registerProvenanceFlow`) this group's datagrams belong to. */
|
|
108
112
|
flow?: string;
|
|
113
|
+
/**
|
|
114
|
+
* The group's own protected flow, which joinRepairEndpoints registers and
|
|
115
|
+
* releases itself, as join() does for the media flow. Its (S, G, port) must
|
|
116
|
+
* be the endpoint's. Never beside `flow`, which names a flow the caller
|
|
117
|
+
* registered.
|
|
118
|
+
*/
|
|
119
|
+
provenance?: MulticastProvenanceJoin;
|
|
109
120
|
}
|
|
110
121
|
|
|
111
122
|
/**
|
|
@@ -405,6 +416,14 @@ export type RepairLifecycleEvent =
|
|
|
405
416
|
readonly block: RepairBlockIdentity;
|
|
406
417
|
readonly blockClass: BlockClass;
|
|
407
418
|
readonly symbols: RepairSymbolCounts;
|
|
419
|
+
/**
|
|
420
|
+
* Set when what failed is an iso-ssbg1-v1 repair-less span starting at
|
|
421
|
+
* `block.sbn`: `length` SS_IDs between two stated blocks, `sources` of
|
|
422
|
+
* them received. No repair stated the blocks inside it, so the receiver
|
|
423
|
+
* cannot tell which of them lost a source; it is not the failure of the
|
|
424
|
+
* block at `block.sbn` alone.
|
|
425
|
+
*/
|
|
426
|
+
readonly span?: IsoSpanFailure;
|
|
408
427
|
}
|
|
409
428
|
| {
|
|
410
429
|
readonly version: 2;
|
|
@@ -789,6 +808,19 @@ function isSymbolCounts(value: unknown): boolean {
|
|
|
789
808
|
);
|
|
790
809
|
}
|
|
791
810
|
|
|
811
|
+
/** A failed repair-less span: `sources` of its `length` SS_IDs arrived, never all. */
|
|
812
|
+
function isSpanFailure(value: unknown): boolean {
|
|
813
|
+
if (!isRecord(value) || !hasExactKeys(value, ["length", "sources"])) return false;
|
|
814
|
+
const length = value["length"];
|
|
815
|
+
const sources = value["sources"];
|
|
816
|
+
return (
|
|
817
|
+
Number.isSafeInteger(length) &&
|
|
818
|
+
(length as number) > 0 &&
|
|
819
|
+
isNonNegativeSafeInteger(sources) &&
|
|
820
|
+
(sources as number) < (length as number)
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
|
|
792
824
|
function isNullableNonNegative(value: unknown): boolean {
|
|
793
825
|
return value === null || (typeof value === "number" && Number.isFinite(value) && value >= 0);
|
|
794
826
|
}
|
|
@@ -831,10 +863,16 @@ export function isRepairLifecycleEvent(
|
|
|
831
863
|
);
|
|
832
864
|
case "failed":
|
|
833
865
|
return (
|
|
834
|
-
hasExactKeys(
|
|
866
|
+
hasExactKeys(
|
|
867
|
+
value,
|
|
868
|
+
"span" in value
|
|
869
|
+
? ["version", "type", "block", "blockClass", "symbols", "span"]
|
|
870
|
+
: ["version", "type", "block", "blockClass", "symbols"],
|
|
871
|
+
) &&
|
|
835
872
|
isRepairBlockIdentity(block) &&
|
|
836
873
|
BLOCK_CLASSES.has(value["blockClass"]) &&
|
|
837
|
-
isSymbolCounts(value["symbols"])
|
|
874
|
+
isSymbolCounts(value["symbols"]) &&
|
|
875
|
+
(!("span" in value) || isSpanFailure(value["span"]))
|
|
838
876
|
);
|
|
839
877
|
case "repair-preempted":
|
|
840
878
|
case "repair-deferred":
|
|
@@ -1275,6 +1313,10 @@ interface OverlayBinding {
|
|
|
1275
1313
|
k: number;
|
|
1276
1314
|
symbolSize: number;
|
|
1277
1315
|
blockProfile: FecBlockProfile;
|
|
1316
|
+
/** The overlay instance's catalog geometry, read for its span and
|
|
1317
|
+
* tolerance (FECManager.keyframeOverlayTiming). No part of its decoder: a
|
|
1318
|
+
* reconfigure that changes it keeps an install. */
|
|
1319
|
+
geometry: FecInstanceGeometry;
|
|
1278
1320
|
}
|
|
1279
1321
|
|
|
1280
1322
|
type RepairOwnerEntry = MulticastRepairEndpoint["repairOwners"][number] & {
|
|
@@ -1294,6 +1336,8 @@ export class MulticastManager {
|
|
|
1294
1336
|
/** Live joinRepairEndpoints() releases → the repair owners they registered,
|
|
1295
1337
|
* re-applied after configureMultiTrack() clears catalog-derived owners. */
|
|
1296
1338
|
readonly #repairReleases = new Map<() => void, RepairOwnerEntry[]>();
|
|
1339
|
+
/** Protected repair flows owned by each live repair-endpoint release. */
|
|
1340
|
+
readonly #repairProvenanceFlows = new Map<() => void, string[]>();
|
|
1297
1341
|
/** Each source's catalog keyframe overlay, from its `ok` binding. */
|
|
1298
1342
|
readonly #overlayBindings = new Map<number, OverlayBinding>();
|
|
1299
1343
|
/** Installed overlay decoders (`setKeyframeOverlayDecoder`), by source. */
|
|
@@ -1364,7 +1408,7 @@ export class MulticastManager {
|
|
|
1364
1408
|
onPublisherRestart: (packetId, catalogTrackName) => {
|
|
1365
1409
|
this.#resetStreamOutsideRouter(packetId, catalogTrackName);
|
|
1366
1410
|
},
|
|
1367
|
-
onBlockFailed: (sbn, packetId, catalogTrackName, blockClass) => {
|
|
1411
|
+
onBlockFailed: (sbn, packetId, catalogTrackName, blockClass, span) => {
|
|
1368
1412
|
const pathCount = this.#fec.blockPathCount(
|
|
1369
1413
|
sbn,
|
|
1370
1414
|
packetId,
|
|
@@ -1383,6 +1427,7 @@ export class MulticastManager {
|
|
|
1383
1427
|
multicast: pathCount?.multicastSymbols ?? 0,
|
|
1384
1428
|
moq: pathCount?.moqSymbols ?? 0,
|
|
1385
1429
|
},
|
|
1430
|
+
...(span === undefined ? {} : { span }),
|
|
1386
1431
|
});
|
|
1387
1432
|
},
|
|
1388
1433
|
onFrameGap: (decision) => {
|
|
@@ -1489,6 +1534,15 @@ export class MulticastManager {
|
|
|
1489
1534
|
this.#fec.onBlockVanished = (_sbn, packetId, catalogTrackName) => {
|
|
1490
1535
|
this.#statsFor(packetId, catalogTrackName).vanishedBlocks++;
|
|
1491
1536
|
};
|
|
1537
|
+
// An installed keyframe overlay may still rebuild a RAP packet a base
|
|
1538
|
+
// block lost; a block only a late source can complete waits for it.
|
|
1539
|
+
this.#fec.keyframeOverlayTiming = (packetId, catalogTrackName) => {
|
|
1540
|
+
const binding = this.#overlayInstalls.has(packetId) ? this.#overlayBindings.get(packetId) : undefined;
|
|
1541
|
+
if (binding === undefined) return undefined;
|
|
1542
|
+
return catalogTrackName === undefined || catalogTrackName === binding.sourceCatalogTrackName
|
|
1543
|
+
? binding.geometry
|
|
1544
|
+
: undefined;
|
|
1545
|
+
};
|
|
1492
1546
|
this.#fec.onDecoderUnavailable = (event) => {
|
|
1493
1547
|
this.#emitRepairLifecycle({
|
|
1494
1548
|
version: 2,
|
|
@@ -2177,6 +2231,9 @@ export class MulticastManager {
|
|
|
2177
2231
|
this.#transport.onFailback((reason) => {
|
|
2178
2232
|
const joined = this.#provenanceJoin;
|
|
2179
2233
|
if (joined !== null) this.#router.unprotectProvenanceFlow(joined.flow);
|
|
2234
|
+
for (const flows of this.#repairProvenanceFlows.values()) {
|
|
2235
|
+
for (const flow of flows) this.#router.unprotectProvenanceFlow(flow);
|
|
2236
|
+
}
|
|
2180
2237
|
this.#onFailback?.(reason);
|
|
2181
2238
|
});
|
|
2182
2239
|
}
|
|
@@ -2219,6 +2276,12 @@ export class MulticastManager {
|
|
|
2219
2276
|
"[MulticastManager] join: provenance flow (S, G, port) must match sourceAddress ?? senderAddress, groupAddress and port",
|
|
2220
2277
|
);
|
|
2221
2278
|
}
|
|
2279
|
+
if (provenanceFlow !== undefined) {
|
|
2280
|
+
const flow = multicastProvenanceFlowKey(provenanceFlow);
|
|
2281
|
+
if ([...this.#repairProvenanceFlows.values()].some((flows) => flows.includes(flow))) {
|
|
2282
|
+
throw new TypeError(`[MulticastManager] join: provenance flow already registered by a repair endpoint: ${flow}`);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2222
2285
|
// A join replaces the admission a staged switch was built on. The new
|
|
2223
2286
|
// join's config decides what is admitted, so nothing is restored or
|
|
2224
2287
|
// retired here: the switch just ends.
|
|
@@ -2243,8 +2306,8 @@ export class MulticastManager {
|
|
|
2243
2306
|
: selectedPacketIds === null
|
|
2244
2307
|
? undefined
|
|
2245
2308
|
: [...selectedPacketIds].map((packetId) => ({ name: "", packetId }));
|
|
2246
|
-
this.#releaseProvenanceJoin();
|
|
2247
2309
|
const provenance = config.provenance;
|
|
2310
|
+
this.#releaseProvenanceJoin();
|
|
2248
2311
|
const protectedTracks = ingressTracks ?? provenance?.flow.tracks;
|
|
2249
2312
|
const ingress: MmtpIngressContext | undefined = protectedTracks === undefined
|
|
2250
2313
|
? undefined
|
|
@@ -2313,8 +2376,14 @@ export class MulticastManager {
|
|
|
2313
2376
|
provenance: MulticastProvenanceJoin,
|
|
2314
2377
|
ingress: MmtpIngressContext & { flow: string },
|
|
2315
2378
|
): void {
|
|
2379
|
+
this.#router.registerProvenanceFlow(ingress, this.#provenanceReceiver(provenance));
|
|
2380
|
+
this.#hookFailback();
|
|
2381
|
+
this.#provenanceJoin = { flow: ingress.flow };
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
#provenanceReceiver(provenance: MulticastProvenanceJoin): BcProvenanceV2Receiver {
|
|
2316
2385
|
const { flow, auth } = provenance;
|
|
2317
|
-
|
|
2386
|
+
return new BcProvenanceV2Receiver({
|
|
2318
2387
|
...provenance.receiver,
|
|
2319
2388
|
// The caller's ctx when it passes one, else the catalog's: an explicit
|
|
2320
2389
|
// `catalogCtx: undefined` must not switch off the 7.2.4 ctx check.
|
|
@@ -2331,9 +2400,6 @@ export class MulticastManager {
|
|
|
2331
2400
|
maxAuthDelayMs: flow.maxAuthDelayMs,
|
|
2332
2401
|
manifestTimerMs: flow.manifestTimerMs,
|
|
2333
2402
|
});
|
|
2334
|
-
this.#router.registerProvenanceFlow(ingress, receiver);
|
|
2335
|
-
this.#hookFailback();
|
|
2336
|
-
this.#provenanceJoin = { flow: ingress.flow };
|
|
2337
2403
|
}
|
|
2338
2404
|
|
|
2339
2405
|
/** Un-protect: drop the flow's hold queues (no expiry counted). */
|
|
@@ -2366,12 +2432,33 @@ export class MulticastManager {
|
|
|
2366
2432
|
* callback delivers must come from a subscription opened on
|
|
2367
2433
|
* `options.gateway`. A callback that also merges another source (a MoQ or
|
|
2368
2434
|
* WebSocket repair feed) must not name a native provider here.
|
|
2435
|
+
*
|
|
2436
|
+
* An endpoint's `provenance` makes its group a protected flow of its own
|
|
2437
|
+
* (multicast-02 7.2.7), registered here and released with the group; its
|
|
2438
|
+
* records ride in band on the group's port. On the user-agent path a
|
|
2439
|
+
* flow-less repair group of a protected track is set aside, never read, so
|
|
2440
|
+
* a player joining a protected catalog's repair groups passes it.
|
|
2369
2441
|
*/
|
|
2370
2442
|
joinRepairEndpoints(
|
|
2371
2443
|
endpoints: readonly MulticastRepairEndpoint[],
|
|
2372
2444
|
provider?: WindowMulticastGateway | MulticastRepairSubscribe,
|
|
2373
2445
|
options?: { gateway?: WindowMulticastGateway },
|
|
2374
2446
|
): () => void {
|
|
2447
|
+
for (const { provenance, flow, source, group, port } of endpoints) {
|
|
2448
|
+
if (provenance === undefined) continue;
|
|
2449
|
+
if (flow !== undefined) {
|
|
2450
|
+
throw new TypeError("[MulticastManager] joinRepairEndpoints: an endpoint names provenance or flow, never both");
|
|
2451
|
+
}
|
|
2452
|
+
if (
|
|
2453
|
+
!sameIpAddress(source, provenance.flow.source) ||
|
|
2454
|
+
!sameIpAddress(group, provenance.flow.groupAddress) ||
|
|
2455
|
+
port !== provenance.flow.port
|
|
2456
|
+
) {
|
|
2457
|
+
throw new RangeError(
|
|
2458
|
+
"[MulticastManager] joinRepairEndpoints: provenance flow (S, G, port) must match the endpoint's source, group and port",
|
|
2459
|
+
);
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2375
2462
|
const releases: Array<() => void> = [];
|
|
2376
2463
|
let released = false;
|
|
2377
2464
|
const safely = (each: () => void) => {
|
|
@@ -2381,6 +2468,21 @@ export class MulticastManager {
|
|
|
2381
2468
|
console.warn("[MulticastManager] repair group release failed", error);
|
|
2382
2469
|
}
|
|
2383
2470
|
};
|
|
2471
|
+
// Caller-owned flows reserve their keys even though this method does not
|
|
2472
|
+
// own their release; a protected endpoint must not replace one silently.
|
|
2473
|
+
const usedFlows = new Set(endpoints.flatMap(({ flow }) => flow === undefined ? [] : [flow]));
|
|
2474
|
+
const preparedProvenance = endpoints.map((endpoint) => {
|
|
2475
|
+
if (endpoint.provenance === undefined) return undefined;
|
|
2476
|
+
const flow = multicastProvenanceFlowKey(endpoint.provenance.flow);
|
|
2477
|
+
if (usedFlows.has(flow) || this.#provenanceJoin?.flow === flow ||
|
|
2478
|
+
[...this.#repairProvenanceFlows.values()].some((flows) => flows.includes(flow))) {
|
|
2479
|
+
throw new TypeError(`[MulticastManager] joinRepairEndpoints: provenance flow already registered: ${flow}`);
|
|
2480
|
+
}
|
|
2481
|
+
usedFlows.add(flow);
|
|
2482
|
+
// Construct every receiver before registering or joining any endpoint.
|
|
2483
|
+
return { flow, receiver: this.#provenanceReceiver(endpoint.provenance) };
|
|
2484
|
+
});
|
|
2485
|
+
const provenanceFlows: string[] = [];
|
|
2384
2486
|
// An overlay leg's source and repair track names come from the
|
|
2385
2487
|
// endpoint's ingress tracks.
|
|
2386
2488
|
const repairOwners: RepairOwnerEntry[] = endpoints.flatMap((endpoint) =>
|
|
@@ -2390,11 +2492,19 @@ export class MulticastManager {
|
|
|
2390
2492
|
repairTrackName: endpoint.tracks.find((t) => t.packetId === owner.packetId)?.name,
|
|
2391
2493
|
}));
|
|
2392
2494
|
this.#applyRepairOwners(repairOwners);
|
|
2393
|
-
for (const endpoint of endpoints) {
|
|
2495
|
+
for (const [index, endpoint] of endpoints.entries()) {
|
|
2496
|
+
const flow = endpoint.provenance === undefined ? endpoint.flow : multicastProvenanceFlowKey(endpoint.provenance.flow);
|
|
2394
2497
|
const ingress: MmtpIngressContext = {
|
|
2395
2498
|
tracks: Object.freeze(endpoint.tracks.map(({ name, packetId }) => Object.freeze({ name, packetId }))),
|
|
2396
|
-
...(
|
|
2499
|
+
...(flow === undefined ? {} : { flow }),
|
|
2397
2500
|
};
|
|
2501
|
+
if (endpoint.provenance !== undefined) {
|
|
2502
|
+
const prepared = preparedProvenance[index];
|
|
2503
|
+
if (prepared === undefined) throw new Error("[MulticastManager] repair provenance preparation missing");
|
|
2504
|
+
this.#router.registerProvenanceFlow(ingress as MmtpIngressContext & { flow: string }, prepared.receiver);
|
|
2505
|
+
provenanceFlows.push(prepared.flow);
|
|
2506
|
+
releases.push(() => this.#router.releaseProvenanceFlow(flow!));
|
|
2507
|
+
}
|
|
2398
2508
|
let sender: string | undefined;
|
|
2399
2509
|
const feed = (packet: Uint8Array, sourceAddress: string | undefined, ingressToFeed: MmtpIngressContext) => {
|
|
2400
2510
|
if (released) return;
|
|
@@ -2427,10 +2537,11 @@ export class MulticastManager {
|
|
|
2427
2537
|
mode: endpoint.mode as MulticastEndpointConfig["mode"],
|
|
2428
2538
|
amtRelay: endpoint.amtRelay,
|
|
2429
2539
|
amtRelayPort: endpoint.amtRelayPort ?? (endpoint.amtRelay?.trim() ? DEFAULT_AMT_RELAY_PORT : undefined),
|
|
2540
|
+
amtDiscovery: endpoint.amtDiscovery,
|
|
2430
2541
|
packetIds: endpoint.packetIds,
|
|
2431
2542
|
tracks: endpoint.tracks.map(({ name, packetId }) => ({ name, packetId })),
|
|
2432
2543
|
// A protected repair group's records ride in band on its port (7.2.3).
|
|
2433
|
-
...(
|
|
2544
|
+
...(flow === undefined ? {} : { protected: true }),
|
|
2434
2545
|
}, ingress).then((joined) => {
|
|
2435
2546
|
if (!joined && !released) fail(transport.lastJoinOutcome);
|
|
2436
2547
|
});
|
|
@@ -2439,9 +2550,12 @@ export class MulticastManager {
|
|
|
2439
2550
|
if (released) return;
|
|
2440
2551
|
released = true;
|
|
2441
2552
|
this.#repairReleases.delete(release);
|
|
2553
|
+
this.#repairProvenanceFlows.delete(release);
|
|
2442
2554
|
for (const each of releases.splice(0)) safely(each);
|
|
2443
2555
|
};
|
|
2444
2556
|
this.#repairReleases.set(release, repairOwners);
|
|
2557
|
+
this.#repairProvenanceFlows.set(release, provenanceFlows);
|
|
2558
|
+
if (provenanceFlows.length) this.#hookFailback();
|
|
2445
2559
|
return release;
|
|
2446
2560
|
}
|
|
2447
2561
|
|
|
@@ -3081,6 +3195,7 @@ export class MulticastManager {
|
|
|
3081
3195
|
geometry.blockProfile,
|
|
3082
3196
|
`tracks[${JSON.stringify(track.name)}].fec keyframe overlay blockProfile`,
|
|
3083
3197
|
),
|
|
3198
|
+
geometry,
|
|
3084
3199
|
});
|
|
3085
3200
|
}
|
|
3086
3201
|
}
|
|
@@ -3126,7 +3241,7 @@ export class MulticastManager {
|
|
|
3126
3241
|
const before = this.#overlayBindings.get(sourcePacketId);
|
|
3127
3242
|
const after = overlayBindings.get(sourcePacketId);
|
|
3128
3243
|
const same = before !== undefined && after !== undefined &&
|
|
3129
|
-
(Object.keys(after) as Array<keyof OverlayBinding>).every((key) => after[key] === before[key]);
|
|
3244
|
+
(Object.keys(after) as Array<keyof OverlayBinding>).every((key) => key === "geometry" || after[key] === before[key]);
|
|
3130
3245
|
if (!same) install.dispose();
|
|
3131
3246
|
else if (this.#router.hasKeyframeOverlay(after.repairPacketId)) this.#router.resetKeyframeOverlays(sourcePacketId);
|
|
3132
3247
|
// A retired packet ID took the router's instance with it.
|
|
@@ -3190,10 +3305,15 @@ export class MulticastManager {
|
|
|
3190
3305
|
* Register the range repair scheduler (draft-ramadan-moq-fec §7.5): from now
|
|
3191
3306
|
* on an iso-ssbg1-v1 gap missing a source and every repair is kept as a
|
|
3192
3307
|
* pending hole and reported here, and `closeIsoHoles` must be called for it
|
|
3193
|
-
* once its range FETCH ends (or none is sent).
|
|
3308
|
+
* once its range FETCH ends (or none is sent). `onExpired` is told of a
|
|
3309
|
+
* pending hole the stream runs past the locator's horizon: returning true,
|
|
3310
|
+
* the caller closes it (`closeIsoHoles`); otherwise it is discarded.
|
|
3194
3311
|
*/
|
|
3195
|
-
onUndelimitedLoss(
|
|
3196
|
-
|
|
3312
|
+
onUndelimitedLoss(
|
|
3313
|
+
cb: (loss: UndelimitedIsoLoss) => void,
|
|
3314
|
+
onExpired?: (hole: ExpiredIsoHole) => boolean,
|
|
3315
|
+
): void {
|
|
3316
|
+
this.#fec.setUndelimitedLossHandler(cb, onExpired ?? null);
|
|
3197
3317
|
}
|
|
3198
3318
|
|
|
3199
3319
|
/**
|
|
@@ -3512,6 +3632,9 @@ export class MulticastManager {
|
|
|
3512
3632
|
...("symbols" in event
|
|
3513
3633
|
? { symbols: Object.freeze({ ...event.symbols }) }
|
|
3514
3634
|
: {}),
|
|
3635
|
+
...("span" in event && event.span !== undefined
|
|
3636
|
+
? { span: Object.freeze({ ...event.span }) }
|
|
3637
|
+
: {}),
|
|
3515
3638
|
},
|
|
3516
3639
|
) as RepairLifecycleEvent);
|
|
3517
3640
|
// Serialize before invoking observers so a re-entrant observer cannot log
|
package/src/no-modules.ts
CHANGED
|
@@ -12,6 +12,9 @@ export {
|
|
|
12
12
|
} from './carp-catalog.js'
|
|
13
13
|
export { catalogFecInterleaveMs, fecBlockBudgetMs, fecBlockDeadlineMs } from '@blockcast/mmt-fec'
|
|
14
14
|
export { FEC_INACTIVE_REASONS, catalogDeclaresFec, resolveFecState } from './fec-state.js'
|
|
15
|
+
// The per-instance report a receiver acts on, for classic-script pages that
|
|
16
|
+
// must publish it (BLO-55242).
|
|
17
|
+
export { runtimeFecCatalogReport, validateFecCatalog } from './catalog-fec-params.js'
|
|
15
18
|
export { MmtpFecSession } from './mmtp-fec-session.js'
|
|
16
19
|
export { catalogAmtNetworkSource, catalogAtsc3NetworkSource } from './catalog-network-source.js'
|
|
17
20
|
export { MmtpToCmaf } from './mmtp-to-cmaf.js'
|