@blockcast/mmt-container 2.2.0-main.c4fa878f4ff4 → 2.2.0-main.caa271d80062
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 +88 -16
- package/dist/block-policy.d.ts.map +1 -1
- package/dist/block-policy.js +164 -56
- package/dist/block-policy.js.map +3 -3
- package/dist/browser-runtime.js +2064 -388
- package/dist/browser-runtime.js.map +3 -3
- 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 +163 -20
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +863 -110
- package/dist/fec-manager.js.map +3 -3
- 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 +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.d.ts +64 -13
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +125 -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.map +2 -2
- package/dist/mmtp-container-parser.d.ts +109 -12
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +312 -27
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +333 -32
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +311 -27
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-fec-session.js.map +2 -2
- package/dist/mmtp-router.d.ts +51 -12
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +723 -83
- 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 +31 -3
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +1698 -231
- 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.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 +333 -31
- 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 +6 -2
- package/dist/repair-layer-subscriptions.d.ts.map +1 -1
- package/dist/repair-layer-subscriptions.js +6 -3
- package/dist/repair-layer-subscriptions.js.map +2 -2
- package/dist/signaling.js.map +2 -2
- 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 +311 -27
- 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 +324 -83
- 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 +818 -42
- package/src/fec-worker-setup.ts +2 -2
- package/src/index.ts +11 -2
- package/src/iso-block-locator.ts +167 -31
- package/src/iso-bmff-timing.ts +40 -1
- package/src/mmtp-container-parser.ts +355 -32
- package/src/mmtp-router.ts +665 -50
- package/src/multicast-manager.ts +145 -16
- package/src/no-modules.ts +3 -0
- package/src/repair-fetch.ts +366 -50
- package/src/repair-layer-subscriptions.ts +13 -5
- 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,
|
|
@@ -108,6 +110,13 @@ export interface MulticastRepairEndpoint {
|
|
|
108
110
|
tracks: MmtpIngressContext["tracks"];
|
|
109
111
|
/** The protected flow (`MmtpRouter.registerProvenanceFlow`) this group's datagrams belong to. */
|
|
110
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;
|
|
111
120
|
}
|
|
112
121
|
|
|
113
122
|
/**
|
|
@@ -407,6 +416,14 @@ export type RepairLifecycleEvent =
|
|
|
407
416
|
readonly block: RepairBlockIdentity;
|
|
408
417
|
readonly blockClass: BlockClass;
|
|
409
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;
|
|
410
427
|
}
|
|
411
428
|
| {
|
|
412
429
|
readonly version: 2;
|
|
@@ -563,6 +580,11 @@ export interface BlockPolicyStats {
|
|
|
563
580
|
stalls: number;
|
|
564
581
|
concealedBlocks: number;
|
|
565
582
|
concealedGaps: number;
|
|
583
|
+
/**
|
|
584
|
+
* Gaps the FEC deadline of a run no repair delimited released (counted in
|
|
585
|
+
* `concealedGaps` or `stalls` too; their decisions name no block).
|
|
586
|
+
*/
|
|
587
|
+
undelimitedRunGaps: number;
|
|
566
588
|
concealedFrames: number;
|
|
567
589
|
concealedAudioMs: number;
|
|
568
590
|
vanishedBlocks: number;
|
|
@@ -609,6 +631,7 @@ function newBlockPolicyStats(
|
|
|
609
631
|
stalls: 0,
|
|
610
632
|
concealedBlocks: 0,
|
|
611
633
|
concealedGaps: 0,
|
|
634
|
+
undelimitedRunGaps: 0,
|
|
612
635
|
concealedFrames: 0,
|
|
613
636
|
concealedAudioMs: 0,
|
|
614
637
|
vanishedBlocks: 0,
|
|
@@ -791,6 +814,19 @@ function isSymbolCounts(value: unknown): boolean {
|
|
|
791
814
|
);
|
|
792
815
|
}
|
|
793
816
|
|
|
817
|
+
/** A failed repair-less span: `sources` of its `length` SS_IDs arrived, never all. */
|
|
818
|
+
function isSpanFailure(value: unknown): boolean {
|
|
819
|
+
if (!isRecord(value) || !hasExactKeys(value, ["length", "sources"])) return false;
|
|
820
|
+
const length = value["length"];
|
|
821
|
+
const sources = value["sources"];
|
|
822
|
+
return (
|
|
823
|
+
Number.isSafeInteger(length) &&
|
|
824
|
+
(length as number) > 0 &&
|
|
825
|
+
isNonNegativeSafeInteger(sources) &&
|
|
826
|
+
(sources as number) < (length as number)
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
|
|
794
830
|
function isNullableNonNegative(value: unknown): boolean {
|
|
795
831
|
return value === null || (typeof value === "number" && Number.isFinite(value) && value >= 0);
|
|
796
832
|
}
|
|
@@ -833,10 +869,16 @@ export function isRepairLifecycleEvent(
|
|
|
833
869
|
);
|
|
834
870
|
case "failed":
|
|
835
871
|
return (
|
|
836
|
-
hasExactKeys(
|
|
872
|
+
hasExactKeys(
|
|
873
|
+
value,
|
|
874
|
+
"span" in value
|
|
875
|
+
? ["version", "type", "block", "blockClass", "symbols", "span"]
|
|
876
|
+
: ["version", "type", "block", "blockClass", "symbols"],
|
|
877
|
+
) &&
|
|
837
878
|
isRepairBlockIdentity(block) &&
|
|
838
879
|
BLOCK_CLASSES.has(value["blockClass"]) &&
|
|
839
|
-
isSymbolCounts(value["symbols"])
|
|
880
|
+
isSymbolCounts(value["symbols"]) &&
|
|
881
|
+
(!("span" in value) || isSpanFailure(value["span"]))
|
|
840
882
|
);
|
|
841
883
|
case "repair-preempted":
|
|
842
884
|
case "repair-deferred":
|
|
@@ -1277,6 +1319,10 @@ interface OverlayBinding {
|
|
|
1277
1319
|
k: number;
|
|
1278
1320
|
symbolSize: number;
|
|
1279
1321
|
blockProfile: FecBlockProfile;
|
|
1322
|
+
/** The overlay instance's catalog geometry, read for its span and
|
|
1323
|
+
* tolerance (FECManager.keyframeOverlayTiming). No part of its decoder: a
|
|
1324
|
+
* reconfigure that changes it keeps an install. */
|
|
1325
|
+
geometry: FecInstanceGeometry;
|
|
1280
1326
|
}
|
|
1281
1327
|
|
|
1282
1328
|
type RepairOwnerEntry = MulticastRepairEndpoint["repairOwners"][number] & {
|
|
@@ -1296,6 +1342,8 @@ export class MulticastManager {
|
|
|
1296
1342
|
/** Live joinRepairEndpoints() releases → the repair owners they registered,
|
|
1297
1343
|
* re-applied after configureMultiTrack() clears catalog-derived owners. */
|
|
1298
1344
|
readonly #repairReleases = new Map<() => void, RepairOwnerEntry[]>();
|
|
1345
|
+
/** Protected repair flows owned by each live repair-endpoint release. */
|
|
1346
|
+
readonly #repairProvenanceFlows = new Map<() => void, string[]>();
|
|
1299
1347
|
/** Each source's catalog keyframe overlay, from its `ok` binding. */
|
|
1300
1348
|
readonly #overlayBindings = new Map<number, OverlayBinding>();
|
|
1301
1349
|
/** Installed overlay decoders (`setKeyframeOverlayDecoder`), by source. */
|
|
@@ -1366,7 +1414,7 @@ export class MulticastManager {
|
|
|
1366
1414
|
onPublisherRestart: (packetId, catalogTrackName) => {
|
|
1367
1415
|
this.#resetStreamOutsideRouter(packetId, catalogTrackName);
|
|
1368
1416
|
},
|
|
1369
|
-
onBlockFailed: (sbn, packetId, catalogTrackName, blockClass) => {
|
|
1417
|
+
onBlockFailed: (sbn, packetId, catalogTrackName, blockClass, span) => {
|
|
1370
1418
|
const pathCount = this.#fec.blockPathCount(
|
|
1371
1419
|
sbn,
|
|
1372
1420
|
packetId,
|
|
@@ -1385,6 +1433,7 @@ export class MulticastManager {
|
|
|
1385
1433
|
multicast: pathCount?.multicastSymbols ?? 0,
|
|
1386
1434
|
moq: pathCount?.moqSymbols ?? 0,
|
|
1387
1435
|
},
|
|
1436
|
+
...(span === undefined ? {} : { span }),
|
|
1388
1437
|
});
|
|
1389
1438
|
},
|
|
1390
1439
|
onFrameGap: (decision) => {
|
|
@@ -1488,9 +1537,21 @@ export class MulticastManager {
|
|
|
1488
1537
|
reason,
|
|
1489
1538
|
});
|
|
1490
1539
|
};
|
|
1540
|
+
this.#fec.onUndelimitedRunGap = (packetId, catalogTrackName) => {
|
|
1541
|
+
this.#statsFor(packetId, catalogTrackName).undelimitedRunGaps++;
|
|
1542
|
+
};
|
|
1491
1543
|
this.#fec.onBlockVanished = (_sbn, packetId, catalogTrackName) => {
|
|
1492
1544
|
this.#statsFor(packetId, catalogTrackName).vanishedBlocks++;
|
|
1493
1545
|
};
|
|
1546
|
+
// An installed keyframe overlay may still rebuild a RAP packet a base
|
|
1547
|
+
// block lost; a block only a late source can complete waits for it.
|
|
1548
|
+
this.#fec.keyframeOverlayTiming = (packetId, catalogTrackName) => {
|
|
1549
|
+
const binding = this.#overlayInstalls.has(packetId) ? this.#overlayBindings.get(packetId) : undefined;
|
|
1550
|
+
if (binding === undefined) return undefined;
|
|
1551
|
+
return catalogTrackName === undefined || catalogTrackName === binding.sourceCatalogTrackName
|
|
1552
|
+
? binding.geometry
|
|
1553
|
+
: undefined;
|
|
1554
|
+
};
|
|
1494
1555
|
this.#fec.onDecoderUnavailable = (event) => {
|
|
1495
1556
|
this.#emitRepairLifecycle({
|
|
1496
1557
|
version: 2,
|
|
@@ -2179,6 +2240,9 @@ export class MulticastManager {
|
|
|
2179
2240
|
this.#transport.onFailback((reason) => {
|
|
2180
2241
|
const joined = this.#provenanceJoin;
|
|
2181
2242
|
if (joined !== null) this.#router.unprotectProvenanceFlow(joined.flow);
|
|
2243
|
+
for (const flows of this.#repairProvenanceFlows.values()) {
|
|
2244
|
+
for (const flow of flows) this.#router.unprotectProvenanceFlow(flow);
|
|
2245
|
+
}
|
|
2182
2246
|
this.#onFailback?.(reason);
|
|
2183
2247
|
});
|
|
2184
2248
|
}
|
|
@@ -2221,6 +2285,12 @@ export class MulticastManager {
|
|
|
2221
2285
|
"[MulticastManager] join: provenance flow (S, G, port) must match sourceAddress ?? senderAddress, groupAddress and port",
|
|
2222
2286
|
);
|
|
2223
2287
|
}
|
|
2288
|
+
if (provenanceFlow !== undefined) {
|
|
2289
|
+
const flow = multicastProvenanceFlowKey(provenanceFlow);
|
|
2290
|
+
if ([...this.#repairProvenanceFlows.values()].some((flows) => flows.includes(flow))) {
|
|
2291
|
+
throw new TypeError(`[MulticastManager] join: provenance flow already registered by a repair endpoint: ${flow}`);
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2224
2294
|
// A join replaces the admission a staged switch was built on. The new
|
|
2225
2295
|
// join's config decides what is admitted, so nothing is restored or
|
|
2226
2296
|
// retired here: the switch just ends.
|
|
@@ -2245,8 +2315,8 @@ export class MulticastManager {
|
|
|
2245
2315
|
: selectedPacketIds === null
|
|
2246
2316
|
? undefined
|
|
2247
2317
|
: [...selectedPacketIds].map((packetId) => ({ name: "", packetId }));
|
|
2248
|
-
this.#releaseProvenanceJoin();
|
|
2249
2318
|
const provenance = config.provenance;
|
|
2319
|
+
this.#releaseProvenanceJoin();
|
|
2250
2320
|
const protectedTracks = ingressTracks ?? provenance?.flow.tracks;
|
|
2251
2321
|
const ingress: MmtpIngressContext | undefined = protectedTracks === undefined
|
|
2252
2322
|
? undefined
|
|
@@ -2315,8 +2385,14 @@ export class MulticastManager {
|
|
|
2315
2385
|
provenance: MulticastProvenanceJoin,
|
|
2316
2386
|
ingress: MmtpIngressContext & { flow: string },
|
|
2317
2387
|
): void {
|
|
2388
|
+
this.#router.registerProvenanceFlow(ingress, this.#provenanceReceiver(provenance));
|
|
2389
|
+
this.#hookFailback();
|
|
2390
|
+
this.#provenanceJoin = { flow: ingress.flow };
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
#provenanceReceiver(provenance: MulticastProvenanceJoin): BcProvenanceV2Receiver {
|
|
2318
2394
|
const { flow, auth } = provenance;
|
|
2319
|
-
|
|
2395
|
+
return new BcProvenanceV2Receiver({
|
|
2320
2396
|
...provenance.receiver,
|
|
2321
2397
|
// The caller's ctx when it passes one, else the catalog's: an explicit
|
|
2322
2398
|
// `catalogCtx: undefined` must not switch off the 7.2.4 ctx check.
|
|
@@ -2333,9 +2409,6 @@ export class MulticastManager {
|
|
|
2333
2409
|
maxAuthDelayMs: flow.maxAuthDelayMs,
|
|
2334
2410
|
manifestTimerMs: flow.manifestTimerMs,
|
|
2335
2411
|
});
|
|
2336
|
-
this.#router.registerProvenanceFlow(ingress, receiver);
|
|
2337
|
-
this.#hookFailback();
|
|
2338
|
-
this.#provenanceJoin = { flow: ingress.flow };
|
|
2339
2412
|
}
|
|
2340
2413
|
|
|
2341
2414
|
/** Un-protect: drop the flow's hold queues (no expiry counted). */
|
|
@@ -2368,12 +2441,33 @@ export class MulticastManager {
|
|
|
2368
2441
|
* callback delivers must come from a subscription opened on
|
|
2369
2442
|
* `options.gateway`. A callback that also merges another source (a MoQ or
|
|
2370
2443
|
* WebSocket repair feed) must not name a native provider here.
|
|
2444
|
+
*
|
|
2445
|
+
* An endpoint's `provenance` makes its group a protected flow of its own
|
|
2446
|
+
* (multicast-02 7.2.7), registered here and released with the group; its
|
|
2447
|
+
* records ride in band on the group's port. On the user-agent path a
|
|
2448
|
+
* flow-less repair group of a protected track is set aside, never read, so
|
|
2449
|
+
* a player joining a protected catalog's repair groups passes it.
|
|
2371
2450
|
*/
|
|
2372
2451
|
joinRepairEndpoints(
|
|
2373
2452
|
endpoints: readonly MulticastRepairEndpoint[],
|
|
2374
2453
|
provider?: WindowMulticastGateway | MulticastRepairSubscribe,
|
|
2375
2454
|
options?: { gateway?: WindowMulticastGateway },
|
|
2376
2455
|
): () => void {
|
|
2456
|
+
for (const { provenance, flow, source, group, port } of endpoints) {
|
|
2457
|
+
if (provenance === undefined) continue;
|
|
2458
|
+
if (flow !== undefined) {
|
|
2459
|
+
throw new TypeError("[MulticastManager] joinRepairEndpoints: an endpoint names provenance or flow, never both");
|
|
2460
|
+
}
|
|
2461
|
+
if (
|
|
2462
|
+
!sameIpAddress(source, provenance.flow.source) ||
|
|
2463
|
+
!sameIpAddress(group, provenance.flow.groupAddress) ||
|
|
2464
|
+
port !== provenance.flow.port
|
|
2465
|
+
) {
|
|
2466
|
+
throw new RangeError(
|
|
2467
|
+
"[MulticastManager] joinRepairEndpoints: provenance flow (S, G, port) must match the endpoint's source, group and port",
|
|
2468
|
+
);
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2377
2471
|
const releases: Array<() => void> = [];
|
|
2378
2472
|
let released = false;
|
|
2379
2473
|
const safely = (each: () => void) => {
|
|
@@ -2383,6 +2477,21 @@ export class MulticastManager {
|
|
|
2383
2477
|
console.warn("[MulticastManager] repair group release failed", error);
|
|
2384
2478
|
}
|
|
2385
2479
|
};
|
|
2480
|
+
// Caller-owned flows reserve their keys even though this method does not
|
|
2481
|
+
// own their release; a protected endpoint must not replace one silently.
|
|
2482
|
+
const usedFlows = new Set(endpoints.flatMap(({ flow }) => flow === undefined ? [] : [flow]));
|
|
2483
|
+
const preparedProvenance = endpoints.map((endpoint) => {
|
|
2484
|
+
if (endpoint.provenance === undefined) return undefined;
|
|
2485
|
+
const flow = multicastProvenanceFlowKey(endpoint.provenance.flow);
|
|
2486
|
+
if (usedFlows.has(flow) || this.#provenanceJoin?.flow === flow ||
|
|
2487
|
+
[...this.#repairProvenanceFlows.values()].some((flows) => flows.includes(flow))) {
|
|
2488
|
+
throw new TypeError(`[MulticastManager] joinRepairEndpoints: provenance flow already registered: ${flow}`);
|
|
2489
|
+
}
|
|
2490
|
+
usedFlows.add(flow);
|
|
2491
|
+
// Construct every receiver before registering or joining any endpoint.
|
|
2492
|
+
return { flow, receiver: this.#provenanceReceiver(endpoint.provenance) };
|
|
2493
|
+
});
|
|
2494
|
+
const provenanceFlows: string[] = [];
|
|
2386
2495
|
// An overlay leg's source and repair track names come from the
|
|
2387
2496
|
// endpoint's ingress tracks.
|
|
2388
2497
|
const repairOwners: RepairOwnerEntry[] = endpoints.flatMap((endpoint) =>
|
|
@@ -2392,11 +2501,19 @@ export class MulticastManager {
|
|
|
2392
2501
|
repairTrackName: endpoint.tracks.find((t) => t.packetId === owner.packetId)?.name,
|
|
2393
2502
|
}));
|
|
2394
2503
|
this.#applyRepairOwners(repairOwners);
|
|
2395
|
-
for (const endpoint of endpoints) {
|
|
2504
|
+
for (const [index, endpoint] of endpoints.entries()) {
|
|
2505
|
+
const flow = endpoint.provenance === undefined ? endpoint.flow : multicastProvenanceFlowKey(endpoint.provenance.flow);
|
|
2396
2506
|
const ingress: MmtpIngressContext = {
|
|
2397
2507
|
tracks: Object.freeze(endpoint.tracks.map(({ name, packetId }) => Object.freeze({ name, packetId }))),
|
|
2398
|
-
...(
|
|
2508
|
+
...(flow === undefined ? {} : { flow }),
|
|
2399
2509
|
};
|
|
2510
|
+
if (endpoint.provenance !== undefined) {
|
|
2511
|
+
const prepared = preparedProvenance[index];
|
|
2512
|
+
if (prepared === undefined) throw new Error("[MulticastManager] repair provenance preparation missing");
|
|
2513
|
+
this.#router.registerProvenanceFlow(ingress as MmtpIngressContext & { flow: string }, prepared.receiver);
|
|
2514
|
+
provenanceFlows.push(prepared.flow);
|
|
2515
|
+
releases.push(() => this.#router.releaseProvenanceFlow(flow!));
|
|
2516
|
+
}
|
|
2400
2517
|
let sender: string | undefined;
|
|
2401
2518
|
const feed = (packet: Uint8Array, sourceAddress: string | undefined, ingressToFeed: MmtpIngressContext) => {
|
|
2402
2519
|
if (released) return;
|
|
@@ -2433,7 +2550,7 @@ export class MulticastManager {
|
|
|
2433
2550
|
packetIds: endpoint.packetIds,
|
|
2434
2551
|
tracks: endpoint.tracks.map(({ name, packetId }) => ({ name, packetId })),
|
|
2435
2552
|
// A protected repair group's records ride in band on its port (7.2.3).
|
|
2436
|
-
...(
|
|
2553
|
+
...(flow === undefined ? {} : { protected: true }),
|
|
2437
2554
|
}, ingress).then((joined) => {
|
|
2438
2555
|
if (!joined && !released) fail(transport.lastJoinOutcome);
|
|
2439
2556
|
});
|
|
@@ -2442,9 +2559,12 @@ export class MulticastManager {
|
|
|
2442
2559
|
if (released) return;
|
|
2443
2560
|
released = true;
|
|
2444
2561
|
this.#repairReleases.delete(release);
|
|
2562
|
+
this.#repairProvenanceFlows.delete(release);
|
|
2445
2563
|
for (const each of releases.splice(0)) safely(each);
|
|
2446
2564
|
};
|
|
2447
2565
|
this.#repairReleases.set(release, repairOwners);
|
|
2566
|
+
this.#repairProvenanceFlows.set(release, provenanceFlows);
|
|
2567
|
+
if (provenanceFlows.length) this.#hookFailback();
|
|
2448
2568
|
return release;
|
|
2449
2569
|
}
|
|
2450
2570
|
|
|
@@ -3084,6 +3204,7 @@ export class MulticastManager {
|
|
|
3084
3204
|
geometry.blockProfile,
|
|
3085
3205
|
`tracks[${JSON.stringify(track.name)}].fec keyframe overlay blockProfile`,
|
|
3086
3206
|
),
|
|
3207
|
+
geometry,
|
|
3087
3208
|
});
|
|
3088
3209
|
}
|
|
3089
3210
|
}
|
|
@@ -3129,7 +3250,7 @@ export class MulticastManager {
|
|
|
3129
3250
|
const before = this.#overlayBindings.get(sourcePacketId);
|
|
3130
3251
|
const after = overlayBindings.get(sourcePacketId);
|
|
3131
3252
|
const same = before !== undefined && after !== undefined &&
|
|
3132
|
-
(Object.keys(after) as Array<keyof OverlayBinding>).every((key) => after[key] === before[key]);
|
|
3253
|
+
(Object.keys(after) as Array<keyof OverlayBinding>).every((key) => key === "geometry" || after[key] === before[key]);
|
|
3133
3254
|
if (!same) install.dispose();
|
|
3134
3255
|
else if (this.#router.hasKeyframeOverlay(after.repairPacketId)) this.#router.resetKeyframeOverlays(sourcePacketId);
|
|
3135
3256
|
// A retired packet ID took the router's instance with it.
|
|
@@ -3193,10 +3314,15 @@ export class MulticastManager {
|
|
|
3193
3314
|
* Register the range repair scheduler (draft-ramadan-moq-fec §7.5): from now
|
|
3194
3315
|
* on an iso-ssbg1-v1 gap missing a source and every repair is kept as a
|
|
3195
3316
|
* pending hole and reported here, and `closeIsoHoles` must be called for it
|
|
3196
|
-
* once its range FETCH ends (or none is sent).
|
|
3317
|
+
* once its range FETCH ends (or none is sent). `onExpired` is told of a
|
|
3318
|
+
* pending hole the stream runs past the locator's horizon: returning true,
|
|
3319
|
+
* the caller closes it (`closeIsoHoles`); otherwise it is discarded.
|
|
3197
3320
|
*/
|
|
3198
|
-
onUndelimitedLoss(
|
|
3199
|
-
|
|
3321
|
+
onUndelimitedLoss(
|
|
3322
|
+
cb: (loss: UndelimitedIsoLoss) => void,
|
|
3323
|
+
onExpired?: (hole: ExpiredIsoHole) => boolean,
|
|
3324
|
+
): void {
|
|
3325
|
+
this.#fec.setUndelimitedLossHandler(cb, onExpired ?? null);
|
|
3200
3326
|
}
|
|
3201
3327
|
|
|
3202
3328
|
/**
|
|
@@ -3515,6 +3641,9 @@ export class MulticastManager {
|
|
|
3515
3641
|
...("symbols" in event
|
|
3516
3642
|
? { symbols: Object.freeze({ ...event.symbols }) }
|
|
3517
3643
|
: {}),
|
|
3644
|
+
...("span" in event && event.span !== undefined
|
|
3645
|
+
? { span: Object.freeze({ ...event.span }) }
|
|
3646
|
+
: {}),
|
|
3518
3647
|
},
|
|
3519
3648
|
) as RepairLifecycleEvent);
|
|
3520
3649
|
// 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'
|