@blockcast/mmt-container 0.4.0-main.1cd3cdea89da → 0.4.0-main.26d61a540c44
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 +1 -1
- package/dist/browser-runtime.js +184 -41
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +6 -0
- package/dist/carp-catalog.js.map +3 -3
- package/dist/catalog-fec-params.d.ts +5 -2
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +100 -36
- package/dist/catalog-fec-params.js.map +4 -4
- package/dist/catalog-network-source.js +3 -0
- package/dist/catalog-network-source.js.map +3 -3
- package/dist/delivery-catalog.js +10 -0
- package/dist/delivery-catalog.js.map +4 -4
- package/dist/fec-manager.js +3 -0
- package/dist/fec-manager.js.map +3 -3
- package/dist/fec-state.d.ts +3 -2
- package/dist/fec-state.d.ts.map +1 -1
- package/dist/fec-state.js +16 -9
- package/dist/fec-state.js.map +4 -4
- package/dist/fec-worker-setup.js +3 -0
- package/dist/fec-worker-setup.js.map +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.js +3 -0
- package/dist/iso-block-locator.js.map +3 -3
- package/dist/mfu-reassembler.js +3 -0
- package/dist/mfu-reassembler.js.map +3 -3
- package/dist/mmtp-container-parser.js +3 -0
- package/dist/mmtp-container-parser.js.map +3 -3
- package/dist/mmtp-container-parser.no-modules.js +19 -9
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +3 -0
- package/dist/mmtp-decode-pipeline.js.map +3 -3
- package/dist/mmtp-router.d.ts +18 -0
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +9 -0
- package/dist/mmtp-router.js.map +3 -3
- package/dist/multicast-input.js +3 -0
- package/dist/multicast-input.js.map +3 -3
- package/dist/multicast-manager.d.ts +43 -0
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +108 -15
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +4 -2
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +18 -4
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js +3 -0
- package/dist/multicast-unwrap.js.map +3 -3
- package/dist/no-modules.js +19 -9
- package/dist/no-modules.js.map +4 -4
- package/dist/repair-fetch.js +3 -0
- package/dist/repair-fetch.js.map +3 -3
- package/dist/repair-layers.js +3 -0
- package/dist/repair-layers.js.map +3 -3
- package/dist/signaling.js +3 -0
- package/dist/signaling.js.map +3 -3
- package/dist/timestamp-codec.js +3 -0
- package/dist/timestamp-codec.js.map +3 -3
- package/dist/wasm-mfu-reassembler.js +3 -0
- package/dist/wasm-mfu-reassembler.js.map +3 -3
- package/dist/wasm-mmtp-container-parser.js +3 -0
- package/dist/wasm-mmtp-container-parser.js.map +3 -3
- package/package.json +5 -5
- package/src/carp-catalog.ts +5 -0
- package/src/catalog-fec-params.ts +38 -17
- package/src/fec-state.ts +4 -9
- package/src/index.ts +5 -0
- package/src/mmtp-router.ts +26 -1
- package/src/multicast-manager.ts +96 -1
- package/src/multicast-transport.ts +11 -3
- package/test-vectors/catalog/README.md +7 -1
- package/test-vectors/catalog/negative/raptorq-unaligned-symbol.json +1 -0
- package/test-vectors/catalog/section-codes.json +33 -0
package/README.md
CHANGED
|
@@ -265,7 +265,7 @@ per-commit `0.1.0-main.<sha>` prerelease from `stamp-prerelease.mjs`), and a
|
|
|
265
265
|
> Superseded by BLO-40665. Every package is now bumped in lockstep by a `v*`
|
|
266
266
|
> tag and the sibling ranges move with it, so the objection above no longer
|
|
267
267
|
> applies -- it was an argument against bumping *one* package. The set is at
|
|
268
|
-
> `0.
|
|
268
|
+
> `0.4.0`; see `RELEASES.md`.
|
|
269
269
|
|
|
270
270
|
#### Track-role convention (Phase 14)
|
|
271
271
|
|
package/dist/browser-runtime.js
CHANGED
|
@@ -949,6 +949,71 @@ function isoBlocksBehindLowerBound(a, b, kMax) {
|
|
|
949
949
|
return serial32Precedes(a, b) ? Math.floor(serial32Distance(a, b) / kMax) : 0;
|
|
950
950
|
}
|
|
951
951
|
|
|
952
|
+
// ../mmt-base/dist/catalog-fec-source.js
|
|
953
|
+
var ALL_ROLES = Object.freeze(["video", "audio"]);
|
|
954
|
+
function recordOf(value) {
|
|
955
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
956
|
+
}
|
|
957
|
+
function locateCatalogFecSource(catalog, source, roles = ALL_ROLES) {
|
|
958
|
+
const root = recordOf(catalog);
|
|
959
|
+
if (root === void 0)
|
|
960
|
+
return void 0;
|
|
961
|
+
for (const role of roles) {
|
|
962
|
+
const renditions = recordOf(recordOf(root[role])?.["renditions"]);
|
|
963
|
+
if (renditions === void 0 || !Object.hasOwn(renditions, source))
|
|
964
|
+
continue;
|
|
965
|
+
const entry2 = recordOf(renditions[source]);
|
|
966
|
+
if (entry2 === void 0)
|
|
967
|
+
continue;
|
|
968
|
+
return Object.freeze({
|
|
969
|
+
dialect: "hang",
|
|
970
|
+
role,
|
|
971
|
+
entry: entry2,
|
|
972
|
+
fec: entry2["fec"],
|
|
973
|
+
fecPath: `$.${role}.renditions[${JSON.stringify(source)}].fec`
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
const tracks = root["tracks"];
|
|
977
|
+
if (!Array.isArray(tracks))
|
|
978
|
+
return void 0;
|
|
979
|
+
const index = tracks.findIndex((track) => recordOf(track)?.["name"] === source);
|
|
980
|
+
if (index < 0)
|
|
981
|
+
return void 0;
|
|
982
|
+
const entry = recordOf(tracks[index]) ?? {};
|
|
983
|
+
return Object.freeze({
|
|
984
|
+
dialect: "msf",
|
|
985
|
+
index,
|
|
986
|
+
entry,
|
|
987
|
+
fec: entry["fec"],
|
|
988
|
+
fecPath: `$.tracks[${index}].fec`
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
function isoBlockSpanUsable(fec) {
|
|
992
|
+
const block = recordOf(fec);
|
|
993
|
+
if (block === void 0 || block["blockProfile"] !== "iso-ssbg1-v1")
|
|
994
|
+
return true;
|
|
995
|
+
const ms = block["interleaveDepthMs"];
|
|
996
|
+
return ms === void 0 || typeof ms === "number" && Number.isSafeInteger(ms) && ms >= 0;
|
|
997
|
+
}
|
|
998
|
+
function catalogFecAvailable(fec) {
|
|
999
|
+
const block = recordOf(fec);
|
|
1000
|
+
if (block === void 0)
|
|
1001
|
+
return true;
|
|
1002
|
+
const declaresFecInstance = block["algorithm"] !== "none";
|
|
1003
|
+
const profile = block["blockProfile"];
|
|
1004
|
+
const profileOk = isFecBlockProfile(profile) || profile === void 0 && !declaresFecInstance;
|
|
1005
|
+
return profileOk && (!declaresFecInstance || isoBlockSpanUsable(block));
|
|
1006
|
+
}
|
|
1007
|
+
function isPositiveSafeInteger(value) {
|
|
1008
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
1009
|
+
}
|
|
1010
|
+
function catalogFecDeclaresUnconfigurableInstance(fec) {
|
|
1011
|
+
const block = recordOf(fec);
|
|
1012
|
+
if (block === void 0 || block["algorithm"] === "none")
|
|
1013
|
+
return false;
|
|
1014
|
+
return !(isPositiveSafeInteger(block["sourceSymbols"]) && isPositiveSafeInteger(block["symbolSize"]));
|
|
1015
|
+
}
|
|
1016
|
+
|
|
952
1017
|
// src/mfu-reassembler.ts
|
|
953
1018
|
function fragmentProvenance(fragment) {
|
|
954
1019
|
if (fragment.deliveryProvenance !== void 0) return fragment.deliveryProvenance;
|
|
@@ -6718,6 +6783,9 @@ function validateCmsfMmtpCatalog(value) {
|
|
|
6718
6783
|
catalogError("track_fec", `${path}.fec.${field}`, "must be a positive integer");
|
|
6719
6784
|
}
|
|
6720
6785
|
}
|
|
6786
|
+
if (algorithm === "raptorq" && config["symbolSize"] % 8 !== 0) {
|
|
6787
|
+
catalogError("track_fec", `${path}.fec.symbolSize`, "RaptorQ symbolSize must be a multiple of 8");
|
|
6788
|
+
}
|
|
6721
6789
|
if (typeof config["repairTrack"] !== "string" || config["repairTrack"].length === 0) {
|
|
6722
6790
|
catalogError("track_fec", `${path}.fec.repairTrack`, "must be a non-empty string");
|
|
6723
6791
|
}
|
|
@@ -6923,6 +6991,9 @@ var FEC_BLOCK_PROFILES2 = Object.freeze([
|
|
|
6923
6991
|
"iso-ssbg1-v1"
|
|
6924
6992
|
]);
|
|
6925
6993
|
|
|
6994
|
+
// node_modules/@blockcast/mmt-base/dist/catalog-fec-source.js
|
|
6995
|
+
var ALL_ROLES2 = Object.freeze(["video", "audio"]);
|
|
6996
|
+
|
|
6926
6997
|
// node_modules/@blockcast/mmt-transport/dist/driad-discovery.js
|
|
6927
6998
|
var DRIADDiscovery = class {
|
|
6928
6999
|
cache = /* @__PURE__ */ new Map();
|
|
@@ -8125,6 +8196,10 @@ var TransportManager = class {
|
|
|
8125
8196
|
pollMulticastTierSwitch() {
|
|
8126
8197
|
return this.dispatchOrchestratorCommand(this.multicastOrchestrator?.poll());
|
|
8127
8198
|
}
|
|
8199
|
+
/** Abandon the in-flight tier join, e.g. because the host could not join the target. */
|
|
8200
|
+
cancelMulticastTierJoin() {
|
|
8201
|
+
return this.dispatchOrchestratorCommand(this.multicastOrchestrator?.cancel());
|
|
8202
|
+
}
|
|
8128
8203
|
/**
|
|
8129
8204
|
* Set packet callback
|
|
8130
8205
|
*/
|
|
@@ -12572,22 +12647,16 @@ var INACTIVE = Object.freeze({
|
|
|
12572
12647
|
"reliable-moq": Object.freeze({ state: "inactive", reason: "reliable-moq" }),
|
|
12573
12648
|
"no-multicast-bridge": Object.freeze({ state: "inactive", reason: "no-multicast-bridge" })
|
|
12574
12649
|
});
|
|
12575
|
-
function
|
|
12650
|
+
function recordOf2(value) {
|
|
12576
12651
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
12577
12652
|
}
|
|
12578
|
-
function
|
|
12653
|
+
function isPositiveSafeInteger2(value) {
|
|
12579
12654
|
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
12580
12655
|
}
|
|
12581
12656
|
function catalogDeclaresFec(fec) {
|
|
12582
|
-
const block =
|
|
12657
|
+
const block = recordOf2(fec);
|
|
12583
12658
|
if (block === void 0 || block["algorithm"] === "none") return false;
|
|
12584
|
-
return
|
|
12585
|
-
}
|
|
12586
|
-
function isoBlockSpanUsable(fec) {
|
|
12587
|
-
const block = recordOf(fec);
|
|
12588
|
-
if (block === void 0 || block["blockProfile"] !== "iso-ssbg1-v1") return true;
|
|
12589
|
-
const ms = block["interleaveDepthMs"];
|
|
12590
|
-
return ms === void 0 || typeof ms === "number" && Number.isSafeInteger(ms) && ms >= 0;
|
|
12659
|
+
return isPositiveSafeInteger2(block["sourceSymbols"]) && isPositiveSafeInteger2(block["symbolSize"]) && isFecBlockProfile(block["blockProfile"]) && isoBlockSpanUsable(block);
|
|
12591
12660
|
}
|
|
12592
12661
|
function requireBoolean(value, field) {
|
|
12593
12662
|
if (typeof value !== "boolean") {
|
|
@@ -12603,7 +12672,7 @@ function resolveFecState(evidence) {
|
|
|
12603
12672
|
if (typeof transportPolicy !== "string" || !TRANSPORT_POLICIES.has(transportPolicy)) {
|
|
12604
12673
|
throw new TypeError(`resolveFecState: unsupported transportPolicy ${JSON.stringify(transportPolicy)}`);
|
|
12605
12674
|
}
|
|
12606
|
-
if (stats !== null && stats !== void 0 &&
|
|
12675
|
+
if (stats !== null && stats !== void 0 && recordOf2(stats) === void 0) {
|
|
12607
12676
|
throw new TypeError("resolveFecState: stats must be a plain object, null or undefined");
|
|
12608
12677
|
}
|
|
12609
12678
|
if (!catalogFec) return INACTIVE["no-catalog-fec"];
|
|
@@ -20624,6 +20693,8 @@ var MmtpRouter = class {
|
|
|
20624
20693
|
catalogTrackName
|
|
20625
20694
|
);
|
|
20626
20695
|
this.#routeTrackPacket(packet, info.packetId, info.sequenceNumber, {
|
|
20696
|
+
mmtpTimestamp: parsed.header.timestamp,
|
|
20697
|
+
rap: info.rapFlag,
|
|
20627
20698
|
recovered: false,
|
|
20628
20699
|
skipFecPayloadId: false,
|
|
20629
20700
|
catalogTrackName
|
|
@@ -20811,6 +20882,8 @@ var MmtpRouter = class {
|
|
|
20811
20882
|
callback(packet, {
|
|
20812
20883
|
packetId,
|
|
20813
20884
|
packetSequenceNumber,
|
|
20885
|
+
mmtpTimestamp: meta.mmtpTimestamp,
|
|
20886
|
+
rap: meta.rap,
|
|
20814
20887
|
recovered: meta.recovered,
|
|
20815
20888
|
skipFecPayloadId: meta.skipFecPayloadId,
|
|
20816
20889
|
...meta.catalogTrackName === void 0 ? {} : { catalogTrackName: meta.catalogTrackName },
|
|
@@ -21194,6 +21267,8 @@ var MmtpRouter = class {
|
|
|
21194
21267
|
) ?? "unknown";
|
|
21195
21268
|
for (const sym of result.symbols) {
|
|
21196
21269
|
this.#routeTrackPacket(sym.rawSymbol, ownerPacketId, sym.packetSequenceNumber, {
|
|
21270
|
+
mmtpTimestamp: sym.fragment.timestamp,
|
|
21271
|
+
rap: sym.fragment.rapFlag,
|
|
21197
21272
|
recovered: true,
|
|
21198
21273
|
skipFecPayloadId: true,
|
|
21199
21274
|
catalogTrackName,
|
|
@@ -22009,7 +22084,7 @@ function sameIds(a, b) {
|
|
|
22009
22084
|
for (const id of a) if (!b.has(id)) return false;
|
|
22010
22085
|
return true;
|
|
22011
22086
|
}
|
|
22012
|
-
var MulticastTransport = class
|
|
22087
|
+
var MulticastTransport = class {
|
|
22013
22088
|
#onPacket;
|
|
22014
22089
|
#subscription = null;
|
|
22015
22090
|
#packetListener = null;
|
|
@@ -22081,8 +22156,11 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
22081
22156
|
// droppedPacketIds.
|
|
22082
22157
|
#unadvertisedPacketIds = /* @__PURE__ */ new Set();
|
|
22083
22158
|
#joinGeneration = 0;
|
|
22084
|
-
|
|
22159
|
+
// The provider to subscribe through; window.multicast when unset.
|
|
22160
|
+
#gateway;
|
|
22161
|
+
constructor(onPacket, options = {}) {
|
|
22085
22162
|
this.#onPacket = onPacket;
|
|
22163
|
+
this.#gateway = options.gateway;
|
|
22086
22164
|
}
|
|
22087
22165
|
static isAvailable() {
|
|
22088
22166
|
return hasMulticastGateway();
|
|
@@ -22092,7 +22170,8 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
22092
22170
|
this.#releaseSubscription();
|
|
22093
22171
|
this.#dataPlaneLive = false;
|
|
22094
22172
|
if (this.#disposed) return this.#declined(generation, "disposed");
|
|
22095
|
-
|
|
22173
|
+
const gateway = this.#gateway ?? getMulticastGlobals().multicast;
|
|
22174
|
+
if (typeof gateway?.subscribe !== "function") {
|
|
22096
22175
|
console.warn("[MulticastTransport] Multicast API not available");
|
|
22097
22176
|
return this.#declined(generation, "unavailable");
|
|
22098
22177
|
}
|
|
@@ -22113,7 +22192,7 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
22113
22192
|
tracks: config.tracks
|
|
22114
22193
|
});
|
|
22115
22194
|
failure = "provider-rejected";
|
|
22116
|
-
const subscription = await
|
|
22195
|
+
const subscription = await gateway.subscribe(subscribeConfig);
|
|
22117
22196
|
failure = "invalid-subscription";
|
|
22118
22197
|
console.log(`[MulticastTransport] window.multicast.subscribe returned:`, !!subscription);
|
|
22119
22198
|
if (this.#disposed || generation !== this.#joinGeneration) {
|
|
@@ -22769,28 +22848,28 @@ function joinedRepairSymbolCount(params, joinedRepairTrackNames) {
|
|
|
22769
22848
|
}
|
|
22770
22849
|
return total;
|
|
22771
22850
|
}
|
|
22772
|
-
function
|
|
22851
|
+
function recordOf3(value) {
|
|
22773
22852
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
22774
22853
|
}
|
|
22775
22854
|
function msfTracks(catalog) {
|
|
22776
22855
|
const raw = catalog.tracks;
|
|
22777
22856
|
if (!Array.isArray(raw)) return void 0;
|
|
22778
|
-
return { tracks: raw.map((t) =>
|
|
22857
|
+
return { tracks: raw.map((t) => recordOf3(t) ?? {}) };
|
|
22779
22858
|
}
|
|
22780
22859
|
function resolveRepairLayers(catalog, source) {
|
|
22781
22860
|
if (!catalog) return void 0;
|
|
22782
22861
|
const sourceName = typeof source === "string" ? source : source.name;
|
|
22783
22862
|
const hang = catalog;
|
|
22784
22863
|
const roles = typeof source === "string" ? ["video", "audio"] : source.type === "audio" ? ["audio"] : source.type === "video" ? ["video"] : ["video", "audio"];
|
|
22785
|
-
const
|
|
22786
|
-
if (
|
|
22787
|
-
const renditionPath = `$.${role}.renditions[${JSON.stringify(sourceName)}]`;
|
|
22788
|
-
const rendition =
|
|
22864
|
+
const located = locateCatalogFecSource(catalog, sourceName, roles);
|
|
22865
|
+
if (located?.dialect === "hang") {
|
|
22866
|
+
const renditionPath = `$.${located.role}.renditions[${JSON.stringify(sourceName)}]`;
|
|
22867
|
+
const rendition = located.entry;
|
|
22789
22868
|
rejectRepairFieldsOnMediaTrack(renditionPath, rendition, throwRepairContractError);
|
|
22790
|
-
const repairRenditions =
|
|
22869
|
+
const repairRenditions = recordOf3(hang.repair?.renditions) ?? {};
|
|
22791
22870
|
const descriptors2 = Object.entries(repairRenditions).map(([name, entry]) => {
|
|
22792
22871
|
const path = `$.repair.renditions[${JSON.stringify(name)}]`;
|
|
22793
|
-
const fields =
|
|
22872
|
+
const fields = recordOf3(entry);
|
|
22794
22873
|
if (fields === void 0) {
|
|
22795
22874
|
throwRepairContractError("track_repair_layer", path, "a repair rendition must be an object");
|
|
22796
22875
|
}
|
|
@@ -22798,14 +22877,14 @@ function resolveRepairLayers(catalog, source) {
|
|
|
22798
22877
|
return describeRepairTrack(name, path, fields);
|
|
22799
22878
|
});
|
|
22800
22879
|
const fecOfRendition = (entry) => {
|
|
22801
|
-
const fec2 =
|
|
22880
|
+
const fec2 = recordOf3(recordOf3(entry)?.["fec"]);
|
|
22802
22881
|
return fec2 !== void 0 && fec2["algorithm"] !== "none" ? fec2 : void 0;
|
|
22803
22882
|
};
|
|
22804
22883
|
const mediaRenditions = [
|
|
22805
|
-
...Object.values(
|
|
22806
|
-
...Object.values(
|
|
22884
|
+
...Object.values(recordOf3(hang.video?.renditions) ?? {}),
|
|
22885
|
+
...Object.values(recordOf3(hang.audio?.renditions) ?? {})
|
|
22807
22886
|
];
|
|
22808
|
-
const reachability2 = repairReachability(mediaRenditions.map((entry) =>
|
|
22887
|
+
const reachability2 = repairReachability(mediaRenditions.map((entry) => recordOf3(entry)?.["fec"]));
|
|
22809
22888
|
for (const d of descriptors2) {
|
|
22810
22889
|
validateRepairTrackFields(d, throwRepairContractError);
|
|
22811
22890
|
assertRepairTrackReachable(d, reachability2, throwRepairContractError);
|
|
@@ -22821,20 +22900,20 @@ function resolveRepairLayers(catalog, source) {
|
|
|
22821
22900
|
}
|
|
22822
22901
|
}
|
|
22823
22902
|
const layers2 = assembleRepairLayers(
|
|
22824
|
-
geometryOf(sourceName, `${renditionPath}.fec`,
|
|
22903
|
+
geometryOf(sourceName, `${renditionPath}.fec`, recordOf3(rendition["fec"])),
|
|
22825
22904
|
descriptors2,
|
|
22826
22905
|
throwRepairContractError
|
|
22827
22906
|
);
|
|
22828
22907
|
return catalogFecUnavailable(rendition["fec"], `${renditionPath}.fec`) === void 0 ? layers2 : void 0;
|
|
22829
22908
|
}
|
|
22830
22909
|
const msf = msfTracks(catalog);
|
|
22831
|
-
|
|
22832
|
-
|
|
22910
|
+
if (!msf || located?.dialect !== "msf") return void 0;
|
|
22911
|
+
const msfIndex = located.index;
|
|
22833
22912
|
const track = msf.tracks[msfIndex];
|
|
22834
|
-
const fec =
|
|
22913
|
+
const fec = recordOf3(track["fec"]);
|
|
22835
22914
|
const packagingOf = (t) => t["packaging"];
|
|
22836
22915
|
const fecOfTrack = (t) => {
|
|
22837
|
-
const trackFec =
|
|
22916
|
+
const trackFec = recordOf3(t?.["fec"]);
|
|
22838
22917
|
return trackFec !== void 0 && trackFec["algorithm"] !== "none" ? trackFec : void 0;
|
|
22839
22918
|
};
|
|
22840
22919
|
const descriptors = [];
|
|
@@ -22884,8 +22963,8 @@ function catalogRepairTarget(catalog, source) {
|
|
|
22884
22963
|
const entry = msf?.tracks.find((t) => t["name"] === sourceName);
|
|
22885
22964
|
const hang = catalog;
|
|
22886
22965
|
const roles = typeof source === "string" ? ["video", "audio"] : source.type === "video" ? ["video"] : source.type === "audio" ? ["audio"] : ["video", "audio"];
|
|
22887
|
-
const rendition = roles.map((role) => hang[role]?.renditions?.[sourceName]).find((r) =>
|
|
22888
|
-
const fec = rendition === void 0 ?
|
|
22966
|
+
const rendition = roles.map((role) => hang[role]?.renditions?.[sourceName]).find((r) => recordOf3(r) !== void 0);
|
|
22967
|
+
const fec = rendition === void 0 ? recordOf3(entry?.["fec"]) : recordOf3(rendition.fec);
|
|
22889
22968
|
if (!fec || !(catalogFecInterleaveMs(fec) ?? 0)) return null;
|
|
22890
22969
|
const sourcePriority = entry === void 0 ? null : moqtPriority2(entry["priority"]);
|
|
22891
22970
|
return { repairTrack: layerZero.repairTrackName, sourcePriority, repairPriority: layerZero.priority };
|
|
@@ -22928,10 +23007,14 @@ function isoSpanUnavailable(fec, path, declaresFecInstance) {
|
|
|
22928
23007
|
});
|
|
22929
23008
|
}
|
|
22930
23009
|
function catalogFecUnavailable(fec, fecPath) {
|
|
22931
|
-
|
|
22932
|
-
|
|
23010
|
+
if (catalogFecAvailable(fec)) return void 0;
|
|
23011
|
+
const block = recordOf3(fec);
|
|
22933
23012
|
const declaresFecInstance = block["algorithm"] !== "none";
|
|
22934
|
-
|
|
23013
|
+
const reason = blockProfileUnavailable(block["blockProfile"], `${fecPath}.blockProfile`, declaresFecInstance) ?? isoSpanUnavailable(block, `${fecPath}.interleaveDepthMs`, declaresFecInstance);
|
|
23014
|
+
if (reason === void 0) {
|
|
23015
|
+
throw new Error(`catalogFecUnavailable: ${fecPath} is unavailable but no reason applies (rule drift)`);
|
|
23016
|
+
}
|
|
23017
|
+
return reason;
|
|
22935
23018
|
}
|
|
22936
23019
|
function fecParams(catalog, track, rendition, fps, sampleRate) {
|
|
22937
23020
|
const mediaRate = sampleRate === void 0 ? { fps } : { fps, sampleRate };
|
|
@@ -22940,10 +23023,8 @@ function fecParams(catalog, track, rendition, fps, sampleRate) {
|
|
|
22940
23023
|
const repair = resolveRepairLayers(catalog, track);
|
|
22941
23024
|
const fecPath = `$.${track.type}.renditions[${JSON.stringify(track.name)}].fec`;
|
|
22942
23025
|
if (!catalogDeclaresFec(fec)) {
|
|
22943
|
-
|
|
22944
|
-
|
|
22945
|
-
const tValid = Number.isSafeInteger(fec.symbolSize) && (fec.symbolSize ?? 0) > 0;
|
|
22946
|
-
if (declaresFecInstance && !(kValid && tValid)) {
|
|
23026
|
+
if (catalogFecDeclaresUnconfigurableInstance(fec)) {
|
|
23027
|
+
const kValid = Number.isSafeInteger(fec.sourceSymbols) && (fec.sourceSymbols ?? 0) > 0;
|
|
22947
23028
|
throwRepairContractError(
|
|
22948
23029
|
"track_fec",
|
|
22949
23030
|
`${fecPath}.${kValid ? "symbolSize" : "sourceSymbols"}`,
|
|
@@ -23350,6 +23431,7 @@ var MulticastManager = class {
|
|
|
23350
23431
|
#router;
|
|
23351
23432
|
#hostMfuTimeoutMs;
|
|
23352
23433
|
#transport;
|
|
23434
|
+
#repairReleases = /* @__PURE__ */ new Set();
|
|
23353
23435
|
#reportedFecDiagnosticsFailure = false;
|
|
23354
23436
|
// ── Stream-global FEC timing reduction ──
|
|
23355
23437
|
//
|
|
@@ -24002,6 +24084,63 @@ var MulticastManager = class {
|
|
|
24002
24084
|
};
|
|
24003
24085
|
return ingress === void 0 ? this.#transport.join(transportConfig) : this.#transport.join(transportConfig, ingress);
|
|
24004
24086
|
}
|
|
24087
|
+
/**
|
|
24088
|
+
* Join the selected rung's dedicated repair groups beside the media join
|
|
24089
|
+
* (pim #3898): one subscription per endpoint, through `provider` when given
|
|
24090
|
+
* (a `window.multicast`-shaped gateway or a subscribe callback), otherwise a
|
|
24091
|
+
* new MulticastTransport on `window.multicast`. Returns the call that
|
|
24092
|
+
* releases every one of them; dispose() releases them too.
|
|
24093
|
+
*
|
|
24094
|
+
* Packets go straight to the router with the endpoint's ingress, never
|
|
24095
|
+
* through feedPacket(): repair arriving on its own group is not media
|
|
24096
|
+
* liveness, so it must not hold off the media leg's failback watchdog. The
|
|
24097
|
+
* repair roles and owners are registered here; in-band owners stay the
|
|
24098
|
+
* caller's. Joining is best effort: a group that fails to join is logged
|
|
24099
|
+
* and leaves the media join as it was.
|
|
24100
|
+
*/
|
|
24101
|
+
joinRepairEndpoints(endpoints, provider) {
|
|
24102
|
+
const releases = [];
|
|
24103
|
+
let released = false;
|
|
24104
|
+
for (const endpoint of endpoints) {
|
|
24105
|
+
for (const { packetId, ownerPacketId } of endpoint.repairOwners) {
|
|
24106
|
+
this.#router.setPacketIdRole(packetId, "repair");
|
|
24107
|
+
this.#router.setRepairPacketIdOwner(packetId, ownerPacketId);
|
|
24108
|
+
}
|
|
24109
|
+
const ingress = {
|
|
24110
|
+
tracks: Object.freeze(endpoint.tracks.map(({ name, packetId }) => Object.freeze({ name, packetId })))
|
|
24111
|
+
};
|
|
24112
|
+
const onPacket = (packet) => {
|
|
24113
|
+
if (!released) this.#router.feedPacket(packet, "multicast", void 0, ingress);
|
|
24114
|
+
};
|
|
24115
|
+
const fail = (error) => console.warn(`[MulticastManager] repair group ${endpoint.group}:${endpoint.port} not joined`, error);
|
|
24116
|
+
if (typeof provider === "function") {
|
|
24117
|
+
Promise.resolve().then(() => provider(endpoint, onPacket)).then((release2) => released ? release2() : releases.push(release2), fail);
|
|
24118
|
+
continue;
|
|
24119
|
+
}
|
|
24120
|
+
const transport = new MulticastTransport((packet) => onPacket(packet), { gateway: provider });
|
|
24121
|
+
releases.push(() => transport.dispose());
|
|
24122
|
+
void transport.join({
|
|
24123
|
+
sourceAddress: endpoint.source,
|
|
24124
|
+
groupAddress: endpoint.group,
|
|
24125
|
+
port: endpoint.port,
|
|
24126
|
+
mode: endpoint.mode,
|
|
24127
|
+
amtRelay: endpoint.amtRelay,
|
|
24128
|
+
amtRelayPort: endpoint.amtRelayPort ?? (endpoint.amtRelay?.trim() ? DEFAULT_AMT_RELAY_PORT : void 0),
|
|
24129
|
+
packetIds: endpoint.packetIds,
|
|
24130
|
+
tracks: endpoint.tracks.map(({ name, packetId }) => ({ name, packetId }))
|
|
24131
|
+
}).then((joined) => {
|
|
24132
|
+
if (!joined && !released) fail(transport.lastJoinOutcome);
|
|
24133
|
+
});
|
|
24134
|
+
}
|
|
24135
|
+
const release = () => {
|
|
24136
|
+
if (released) return;
|
|
24137
|
+
released = true;
|
|
24138
|
+
this.#repairReleases.delete(release);
|
|
24139
|
+
for (const each of releases.splice(0)) each();
|
|
24140
|
+
};
|
|
24141
|
+
this.#repairReleases.add(release);
|
|
24142
|
+
return release;
|
|
24143
|
+
}
|
|
24005
24144
|
// ---------------------------------------------------------------------------
|
|
24006
24145
|
// In-place rendition switch
|
|
24007
24146
|
// ---------------------------------------------------------------------------
|
|
@@ -24745,6 +24884,7 @@ var MulticastManager = class {
|
|
|
24745
24884
|
this.#trackResetObservers.clear();
|
|
24746
24885
|
this.#repairLifecycleObservers.clear();
|
|
24747
24886
|
this.#transport.dispose();
|
|
24887
|
+
for (const release of [...this.#repairReleases]) release();
|
|
24748
24888
|
this.#router.dispose();
|
|
24749
24889
|
this.#fec.dispose();
|
|
24750
24890
|
}
|
|
@@ -26979,6 +27119,8 @@ export {
|
|
|
26979
27119
|
buildVideoInitSegment,
|
|
26980
27120
|
catalogAmtNetworkSource,
|
|
26981
27121
|
catalogDeclaresFec,
|
|
27122
|
+
catalogFecAvailable,
|
|
27123
|
+
catalogFecDeclaresUnconfigurableInstance,
|
|
26982
27124
|
catalogFecInterleaveMs,
|
|
26983
27125
|
catalogFecMediaUnitsPerSecond,
|
|
26984
27126
|
catalogFecUnavailable,
|
|
@@ -27053,6 +27195,7 @@ export {
|
|
|
27053
27195
|
isTrackTimingConfig,
|
|
27054
27196
|
joinedRepairSymbolCount,
|
|
27055
27197
|
keyframeIntervalMediaTicks,
|
|
27198
|
+
locateCatalogFecSource,
|
|
27056
27199
|
mergeOverrideIntoCmsfTracks,
|
|
27057
27200
|
mergeOverrideIntoHangRenditions,
|
|
27058
27201
|
mfuReassemblyTimeoutMs,
|