@blockcast/mmt-container 0.4.0-main.81e28ca1c5f5 → 0.4.0-main.97952953ccbb
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 +203 -42
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.js +3 -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 +22 -1
- 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 +16 -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.js +3 -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 +49 -0
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +130 -16
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +6 -2
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +31 -5
- 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 +16 -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/catalog-fec-params.ts +38 -17
- package/src/fec-state.ts +4 -9
- package/src/index.ts +5 -0
- package/src/multicast-manager.ts +120 -1
- package/src/multicast-transport.ts +14 -3
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;
|
|
@@ -6926,6 +6991,9 @@ var FEC_BLOCK_PROFILES2 = Object.freeze([
|
|
|
6926
6991
|
"iso-ssbg1-v1"
|
|
6927
6992
|
]);
|
|
6928
6993
|
|
|
6994
|
+
// node_modules/@blockcast/mmt-base/dist/catalog-fec-source.js
|
|
6995
|
+
var ALL_ROLES2 = Object.freeze(["video", "audio"]);
|
|
6996
|
+
|
|
6929
6997
|
// node_modules/@blockcast/mmt-transport/dist/driad-discovery.js
|
|
6930
6998
|
var DRIADDiscovery = class {
|
|
6931
6999
|
cache = /* @__PURE__ */ new Map();
|
|
@@ -7507,7 +7575,8 @@ function toWindowMulticastSubscribeConfig(input) {
|
|
|
7507
7575
|
...input.packetIds?.length ? { packetIds: [...input.packetIds] } : {}
|
|
7508
7576
|
};
|
|
7509
7577
|
const relay = input.amtRelay?.trim();
|
|
7510
|
-
const
|
|
7578
|
+
const driad = !relay && input.amtDiscovery === "driad";
|
|
7579
|
+
const wantsAmt = input.mode === "tunnel" || input.mode !== "native" && (relay !== void 0 && relay !== "" || driad);
|
|
7511
7580
|
if (!wantsAmt) {
|
|
7512
7581
|
const native = {
|
|
7513
7582
|
...base,
|
|
@@ -7517,6 +7586,20 @@ function toWindowMulticastSubscribeConfig(input) {
|
|
|
7517
7586
|
return native;
|
|
7518
7587
|
}
|
|
7519
7588
|
const relayPort = input.amtRelayPort;
|
|
7589
|
+
if (driad) {
|
|
7590
|
+
if (!base.source)
|
|
7591
|
+
throw new TypeError("AMT DRIAD discovery requires a source address");
|
|
7592
|
+
if (relayPort !== void 0 && !isPositivePort(relayPort)) {
|
|
7593
|
+
throw new TypeError("AMT DRIAD discovery requires a valid relay port when one is given");
|
|
7594
|
+
}
|
|
7595
|
+
return {
|
|
7596
|
+
...base,
|
|
7597
|
+
source: base.source,
|
|
7598
|
+
origin: "amt",
|
|
7599
|
+
discovery: "driad",
|
|
7600
|
+
...relayPort !== void 0 ? { relayPort } : {}
|
|
7601
|
+
};
|
|
7602
|
+
}
|
|
7520
7603
|
if (!relay || relayPort === void 0 || !isPositivePort(relayPort)) {
|
|
7521
7604
|
throw new TypeError("AMT requires a resolved relay and a valid relay port");
|
|
7522
7605
|
}
|
|
@@ -12579,22 +12662,16 @@ var INACTIVE = Object.freeze({
|
|
|
12579
12662
|
"reliable-moq": Object.freeze({ state: "inactive", reason: "reliable-moq" }),
|
|
12580
12663
|
"no-multicast-bridge": Object.freeze({ state: "inactive", reason: "no-multicast-bridge" })
|
|
12581
12664
|
});
|
|
12582
|
-
function
|
|
12665
|
+
function recordOf2(value) {
|
|
12583
12666
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
12584
12667
|
}
|
|
12585
|
-
function
|
|
12668
|
+
function isPositiveSafeInteger2(value) {
|
|
12586
12669
|
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
12587
12670
|
}
|
|
12588
12671
|
function catalogDeclaresFec(fec) {
|
|
12589
|
-
const block =
|
|
12672
|
+
const block = recordOf2(fec);
|
|
12590
12673
|
if (block === void 0 || block["algorithm"] === "none") return false;
|
|
12591
|
-
return
|
|
12592
|
-
}
|
|
12593
|
-
function isoBlockSpanUsable(fec) {
|
|
12594
|
-
const block = recordOf(fec);
|
|
12595
|
-
if (block === void 0 || block["blockProfile"] !== "iso-ssbg1-v1") return true;
|
|
12596
|
-
const ms = block["interleaveDepthMs"];
|
|
12597
|
-
return ms === void 0 || typeof ms === "number" && Number.isSafeInteger(ms) && ms >= 0;
|
|
12674
|
+
return isPositiveSafeInteger2(block["sourceSymbols"]) && isPositiveSafeInteger2(block["symbolSize"]) && isFecBlockProfile(block["blockProfile"]) && isoBlockSpanUsable(block);
|
|
12598
12675
|
}
|
|
12599
12676
|
function requireBoolean(value, field) {
|
|
12600
12677
|
if (typeof value !== "boolean") {
|
|
@@ -12610,7 +12687,7 @@ function resolveFecState(evidence) {
|
|
|
12610
12687
|
if (typeof transportPolicy !== "string" || !TRANSPORT_POLICIES.has(transportPolicy)) {
|
|
12611
12688
|
throw new TypeError(`resolveFecState: unsupported transportPolicy ${JSON.stringify(transportPolicy)}`);
|
|
12612
12689
|
}
|
|
12613
|
-
if (stats !== null && stats !== void 0 &&
|
|
12690
|
+
if (stats !== null && stats !== void 0 && recordOf2(stats) === void 0) {
|
|
12614
12691
|
throw new TypeError("resolveFecState: stats must be a plain object, null or undefined");
|
|
12615
12692
|
}
|
|
12616
12693
|
if (!catalogFec) return INACTIVE["no-catalog-fec"];
|
|
@@ -22022,7 +22099,7 @@ function sameIds(a, b) {
|
|
|
22022
22099
|
for (const id of a) if (!b.has(id)) return false;
|
|
22023
22100
|
return true;
|
|
22024
22101
|
}
|
|
22025
|
-
var MulticastTransport = class
|
|
22102
|
+
var MulticastTransport = class {
|
|
22026
22103
|
#onPacket;
|
|
22027
22104
|
#subscription = null;
|
|
22028
22105
|
#packetListener = null;
|
|
@@ -22094,8 +22171,11 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
22094
22171
|
// droppedPacketIds.
|
|
22095
22172
|
#unadvertisedPacketIds = /* @__PURE__ */ new Set();
|
|
22096
22173
|
#joinGeneration = 0;
|
|
22097
|
-
|
|
22174
|
+
// The provider to subscribe through; window.multicast when unset.
|
|
22175
|
+
#gateway;
|
|
22176
|
+
constructor(onPacket, options = {}) {
|
|
22098
22177
|
this.#onPacket = onPacket;
|
|
22178
|
+
this.#gateway = options.gateway;
|
|
22099
22179
|
}
|
|
22100
22180
|
static isAvailable() {
|
|
22101
22181
|
return hasMulticastGateway();
|
|
@@ -22105,7 +22185,8 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
22105
22185
|
this.#releaseSubscription();
|
|
22106
22186
|
this.#dataPlaneLive = false;
|
|
22107
22187
|
if (this.#disposed) return this.#declined(generation, "disposed");
|
|
22108
|
-
|
|
22188
|
+
const gateway = this.#gateway ?? getMulticastGlobals().multicast;
|
|
22189
|
+
if (typeof gateway?.subscribe !== "function") {
|
|
22109
22190
|
console.warn("[MulticastTransport] Multicast API not available");
|
|
22110
22191
|
return this.#declined(generation, "unavailable");
|
|
22111
22192
|
}
|
|
@@ -22122,11 +22203,12 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
22122
22203
|
mode: config.mode,
|
|
22123
22204
|
amtRelay: config.amtRelay,
|
|
22124
22205
|
amtRelayPort: config.amtRelayPort,
|
|
22206
|
+
amtDiscovery: config.amtDiscovery,
|
|
22125
22207
|
packetIds: config.packetIds,
|
|
22126
22208
|
tracks: config.tracks
|
|
22127
22209
|
});
|
|
22128
22210
|
failure = "provider-rejected";
|
|
22129
|
-
const subscription = await
|
|
22211
|
+
const subscription = await gateway.subscribe(subscribeConfig);
|
|
22130
22212
|
failure = "invalid-subscription";
|
|
22131
22213
|
console.log(`[MulticastTransport] window.multicast.subscribe returned:`, !!subscription);
|
|
22132
22214
|
if (this.#disposed || generation !== this.#joinGeneration) {
|
|
@@ -22782,28 +22864,28 @@ function joinedRepairSymbolCount(params, joinedRepairTrackNames) {
|
|
|
22782
22864
|
}
|
|
22783
22865
|
return total;
|
|
22784
22866
|
}
|
|
22785
|
-
function
|
|
22867
|
+
function recordOf3(value) {
|
|
22786
22868
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
22787
22869
|
}
|
|
22788
22870
|
function msfTracks(catalog) {
|
|
22789
22871
|
const raw = catalog.tracks;
|
|
22790
22872
|
if (!Array.isArray(raw)) return void 0;
|
|
22791
|
-
return { tracks: raw.map((t) =>
|
|
22873
|
+
return { tracks: raw.map((t) => recordOf3(t) ?? {}) };
|
|
22792
22874
|
}
|
|
22793
22875
|
function resolveRepairLayers(catalog, source) {
|
|
22794
22876
|
if (!catalog) return void 0;
|
|
22795
22877
|
const sourceName = typeof source === "string" ? source : source.name;
|
|
22796
22878
|
const hang = catalog;
|
|
22797
22879
|
const roles = typeof source === "string" ? ["video", "audio"] : source.type === "audio" ? ["audio"] : source.type === "video" ? ["video"] : ["video", "audio"];
|
|
22798
|
-
const
|
|
22799
|
-
if (
|
|
22800
|
-
const renditionPath = `$.${role}.renditions[${JSON.stringify(sourceName)}]`;
|
|
22801
|
-
const rendition =
|
|
22880
|
+
const located = locateCatalogFecSource(catalog, sourceName, roles);
|
|
22881
|
+
if (located?.dialect === "hang") {
|
|
22882
|
+
const renditionPath = `$.${located.role}.renditions[${JSON.stringify(sourceName)}]`;
|
|
22883
|
+
const rendition = located.entry;
|
|
22802
22884
|
rejectRepairFieldsOnMediaTrack(renditionPath, rendition, throwRepairContractError);
|
|
22803
|
-
const repairRenditions =
|
|
22885
|
+
const repairRenditions = recordOf3(hang.repair?.renditions) ?? {};
|
|
22804
22886
|
const descriptors2 = Object.entries(repairRenditions).map(([name, entry]) => {
|
|
22805
22887
|
const path = `$.repair.renditions[${JSON.stringify(name)}]`;
|
|
22806
|
-
const fields =
|
|
22888
|
+
const fields = recordOf3(entry);
|
|
22807
22889
|
if (fields === void 0) {
|
|
22808
22890
|
throwRepairContractError("track_repair_layer", path, "a repair rendition must be an object");
|
|
22809
22891
|
}
|
|
@@ -22811,14 +22893,14 @@ function resolveRepairLayers(catalog, source) {
|
|
|
22811
22893
|
return describeRepairTrack(name, path, fields);
|
|
22812
22894
|
});
|
|
22813
22895
|
const fecOfRendition = (entry) => {
|
|
22814
|
-
const fec2 =
|
|
22896
|
+
const fec2 = recordOf3(recordOf3(entry)?.["fec"]);
|
|
22815
22897
|
return fec2 !== void 0 && fec2["algorithm"] !== "none" ? fec2 : void 0;
|
|
22816
22898
|
};
|
|
22817
22899
|
const mediaRenditions = [
|
|
22818
|
-
...Object.values(
|
|
22819
|
-
...Object.values(
|
|
22900
|
+
...Object.values(recordOf3(hang.video?.renditions) ?? {}),
|
|
22901
|
+
...Object.values(recordOf3(hang.audio?.renditions) ?? {})
|
|
22820
22902
|
];
|
|
22821
|
-
const reachability2 = repairReachability(mediaRenditions.map((entry) =>
|
|
22903
|
+
const reachability2 = repairReachability(mediaRenditions.map((entry) => recordOf3(entry)?.["fec"]));
|
|
22822
22904
|
for (const d of descriptors2) {
|
|
22823
22905
|
validateRepairTrackFields(d, throwRepairContractError);
|
|
22824
22906
|
assertRepairTrackReachable(d, reachability2, throwRepairContractError);
|
|
@@ -22834,20 +22916,20 @@ function resolveRepairLayers(catalog, source) {
|
|
|
22834
22916
|
}
|
|
22835
22917
|
}
|
|
22836
22918
|
const layers2 = assembleRepairLayers(
|
|
22837
|
-
geometryOf(sourceName, `${renditionPath}.fec`,
|
|
22919
|
+
geometryOf(sourceName, `${renditionPath}.fec`, recordOf3(rendition["fec"])),
|
|
22838
22920
|
descriptors2,
|
|
22839
22921
|
throwRepairContractError
|
|
22840
22922
|
);
|
|
22841
22923
|
return catalogFecUnavailable(rendition["fec"], `${renditionPath}.fec`) === void 0 ? layers2 : void 0;
|
|
22842
22924
|
}
|
|
22843
22925
|
const msf = msfTracks(catalog);
|
|
22844
|
-
|
|
22845
|
-
|
|
22926
|
+
if (!msf || located?.dialect !== "msf") return void 0;
|
|
22927
|
+
const msfIndex = located.index;
|
|
22846
22928
|
const track = msf.tracks[msfIndex];
|
|
22847
|
-
const fec =
|
|
22929
|
+
const fec = recordOf3(track["fec"]);
|
|
22848
22930
|
const packagingOf = (t) => t["packaging"];
|
|
22849
22931
|
const fecOfTrack = (t) => {
|
|
22850
|
-
const trackFec =
|
|
22932
|
+
const trackFec = recordOf3(t?.["fec"]);
|
|
22851
22933
|
return trackFec !== void 0 && trackFec["algorithm"] !== "none" ? trackFec : void 0;
|
|
22852
22934
|
};
|
|
22853
22935
|
const descriptors = [];
|
|
@@ -22897,8 +22979,8 @@ function catalogRepairTarget(catalog, source) {
|
|
|
22897
22979
|
const entry = msf?.tracks.find((t) => t["name"] === sourceName);
|
|
22898
22980
|
const hang = catalog;
|
|
22899
22981
|
const roles = typeof source === "string" ? ["video", "audio"] : source.type === "video" ? ["video"] : source.type === "audio" ? ["audio"] : ["video", "audio"];
|
|
22900
|
-
const rendition = roles.map((role) => hang[role]?.renditions?.[sourceName]).find((r) =>
|
|
22901
|
-
const fec = rendition === void 0 ?
|
|
22982
|
+
const rendition = roles.map((role) => hang[role]?.renditions?.[sourceName]).find((r) => recordOf3(r) !== void 0);
|
|
22983
|
+
const fec = rendition === void 0 ? recordOf3(entry?.["fec"]) : recordOf3(rendition.fec);
|
|
22902
22984
|
if (!fec || !(catalogFecInterleaveMs(fec) ?? 0)) return null;
|
|
22903
22985
|
const sourcePriority = entry === void 0 ? null : moqtPriority2(entry["priority"]);
|
|
22904
22986
|
return { repairTrack: layerZero.repairTrackName, sourcePriority, repairPriority: layerZero.priority };
|
|
@@ -22941,10 +23023,14 @@ function isoSpanUnavailable(fec, path, declaresFecInstance) {
|
|
|
22941
23023
|
});
|
|
22942
23024
|
}
|
|
22943
23025
|
function catalogFecUnavailable(fec, fecPath) {
|
|
22944
|
-
|
|
22945
|
-
|
|
23026
|
+
if (catalogFecAvailable(fec)) return void 0;
|
|
23027
|
+
const block = recordOf3(fec);
|
|
22946
23028
|
const declaresFecInstance = block["algorithm"] !== "none";
|
|
22947
|
-
|
|
23029
|
+
const reason = blockProfileUnavailable(block["blockProfile"], `${fecPath}.blockProfile`, declaresFecInstance) ?? isoSpanUnavailable(block, `${fecPath}.interleaveDepthMs`, declaresFecInstance);
|
|
23030
|
+
if (reason === void 0) {
|
|
23031
|
+
throw new Error(`catalogFecUnavailable: ${fecPath} is unavailable but no reason applies (rule drift)`);
|
|
23032
|
+
}
|
|
23033
|
+
return reason;
|
|
22948
23034
|
}
|
|
22949
23035
|
function fecParams(catalog, track, rendition, fps, sampleRate) {
|
|
22950
23036
|
const mediaRate = sampleRate === void 0 ? { fps } : { fps, sampleRate };
|
|
@@ -22953,10 +23039,8 @@ function fecParams(catalog, track, rendition, fps, sampleRate) {
|
|
|
22953
23039
|
const repair = resolveRepairLayers(catalog, track);
|
|
22954
23040
|
const fecPath = `$.${track.type}.renditions[${JSON.stringify(track.name)}].fec`;
|
|
22955
23041
|
if (!catalogDeclaresFec(fec)) {
|
|
22956
|
-
|
|
22957
|
-
|
|
22958
|
-
const tValid = Number.isSafeInteger(fec.symbolSize) && (fec.symbolSize ?? 0) > 0;
|
|
22959
|
-
if (declaresFecInstance && !(kValid && tValid)) {
|
|
23042
|
+
if (catalogFecDeclaresUnconfigurableInstance(fec)) {
|
|
23043
|
+
const kValid = Number.isSafeInteger(fec.sourceSymbols) && (fec.sourceSymbols ?? 0) > 0;
|
|
22960
23044
|
throwRepairContractError(
|
|
22961
23045
|
"track_fec",
|
|
22962
23046
|
`${fecPath}.${kValid ? "symbolSize" : "sourceSymbols"}`,
|
|
@@ -23363,6 +23447,9 @@ var MulticastManager = class {
|
|
|
23363
23447
|
#router;
|
|
23364
23448
|
#hostMfuTimeoutMs;
|
|
23365
23449
|
#transport;
|
|
23450
|
+
/** Live joinRepairEndpoints() releases → the repair owners they registered,
|
|
23451
|
+
* re-applied after configureMultiTrack() clears catalog-derived owners. */
|
|
23452
|
+
#repairReleases = /* @__PURE__ */ new Map();
|
|
23366
23453
|
#reportedFecDiagnosticsFailure = false;
|
|
23367
23454
|
// ── Stream-global FEC timing reduction ──
|
|
23368
23455
|
//
|
|
@@ -24010,11 +24097,80 @@ var MulticastManager = class {
|
|
|
24010
24097
|
// through whatever the relay looks like, since dropping it would be the
|
|
24011
24098
|
// worse behaviour.
|
|
24012
24099
|
amtRelayPort: config.amtRelayPort ?? config.relayPort ?? (amtRelay?.trim() ? DEFAULT_AMT_RELAY_PORT : void 0),
|
|
24100
|
+
amtDiscovery: config.amtDiscovery,
|
|
24013
24101
|
packetIds: config.packetIds,
|
|
24014
24102
|
tracks: catalogTracks?.map(({ name, packetId }) => ({ name, packetId }))
|
|
24015
24103
|
};
|
|
24016
24104
|
return ingress === void 0 ? this.#transport.join(transportConfig) : this.#transport.join(transportConfig, ingress);
|
|
24017
24105
|
}
|
|
24106
|
+
/**
|
|
24107
|
+
* Join the selected rung's dedicated repair groups beside the media join
|
|
24108
|
+
* (pim #3898): one subscription per endpoint, through `provider` when given
|
|
24109
|
+
* (a `window.multicast`-shaped gateway or a subscribe callback), otherwise a
|
|
24110
|
+
* new MulticastTransport on `window.multicast`. Returns the call that
|
|
24111
|
+
* releases every one of them; dispose() releases them too.
|
|
24112
|
+
*
|
|
24113
|
+
* Packets go straight to the router with the endpoint's ingress, never
|
|
24114
|
+
* through feedPacket(): repair arriving on its own group is not media
|
|
24115
|
+
* liveness, so it must not hold off the media leg's failback watchdog. The
|
|
24116
|
+
* repair roles and owners are registered here; in-band owners stay the
|
|
24117
|
+
* caller's. Joining is best effort: a group that fails to join is logged
|
|
24118
|
+
* and leaves the media join as it was.
|
|
24119
|
+
*/
|
|
24120
|
+
joinRepairEndpoints(endpoints, provider) {
|
|
24121
|
+
const releases = [];
|
|
24122
|
+
let released = false;
|
|
24123
|
+
const safely = (each) => {
|
|
24124
|
+
try {
|
|
24125
|
+
each();
|
|
24126
|
+
} catch (error) {
|
|
24127
|
+
console.warn("[MulticastManager] repair group release failed", error);
|
|
24128
|
+
}
|
|
24129
|
+
};
|
|
24130
|
+
const repairOwners = endpoints.flatMap((endpoint) => endpoint.repairOwners);
|
|
24131
|
+
this.#applyRepairOwners(repairOwners);
|
|
24132
|
+
for (const endpoint of endpoints) {
|
|
24133
|
+
const ingress = {
|
|
24134
|
+
tracks: Object.freeze(endpoint.tracks.map(({ name, packetId }) => Object.freeze({ name, packetId })))
|
|
24135
|
+
};
|
|
24136
|
+
const onPacket = (packet) => {
|
|
24137
|
+
if (!released) this.#router.feedPacket(packet, "multicast", void 0, ingress);
|
|
24138
|
+
};
|
|
24139
|
+
const fail = (error) => console.warn(`[MulticastManager] repair group ${endpoint.group}:${endpoint.port} not joined`, error);
|
|
24140
|
+
if (typeof provider === "function") {
|
|
24141
|
+
Promise.resolve().then(() => provider(endpoint, onPacket)).then((release2) => released ? safely(release2) : releases.push(release2), fail);
|
|
24142
|
+
continue;
|
|
24143
|
+
}
|
|
24144
|
+
const transport = new MulticastTransport((packet) => onPacket(packet), { gateway: provider });
|
|
24145
|
+
releases.push(() => transport.dispose());
|
|
24146
|
+
void transport.join({
|
|
24147
|
+
sourceAddress: endpoint.source,
|
|
24148
|
+
groupAddress: endpoint.group,
|
|
24149
|
+
port: endpoint.port,
|
|
24150
|
+
mode: endpoint.mode,
|
|
24151
|
+
amtRelay: endpoint.amtRelay,
|
|
24152
|
+
amtRelayPort: endpoint.amtRelayPort ?? (endpoint.amtRelay?.trim() ? DEFAULT_AMT_RELAY_PORT : void 0),
|
|
24153
|
+
packetIds: endpoint.packetIds,
|
|
24154
|
+
tracks: endpoint.tracks.map(({ name, packetId }) => ({ name, packetId }))
|
|
24155
|
+
}).then((joined) => {
|
|
24156
|
+
if (!joined && !released) fail(transport.lastJoinOutcome);
|
|
24157
|
+
});
|
|
24158
|
+
}
|
|
24159
|
+
const release = () => {
|
|
24160
|
+
if (released) return;
|
|
24161
|
+
released = true;
|
|
24162
|
+
this.#repairReleases.delete(release);
|
|
24163
|
+
for (const each of releases.splice(0)) safely(each);
|
|
24164
|
+
};
|
|
24165
|
+
this.#repairReleases.set(release, repairOwners);
|
|
24166
|
+
return release;
|
|
24167
|
+
}
|
|
24168
|
+
#applyRepairOwners(owners) {
|
|
24169
|
+
for (const { packetId, ownerPacketId } of owners) {
|
|
24170
|
+
this.#router.setPacketIdRole(packetId, "repair");
|
|
24171
|
+
this.#router.setRepairPacketIdOwner(packetId, ownerPacketId);
|
|
24172
|
+
}
|
|
24173
|
+
}
|
|
24018
24174
|
// ---------------------------------------------------------------------------
|
|
24019
24175
|
// In-place rendition switch
|
|
24020
24176
|
// ---------------------------------------------------------------------------
|
|
@@ -24427,6 +24583,7 @@ var MulticastManager = class {
|
|
|
24427
24583
|
this.#switchingSets.clear();
|
|
24428
24584
|
this.#repairPacketIds.clear();
|
|
24429
24585
|
this.#router.clearRepairPacketIdOwners();
|
|
24586
|
+
for (const owners of this.#repairReleases.values()) this.#applyRepairOwners(owners);
|
|
24430
24587
|
const fecPacketIds = new Set([...fecDecoders.keys()].map((i) => catalog.tracks[i].packetId));
|
|
24431
24588
|
for (const [packetId, catalogTrackName] of this.#multiTrackFecTracks) {
|
|
24432
24589
|
if (fecPacketIds.has(packetId)) continue;
|
|
@@ -24758,6 +24915,7 @@ var MulticastManager = class {
|
|
|
24758
24915
|
this.#trackResetObservers.clear();
|
|
24759
24916
|
this.#repairLifecycleObservers.clear();
|
|
24760
24917
|
this.#transport.dispose();
|
|
24918
|
+
for (const release of [...this.#repairReleases.keys()]) release();
|
|
24761
24919
|
this.#router.dispose();
|
|
24762
24920
|
this.#fec.dispose();
|
|
24763
24921
|
}
|
|
@@ -26992,6 +27150,8 @@ export {
|
|
|
26992
27150
|
buildVideoInitSegment,
|
|
26993
27151
|
catalogAmtNetworkSource,
|
|
26994
27152
|
catalogDeclaresFec,
|
|
27153
|
+
catalogFecAvailable,
|
|
27154
|
+
catalogFecDeclaresUnconfigurableInstance,
|
|
26995
27155
|
catalogFecInterleaveMs,
|
|
26996
27156
|
catalogFecMediaUnitsPerSecond,
|
|
26997
27157
|
catalogFecUnavailable,
|
|
@@ -27066,6 +27226,7 @@ export {
|
|
|
27066
27226
|
isTrackTimingConfig,
|
|
27067
27227
|
joinedRepairSymbolCount,
|
|
27068
27228
|
keyframeIntervalMediaTicks,
|
|
27229
|
+
locateCatalogFecSource,
|
|
27069
27230
|
mergeOverrideIntoCmsfTracks,
|
|
27070
27231
|
mergeOverrideIntoHangRenditions,
|
|
27071
27232
|
mfuReassemblyTimeoutMs,
|