@blockcast/mmt-container 2.2.0-main.7e8a9d13c01c → 2.2.0-main.979b946cb020
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/dist/browser-runtime.js +173 -17
- package/dist/browser-runtime.js.map +3 -3
- package/dist/cmaf-block-assembler.js +92 -1
- package/dist/cmaf-block-assembler.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/fec-manager.d.ts +4 -2
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +19 -6
- package/dist/fec-manager.js.map +2 -2
- package/dist/mmtp-container-parser.js +92 -1
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +92 -1
- package/dist/mmtp-container-parser.no-modules.js.map +3 -3
- package/dist/mmtp-decode-pipeline.js +92 -1
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-router.js +92 -1
- package/dist/mmtp-router.js.map +3 -3
- package/dist/multicast-manager.d.ts +13 -0
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +171 -15
- package/dist/multicast-manager.js.map +3 -3
- package/dist/no-modules.js +92 -1
- package/dist/no-modules.js.map +3 -3
- package/dist/repair-fetch.d.ts +2 -0
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +2 -2
- package/dist/repair-fetch.js.map +2 -2
- package/dist/wasm-mmtp-container-parser.js +92 -1
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +5 -5
- package/src/codec-utils.ts +121 -1
- package/src/fec-manager.ts +24 -6
- package/src/multicast-manager.ts +74 -8
- package/src/repair-fetch.ts +4 -2
package/dist/browser-runtime.js
CHANGED
|
@@ -6099,9 +6099,10 @@ function isH264IntraSlice(nal) {
|
|
|
6099
6099
|
const sliceType = readH264SliceType(nal);
|
|
6100
6100
|
return sliceType === 2 || sliceType === 4 || sliceType === 7 || sliceType === 9;
|
|
6101
6101
|
}
|
|
6102
|
+
var H264_SLICE_TYPE_ESCAPED_BYTES = 32;
|
|
6102
6103
|
function readH264SliceType(nal) {
|
|
6103
6104
|
if (nal.length < 2 || (nal[0] & 31) !== 1) return null;
|
|
6104
|
-
const rbsp = removeEmulationPrevention(nal.subarray(1));
|
|
6105
|
+
const rbsp = removeEmulationPrevention(nal.subarray(1, 1 + H264_SLICE_TYPE_ESCAPED_BYTES));
|
|
6105
6106
|
const state = { bitOffset: 0 };
|
|
6106
6107
|
if (readUnsignedExpGolomb(rbsp, state) === null) return null;
|
|
6107
6108
|
return readUnsignedExpGolomb(rbsp, state);
|
|
@@ -6470,6 +6471,96 @@ if (void 0) {
|
|
|
6470
6471
|
]))).toBe(false);
|
|
6471
6472
|
});
|
|
6472
6473
|
});
|
|
6474
|
+
describe("readH264SliceType", () => {
|
|
6475
|
+
const wholeNalSliceType = (nal) => {
|
|
6476
|
+
if (nal.length < 2 || (nal[0] & 31) !== 1) return null;
|
|
6477
|
+
const rbsp = removeEmulationPrevention(nal.subarray(1));
|
|
6478
|
+
const state = { bitOffset: 0 };
|
|
6479
|
+
if (readUnsignedExpGolomb(rbsp, state) === null) return null;
|
|
6480
|
+
return readUnsignedExpGolomb(rbsp, state);
|
|
6481
|
+
};
|
|
6482
|
+
const hex3 = (text2) => Uint8Array.from(text2.match(/../g), (byte) => parseInt(byte, 16));
|
|
6483
|
+
const ue = (value) => {
|
|
6484
|
+
const code = (value + 1).toString(2);
|
|
6485
|
+
return "0".repeat(code.length - 1) + code;
|
|
6486
|
+
};
|
|
6487
|
+
const sliceNal = (bits) => {
|
|
6488
|
+
const rbsp = `${bits}1`.padEnd(Math.ceil((bits.length + 1) / 8) * 8, "0").match(/.{8}/g);
|
|
6489
|
+
const nal = [1];
|
|
6490
|
+
let zeros = 0;
|
|
6491
|
+
for (const byte of rbsp.map((bits8) => parseInt(bits8, 2))) {
|
|
6492
|
+
if (zeros >= 2 && byte <= 3) {
|
|
6493
|
+
nal.push(3);
|
|
6494
|
+
zeros = 0;
|
|
6495
|
+
}
|
|
6496
|
+
nal.push(byte);
|
|
6497
|
+
zeros = byte === 0 ? zeros + 1 : 0;
|
|
6498
|
+
}
|
|
6499
|
+
return Uint8Array.from(nal);
|
|
6500
|
+
};
|
|
6501
|
+
const x264Slices = [
|
|
6502
|
+
["64x48 P", hex3("419a231885bfd53888f63ef5b1e1e39b9ff2eabf03fd3f4d7d4317ffcbf75176"), 5, false],
|
|
6503
|
+
["64x48 B", hex3("419e414212fffeeade283707cb70f7"), 6, false],
|
|
6504
|
+
["64x48 non-IDR I", hex3(
|
|
6505
|
+
"4128899037f384db2be0cfe48aa23558781dd429f7db8e8a6ae44f7ca2333ba1029477da6ddfeac61843c5680cbf66247469d64549b0f5f7ca6acc529f5cf032b35d8dedc6b2412ece24f42f80b593fc0f3ff47a08c84799ff2ada18ac39a527e23eb34c8167fd"
|
|
6506
|
+
), 7, true],
|
|
6507
|
+
["1280x720 B, escape at byte 10", hex3(
|
|
6508
|
+
"01006e27a81109ff000003016b662ea5ea46000f57880f3fb0d3f03ff7dac0546fc9966a5f6d86cb795db178882f6e19b75d92170917306190f262fd58268702db2eff86a9651e48"
|
|
6509
|
+
), 6, false],
|
|
6510
|
+
["1280x720 P, escape at byte 15", hex3(
|
|
6511
|
+
"41006e26a8cd1329e1bffea784000003002b5ef096f0320bd99f00037f22327e886223b7996bb04acd35ad9a0385f02c1801eb6226bc94993d1880172ffbb23db74729569b6f3934cba0cba17b7c29ce0e216080cb7b18e5876df59e85302da9cba203fe6769178a2e02eeaa54a6f87568cbaa019a3442eae19c8a7adc8cd02441bee573c5408b6552abd2d9d3"
|
|
6512
|
+
), 5, false],
|
|
6513
|
+
["1280x720 B, escape at byte 22", hex3("01006e27da9109ff01a4c1dbc27ed915a3172ec80000030352"), 6, false],
|
|
6514
|
+
["7680x4320 IDR, first_mb_in_slice 97440", hex3(
|
|
6515
|
+
"650000be5088843a118a000218f1c00040f63800087949c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9"
|
|
6516
|
+
), null, true],
|
|
6517
|
+
["7680x4320 P, first_mb_in_slice 32640", hex3(
|
|
6518
|
+
"410003fc09a20a806ff0ae0085a611cc7ad5f2020e25900ba4c3398016b57e100011021220200020"
|
|
6519
|
+
), 5, false],
|
|
6520
|
+
["7680x4320 P, first_mb_in_slice 97440", hex3(
|
|
6521
|
+
"410000be509a20a8078f5a83cc40d800783b017f5c6d7e4883fb4801a9c569245bd04135f7c00806"
|
|
6522
|
+
), 5, false]
|
|
6523
|
+
];
|
|
6524
|
+
const syntheticSlices = [
|
|
6525
|
+
["an escape inside first_mb_in_slice", sliceNal(ue(2 ** 24 - 1) + ue(2)), 2],
|
|
6526
|
+
["an escape between the fields", sliceNal(ue(2 ** 21 - 1) + ue(7)), 7],
|
|
6527
|
+
["an escape inside slice_type", sliceNal(ue(0) + ue(2 ** 22 - 1)), 2 ** 22 - 1],
|
|
6528
|
+
["the longest fields, five escapes", sliceNal(ue(2 ** 30 - 1) + ue(2 ** 30 - 1)), 2 ** 30 - 1],
|
|
6529
|
+
["the largest values", sliceNal(ue(2 ** 31 - 2) + ue(2 ** 31 - 2)), 2 ** 31 - 2],
|
|
6530
|
+
["31 leading zeros in first_mb_in_slice", sliceNal(`${"0".repeat(31)}1`), null],
|
|
6531
|
+
["31 leading zeros in slice_type", sliceNal(`1${"0".repeat(31)}1`), null],
|
|
6532
|
+
["escapes running past the slice header", sliceNal(ue(0) + ue(5) + "0".repeat(400)), 5]
|
|
6533
|
+
];
|
|
6534
|
+
test("reads the slice_type of real and synthetic slices", () => {
|
|
6535
|
+
for (const [name, nal, sliceType] of [...x264Slices, ...syntheticSlices]) {
|
|
6536
|
+
expect(readH264SliceType(nal), name).toBe(sliceType);
|
|
6537
|
+
}
|
|
6538
|
+
});
|
|
6539
|
+
test("matches the whole-NAL unescape at every truncation", () => {
|
|
6540
|
+
for (const [name, nal] of [...x264Slices, ...syntheticSlices]) {
|
|
6541
|
+
for (let end = 0; end <= nal.length; end++) {
|
|
6542
|
+
const cut = nal.subarray(0, end);
|
|
6543
|
+
expect(readH264SliceType(cut), `${name}, first ${end} bytes`).toBe(wholeNalSliceType(cut));
|
|
6544
|
+
}
|
|
6545
|
+
}
|
|
6546
|
+
});
|
|
6547
|
+
test("matches the whole-NAL unescape on zero-heavy NAL units", () => {
|
|
6548
|
+
const bytes = [0, 0, 0, 3, 1, 2, 128, 255];
|
|
6549
|
+
let seed = 1;
|
|
6550
|
+
const next = () => (seed = Math.imul(seed, 1103515245) + 12345 >>> 0) >>> 16;
|
|
6551
|
+
for (let i = 0; i < 5e3; i++) {
|
|
6552
|
+
const nal = new Uint8Array(2 + next() % 63);
|
|
6553
|
+
nal[0] = 65;
|
|
6554
|
+
for (let j = 1; j < nal.length; j++) nal[j] = bytes[next() % bytes.length];
|
|
6555
|
+
expect(readH264SliceType(nal), Array.from(nal).join()).toBe(wholeNalSliceType(nal));
|
|
6556
|
+
}
|
|
6557
|
+
});
|
|
6558
|
+
test("classifies the x264 slices as keyframes or not", () => {
|
|
6559
|
+
for (const [name, nal, , keyframe] of x264Slices) {
|
|
6560
|
+
expect(classifyH264Keyframe(rawH264NalToAvcc(nal), { allowPartialAvcc: true }), name).toBe(keyframe);
|
|
6561
|
+
}
|
|
6562
|
+
});
|
|
6563
|
+
});
|
|
6473
6564
|
describe("avccToAnnexB", () => {
|
|
6474
6565
|
test("converts with SPS/PPS on keyframe", () => {
|
|
6475
6566
|
const avcc = new Uint8Array([0, 0, 0, 3, 101, 170, 187]);
|
|
@@ -14041,7 +14132,8 @@ var FECManager = class _FECManager {
|
|
|
14041
14132
|
this.#ssbLengthConflictCount = 0;
|
|
14042
14133
|
this.#blockRepairRsIds = /* @__PURE__ */ new Map();
|
|
14043
14134
|
// RSB_length per block (C.5.3 Repair FEC Payload ID): how many repair
|
|
14044
|
-
// symbols its repair group carries
|
|
14135
|
+
// symbols its repair group carries; 0 for a repair-less span no repair can
|
|
14136
|
+
// state (#openIsoSpan). Same lifecycle as #blockRepairRsIds.
|
|
14045
14137
|
this.#blockRsbLengths = /* @__PURE__ */ new Map();
|
|
14046
14138
|
/** fec-01 6.3.9 anchor state per stream key, one entry per held layer. */
|
|
14047
14139
|
this.#heldLayerStates = /* @__PURE__ */ new Map();
|
|
@@ -16064,8 +16156,10 @@ var FECManager = class _FECManager {
|
|
|
16064
16156
|
}
|
|
16065
16157
|
/**
|
|
16066
16158
|
* An open block's accepted sources, distinct repair RS_IDs, authored K'
|
|
16067
|
-
* (SSB_length) and RSB_length (each undefined until a repair stated it
|
|
16068
|
-
*
|
|
16159
|
+
* (SSB_length) and RSB_length (each undefined until a repair stated it; a
|
|
16160
|
+
* repair-less span states its length, and RSB_length 0 when it is longer
|
|
16161
|
+
* than K, since no repair can reach it). Undefined for a block that is not
|
|
16162
|
+
* open.
|
|
16069
16163
|
*/
|
|
16070
16164
|
blockSymbolCounts(sbn, packetId, catalogTrackName) {
|
|
16071
16165
|
const key = this.#blockKey(sbn, packetId, catalogTrackName);
|
|
@@ -16367,12 +16461,21 @@ var FECManager = class _FECManager {
|
|
|
16367
16461
|
* its placed sources exactly as on the wire (feedRepairSymbol). A span every
|
|
16368
16462
|
* SS_ID of which vanished resolves through its deadline like any vanished
|
|
16369
16463
|
* block.
|
|
16464
|
+
*
|
|
16465
|
+
* A span longer than K holds more than one block (SSB_length <= K), and the
|
|
16466
|
+
* locator states no block inside a span, only one exactly its range
|
|
16467
|
+
* (IsoBlockLocator.placeRepair): no repair, multicast or FETCHed, can ever
|
|
16468
|
+
* reach it. Its repair group is empty, so only its own late sources can
|
|
16469
|
+
* complete it, and it waits as a stated block its group cannot complete
|
|
16470
|
+
* does (#lateSourceWaitMs; BLO-52085 D4). A span of K or less may be one
|
|
16471
|
+
* block whose repair is still to come, and keeps the whole wait.
|
|
16370
16472
|
*/
|
|
16371
16473
|
#openIsoSpan(span, packetId, catalogTrackName) {
|
|
16372
16474
|
const key = this.#blockKey(span.block.start, packetId, catalogTrackName);
|
|
16373
16475
|
if (!this.#blockAuthoredLengths.has(key)) {
|
|
16374
16476
|
this.#blockAuthoredLengths.set(key, span.block.length);
|
|
16375
16477
|
this.#isoSpanKeys.add(key);
|
|
16478
|
+
if (span.block.length > this.#isoLocatorFor(packetId, catalogTrackName).kMax) this.#blockRsbLengths.set(key, 0);
|
|
16376
16479
|
}
|
|
16377
16480
|
if (span.placed.length === 0) this.#materializeBlock(span.block.start, packetId, catalogTrackName, true);
|
|
16378
16481
|
}
|
|
@@ -17216,7 +17319,7 @@ var FECManager = class _FECManager {
|
|
|
17216
17319
|
const previous = locator.newestSource;
|
|
17217
17320
|
if (!locator.noteSource(ssId) || previous === void 0) return;
|
|
17218
17321
|
for (const block of locator.blocksBetween(previous - 1 >>> 0, ssId)) {
|
|
17219
|
-
if (
|
|
17322
|
+
if (!serial32Precedes(serial32Add(block.start, block.length - 1), ssId)) continue;
|
|
17220
17323
|
this.#shortenUnrecoverableWait(
|
|
17221
17324
|
this.#blockKey(block.start, packetId, catalogTrackName),
|
|
17222
17325
|
block.start,
|
|
@@ -17227,8 +17330,9 @@ var FECManager = class _FECManager {
|
|
|
17227
17330
|
}
|
|
17228
17331
|
/**
|
|
17229
17332
|
* The wait of a block that only a late source can complete (BLO-52085): a
|
|
17230
|
-
* repair stated it,
|
|
17231
|
-
*
|
|
17333
|
+
* repair stated it, or it is a repair-less span longer than K (whose group
|
|
17334
|
+
* is empty, #openIsoSpan), its received sources plus every symbol its
|
|
17335
|
+
* repair group carries (RSB_length) are short of K' (the repair scheduler's
|
|
17232
17336
|
* group-cannot-complete), and a later source of the stream has arrived, so
|
|
17233
17337
|
* a source it misses is lost or reordered behind that one. The span, which
|
|
17234
17338
|
* covers repair symbols paced after its sources, buys it nothing: it waits
|
|
@@ -28701,6 +28805,8 @@ var MulticastManager = class {
|
|
|
28701
28805
|
/** Live joinRepairEndpoints() releases → the repair owners they registered,
|
|
28702
28806
|
* re-applied after configureMultiTrack() clears catalog-derived owners. */
|
|
28703
28807
|
#repairReleases = /* @__PURE__ */ new Map();
|
|
28808
|
+
/** Protected repair flows owned by each live repair-endpoint release. */
|
|
28809
|
+
#repairProvenanceFlows = /* @__PURE__ */ new Map();
|
|
28704
28810
|
/** Each source's catalog keyframe overlay, from its `ok` binding. */
|
|
28705
28811
|
#overlayBindings = /* @__PURE__ */ new Map();
|
|
28706
28812
|
/** Installed overlay decoders (`setKeyframeOverlayDecoder`), by source. */
|
|
@@ -29367,6 +29473,9 @@ var MulticastManager = class {
|
|
|
29367
29473
|
this.#transport.onFailback((reason) => {
|
|
29368
29474
|
const joined = this.#provenanceJoin;
|
|
29369
29475
|
if (joined !== null) this.#router.unprotectProvenanceFlow(joined.flow);
|
|
29476
|
+
for (const flows of this.#repairProvenanceFlows.values()) {
|
|
29477
|
+
for (const flow of flows) this.#router.unprotectProvenanceFlow(flow);
|
|
29478
|
+
}
|
|
29370
29479
|
this.#onFailback?.(reason);
|
|
29371
29480
|
});
|
|
29372
29481
|
}
|
|
@@ -29401,6 +29510,12 @@ var MulticastManager = class {
|
|
|
29401
29510
|
"[MulticastManager] join: provenance flow (S, G, port) must match sourceAddress ?? senderAddress, groupAddress and port"
|
|
29402
29511
|
);
|
|
29403
29512
|
}
|
|
29513
|
+
if (provenanceFlow !== void 0) {
|
|
29514
|
+
const flow = multicastProvenanceFlowKey(provenanceFlow);
|
|
29515
|
+
if ([...this.#repairProvenanceFlows.values()].some((flows) => flows.includes(flow))) {
|
|
29516
|
+
throw new TypeError(`[MulticastManager] join: provenance flow already registered by a repair endpoint: ${flow}`);
|
|
29517
|
+
}
|
|
29518
|
+
}
|
|
29404
29519
|
const staged = this.#renditionSwitch;
|
|
29405
29520
|
if (staged !== null) this.#endRenditionSwitch(staged, { reason: "superseded" }, false);
|
|
29406
29521
|
this.configureFec(config);
|
|
@@ -29408,8 +29523,8 @@ var MulticastManager = class {
|
|
|
29408
29523
|
const selectedPacketIds = config.packetIds?.length ? new Set(config.packetIds) : null;
|
|
29409
29524
|
const catalogTracks = config.tracks?.filter(({ packetId }) => selectedPacketIds === null || selectedPacketIds.has(packetId));
|
|
29410
29525
|
const ingressTracks = catalogTracks ? catalogTracks : selectedPacketIds === null ? void 0 : [...selectedPacketIds].map((packetId) => ({ name: "", packetId }));
|
|
29411
|
-
this.#releaseProvenanceJoin();
|
|
29412
29526
|
const provenance = config.provenance;
|
|
29527
|
+
this.#releaseProvenanceJoin();
|
|
29413
29528
|
const protectedTracks = ingressTracks ?? provenance?.flow.tracks;
|
|
29414
29529
|
const ingress = protectedTracks === void 0 ? void 0 : {
|
|
29415
29530
|
tracks: Object.freeze(
|
|
@@ -29462,8 +29577,13 @@ var MulticastManager = class {
|
|
|
29462
29577
|
* feeds the flow's receiver; media datagrams are held until one admits them.
|
|
29463
29578
|
*/
|
|
29464
29579
|
#joinProvenance(provenance, ingress) {
|
|
29580
|
+
this.#router.registerProvenanceFlow(ingress, this.#provenanceReceiver(provenance));
|
|
29581
|
+
this.#hookFailback();
|
|
29582
|
+
this.#provenanceJoin = { flow: ingress.flow };
|
|
29583
|
+
}
|
|
29584
|
+
#provenanceReceiver(provenance) {
|
|
29465
29585
|
const { flow, auth } = provenance;
|
|
29466
|
-
|
|
29586
|
+
return new BcProvenanceV2Receiver({
|
|
29467
29587
|
...provenance.receiver,
|
|
29468
29588
|
// The caller's ctx when it passes one, else the catalog's: an explicit
|
|
29469
29589
|
// `catalogCtx: undefined` must not switch off the 7.2.4 ctx check.
|
|
@@ -29480,9 +29600,6 @@ var MulticastManager = class {
|
|
|
29480
29600
|
maxAuthDelayMs: flow.maxAuthDelayMs,
|
|
29481
29601
|
manifestTimerMs: flow.manifestTimerMs
|
|
29482
29602
|
});
|
|
29483
|
-
this.#router.registerProvenanceFlow(ingress, receiver);
|
|
29484
|
-
this.#hookFailback();
|
|
29485
|
-
this.#provenanceJoin = { flow: ingress.flow };
|
|
29486
29603
|
}
|
|
29487
29604
|
/** Un-protect: drop the flow's hold queues (no expiry counted). */
|
|
29488
29605
|
#releaseProvenanceJoin() {
|
|
@@ -29513,8 +29630,25 @@ var MulticastManager = class {
|
|
|
29513
29630
|
* callback delivers must come from a subscription opened on
|
|
29514
29631
|
* `options.gateway`. A callback that also merges another source (a MoQ or
|
|
29515
29632
|
* WebSocket repair feed) must not name a native provider here.
|
|
29633
|
+
*
|
|
29634
|
+
* An endpoint's `provenance` makes its group a protected flow of its own
|
|
29635
|
+
* (multicast-02 7.2.7), registered here and released with the group; its
|
|
29636
|
+
* records ride in band on the group's port. On the user-agent path a
|
|
29637
|
+
* flow-less repair group of a protected track is set aside, never read, so
|
|
29638
|
+
* a player joining a protected catalog's repair groups passes it.
|
|
29516
29639
|
*/
|
|
29517
29640
|
joinRepairEndpoints(endpoints, provider, options) {
|
|
29641
|
+
for (const { provenance, flow, source, group, port: port2 } of endpoints) {
|
|
29642
|
+
if (provenance === void 0) continue;
|
|
29643
|
+
if (flow !== void 0) {
|
|
29644
|
+
throw new TypeError("[MulticastManager] joinRepairEndpoints: an endpoint names provenance or flow, never both");
|
|
29645
|
+
}
|
|
29646
|
+
if (!sameIpAddress(source, provenance.flow.source) || !sameIpAddress(group, provenance.flow.groupAddress) || port2 !== provenance.flow.port) {
|
|
29647
|
+
throw new RangeError(
|
|
29648
|
+
"[MulticastManager] joinRepairEndpoints: provenance flow (S, G, port) must match the endpoint's source, group and port"
|
|
29649
|
+
);
|
|
29650
|
+
}
|
|
29651
|
+
}
|
|
29518
29652
|
const releases = [];
|
|
29519
29653
|
let released = false;
|
|
29520
29654
|
const safely = (each) => {
|
|
@@ -29524,17 +29658,36 @@ var MulticastManager = class {
|
|
|
29524
29658
|
console.warn("[MulticastManager] repair group release failed", error);
|
|
29525
29659
|
}
|
|
29526
29660
|
};
|
|
29661
|
+
const usedFlows = /* @__PURE__ */ new Set();
|
|
29662
|
+
const preparedProvenance = endpoints.map((endpoint) => {
|
|
29663
|
+
if (endpoint.provenance === void 0) return void 0;
|
|
29664
|
+
const flow = multicastProvenanceFlowKey(endpoint.provenance.flow);
|
|
29665
|
+
if (usedFlows.has(flow) || this.#provenanceJoin?.flow === flow || [...this.#repairProvenanceFlows.values()].some((flows) => flows.includes(flow))) {
|
|
29666
|
+
throw new TypeError(`[MulticastManager] joinRepairEndpoints: provenance flow already registered: ${flow}`);
|
|
29667
|
+
}
|
|
29668
|
+
usedFlows.add(flow);
|
|
29669
|
+
return { flow, receiver: this.#provenanceReceiver(endpoint.provenance) };
|
|
29670
|
+
});
|
|
29671
|
+
const provenanceFlows = [];
|
|
29527
29672
|
const repairOwners = endpoints.flatMap((endpoint) => endpoint.repairOwners.map((owner) => owner.instance !== "keyframe" ? owner : {
|
|
29528
29673
|
...owner,
|
|
29529
29674
|
ownerTrackName: endpoint.tracks.find((t) => t.packetId === owner.ownerPacketId)?.name,
|
|
29530
29675
|
repairTrackName: endpoint.tracks.find((t) => t.packetId === owner.packetId)?.name
|
|
29531
29676
|
}));
|
|
29532
29677
|
this.#applyRepairOwners(repairOwners);
|
|
29533
|
-
for (const endpoint of endpoints) {
|
|
29678
|
+
for (const [index, endpoint] of endpoints.entries()) {
|
|
29679
|
+
const flow = endpoint.provenance === void 0 ? endpoint.flow : multicastProvenanceFlowKey(endpoint.provenance.flow);
|
|
29534
29680
|
const ingress = {
|
|
29535
29681
|
tracks: Object.freeze(endpoint.tracks.map(({ name, packetId }) => Object.freeze({ name, packetId }))),
|
|
29536
|
-
...
|
|
29682
|
+
...flow === void 0 ? {} : { flow }
|
|
29537
29683
|
};
|
|
29684
|
+
if (endpoint.provenance !== void 0) {
|
|
29685
|
+
const prepared = preparedProvenance[index];
|
|
29686
|
+
if (prepared === void 0) throw new Error("[MulticastManager] repair provenance preparation missing");
|
|
29687
|
+
this.#router.registerProvenanceFlow(ingress, prepared.receiver);
|
|
29688
|
+
provenanceFlows.push(prepared.flow);
|
|
29689
|
+
releases.push(() => this.#router.releaseProvenanceFlow(flow));
|
|
29690
|
+
}
|
|
29538
29691
|
let sender;
|
|
29539
29692
|
const feed = (packet, sourceAddress, ingressToFeed) => {
|
|
29540
29693
|
if (released) return;
|
|
@@ -29564,7 +29717,7 @@ var MulticastManager = class {
|
|
|
29564
29717
|
packetIds: endpoint.packetIds,
|
|
29565
29718
|
tracks: endpoint.tracks.map(({ name, packetId }) => ({ name, packetId })),
|
|
29566
29719
|
// A protected repair group's records ride in band on its port (7.2.3).
|
|
29567
|
-
...
|
|
29720
|
+
...flow === void 0 ? {} : { protected: true }
|
|
29568
29721
|
}, ingress).then((joined) => {
|
|
29569
29722
|
if (!joined && !released) fail(transport.lastJoinOutcome);
|
|
29570
29723
|
});
|
|
@@ -29573,9 +29726,12 @@ var MulticastManager = class {
|
|
|
29573
29726
|
if (released) return;
|
|
29574
29727
|
released = true;
|
|
29575
29728
|
this.#repairReleases.delete(release);
|
|
29729
|
+
this.#repairProvenanceFlows.delete(release);
|
|
29576
29730
|
for (const each of releases.splice(0)) safely(each);
|
|
29577
29731
|
};
|
|
29578
29732
|
this.#repairReleases.set(release, repairOwners);
|
|
29733
|
+
this.#repairProvenanceFlows.set(release, provenanceFlows);
|
|
29734
|
+
if (provenanceFlows.length) this.#hookFailback();
|
|
29579
29735
|
return release;
|
|
29580
29736
|
}
|
|
29581
29737
|
#applyRepairOwners(owners) {
|
|
@@ -33144,7 +33300,7 @@ function wireRepairFetch(mc, opts) {
|
|
|
33144
33300
|
if (!run) return;
|
|
33145
33301
|
entry.running = null;
|
|
33146
33302
|
run.stopped = reason;
|
|
33147
|
-
run.controller.abort();
|
|
33303
|
+
run.controller.abort(reason);
|
|
33148
33304
|
if (reason === "preempted") releaseHold(entry);
|
|
33149
33305
|
mc.noteRepairStopped?.(reason, entry.sbn, entry.packetId, entry.catalogTrackName);
|
|
33150
33306
|
};
|
|
@@ -33442,7 +33598,7 @@ function wireRepairFetch(mc, opts) {
|
|
|
33442
33598
|
if (entries.get(requestKey(sbn, entry.packetId, entry.catalogTrackName))?.running == null) {
|
|
33443
33599
|
const rsIds = /* @__PURE__ */ new Set();
|
|
33444
33600
|
const group = new AbortController();
|
|
33445
|
-
const cancel = () => group.abort();
|
|
33601
|
+
const cancel = () => group.abort(common.signal.reason);
|
|
33446
33602
|
common.signal.addEventListener("abort", cancel, { once: true });
|
|
33447
33603
|
walk.group = { sbn, controller: group };
|
|
33448
33604
|
try {
|