@blockcast/mmt-container 0.4.0-main.1e94b11199ea → 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 +181 -41
- 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 +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 +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.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 +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/mmtp-router.ts +26 -1
- package/src/multicast-manager.ts +96 -1
- package/src/multicast-transport.ts +11 -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();
|
|
@@ -8128,6 +8196,10 @@ var TransportManager = class {
|
|
|
8128
8196
|
pollMulticastTierSwitch() {
|
|
8129
8197
|
return this.dispatchOrchestratorCommand(this.multicastOrchestrator?.poll());
|
|
8130
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
|
+
}
|
|
8131
8203
|
/**
|
|
8132
8204
|
* Set packet callback
|
|
8133
8205
|
*/
|
|
@@ -12575,22 +12647,16 @@ var INACTIVE = Object.freeze({
|
|
|
12575
12647
|
"reliable-moq": Object.freeze({ state: "inactive", reason: "reliable-moq" }),
|
|
12576
12648
|
"no-multicast-bridge": Object.freeze({ state: "inactive", reason: "no-multicast-bridge" })
|
|
12577
12649
|
});
|
|
12578
|
-
function
|
|
12650
|
+
function recordOf2(value) {
|
|
12579
12651
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
12580
12652
|
}
|
|
12581
|
-
function
|
|
12653
|
+
function isPositiveSafeInteger2(value) {
|
|
12582
12654
|
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
12583
12655
|
}
|
|
12584
12656
|
function catalogDeclaresFec(fec) {
|
|
12585
|
-
const block =
|
|
12657
|
+
const block = recordOf2(fec);
|
|
12586
12658
|
if (block === void 0 || block["algorithm"] === "none") return false;
|
|
12587
|
-
return
|
|
12588
|
-
}
|
|
12589
|
-
function isoBlockSpanUsable(fec) {
|
|
12590
|
-
const block = recordOf(fec);
|
|
12591
|
-
if (block === void 0 || block["blockProfile"] !== "iso-ssbg1-v1") return true;
|
|
12592
|
-
const ms = block["interleaveDepthMs"];
|
|
12593
|
-
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);
|
|
12594
12660
|
}
|
|
12595
12661
|
function requireBoolean(value, field) {
|
|
12596
12662
|
if (typeof value !== "boolean") {
|
|
@@ -12606,7 +12672,7 @@ function resolveFecState(evidence) {
|
|
|
12606
12672
|
if (typeof transportPolicy !== "string" || !TRANSPORT_POLICIES.has(transportPolicy)) {
|
|
12607
12673
|
throw new TypeError(`resolveFecState: unsupported transportPolicy ${JSON.stringify(transportPolicy)}`);
|
|
12608
12674
|
}
|
|
12609
|
-
if (stats !== null && stats !== void 0 &&
|
|
12675
|
+
if (stats !== null && stats !== void 0 && recordOf2(stats) === void 0) {
|
|
12610
12676
|
throw new TypeError("resolveFecState: stats must be a plain object, null or undefined");
|
|
12611
12677
|
}
|
|
12612
12678
|
if (!catalogFec) return INACTIVE["no-catalog-fec"];
|
|
@@ -20627,6 +20693,8 @@ var MmtpRouter = class {
|
|
|
20627
20693
|
catalogTrackName
|
|
20628
20694
|
);
|
|
20629
20695
|
this.#routeTrackPacket(packet, info.packetId, info.sequenceNumber, {
|
|
20696
|
+
mmtpTimestamp: parsed.header.timestamp,
|
|
20697
|
+
rap: info.rapFlag,
|
|
20630
20698
|
recovered: false,
|
|
20631
20699
|
skipFecPayloadId: false,
|
|
20632
20700
|
catalogTrackName
|
|
@@ -20814,6 +20882,8 @@ var MmtpRouter = class {
|
|
|
20814
20882
|
callback(packet, {
|
|
20815
20883
|
packetId,
|
|
20816
20884
|
packetSequenceNumber,
|
|
20885
|
+
mmtpTimestamp: meta.mmtpTimestamp,
|
|
20886
|
+
rap: meta.rap,
|
|
20817
20887
|
recovered: meta.recovered,
|
|
20818
20888
|
skipFecPayloadId: meta.skipFecPayloadId,
|
|
20819
20889
|
...meta.catalogTrackName === void 0 ? {} : { catalogTrackName: meta.catalogTrackName },
|
|
@@ -21197,6 +21267,8 @@ var MmtpRouter = class {
|
|
|
21197
21267
|
) ?? "unknown";
|
|
21198
21268
|
for (const sym of result.symbols) {
|
|
21199
21269
|
this.#routeTrackPacket(sym.rawSymbol, ownerPacketId, sym.packetSequenceNumber, {
|
|
21270
|
+
mmtpTimestamp: sym.fragment.timestamp,
|
|
21271
|
+
rap: sym.fragment.rapFlag,
|
|
21200
21272
|
recovered: true,
|
|
21201
21273
|
skipFecPayloadId: true,
|
|
21202
21274
|
catalogTrackName,
|
|
@@ -22012,7 +22084,7 @@ function sameIds(a, b) {
|
|
|
22012
22084
|
for (const id of a) if (!b.has(id)) return false;
|
|
22013
22085
|
return true;
|
|
22014
22086
|
}
|
|
22015
|
-
var MulticastTransport = class
|
|
22087
|
+
var MulticastTransport = class {
|
|
22016
22088
|
#onPacket;
|
|
22017
22089
|
#subscription = null;
|
|
22018
22090
|
#packetListener = null;
|
|
@@ -22084,8 +22156,11 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
22084
22156
|
// droppedPacketIds.
|
|
22085
22157
|
#unadvertisedPacketIds = /* @__PURE__ */ new Set();
|
|
22086
22158
|
#joinGeneration = 0;
|
|
22087
|
-
|
|
22159
|
+
// The provider to subscribe through; window.multicast when unset.
|
|
22160
|
+
#gateway;
|
|
22161
|
+
constructor(onPacket, options = {}) {
|
|
22088
22162
|
this.#onPacket = onPacket;
|
|
22163
|
+
this.#gateway = options.gateway;
|
|
22089
22164
|
}
|
|
22090
22165
|
static isAvailable() {
|
|
22091
22166
|
return hasMulticastGateway();
|
|
@@ -22095,7 +22170,8 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
22095
22170
|
this.#releaseSubscription();
|
|
22096
22171
|
this.#dataPlaneLive = false;
|
|
22097
22172
|
if (this.#disposed) return this.#declined(generation, "disposed");
|
|
22098
|
-
|
|
22173
|
+
const gateway = this.#gateway ?? getMulticastGlobals().multicast;
|
|
22174
|
+
if (typeof gateway?.subscribe !== "function") {
|
|
22099
22175
|
console.warn("[MulticastTransport] Multicast API not available");
|
|
22100
22176
|
return this.#declined(generation, "unavailable");
|
|
22101
22177
|
}
|
|
@@ -22116,7 +22192,7 @@ var MulticastTransport = class _MulticastTransport {
|
|
|
22116
22192
|
tracks: config.tracks
|
|
22117
22193
|
});
|
|
22118
22194
|
failure = "provider-rejected";
|
|
22119
|
-
const subscription = await
|
|
22195
|
+
const subscription = await gateway.subscribe(subscribeConfig);
|
|
22120
22196
|
failure = "invalid-subscription";
|
|
22121
22197
|
console.log(`[MulticastTransport] window.multicast.subscribe returned:`, !!subscription);
|
|
22122
22198
|
if (this.#disposed || generation !== this.#joinGeneration) {
|
|
@@ -22772,28 +22848,28 @@ function joinedRepairSymbolCount(params, joinedRepairTrackNames) {
|
|
|
22772
22848
|
}
|
|
22773
22849
|
return total;
|
|
22774
22850
|
}
|
|
22775
|
-
function
|
|
22851
|
+
function recordOf3(value) {
|
|
22776
22852
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
22777
22853
|
}
|
|
22778
22854
|
function msfTracks(catalog) {
|
|
22779
22855
|
const raw = catalog.tracks;
|
|
22780
22856
|
if (!Array.isArray(raw)) return void 0;
|
|
22781
|
-
return { tracks: raw.map((t) =>
|
|
22857
|
+
return { tracks: raw.map((t) => recordOf3(t) ?? {}) };
|
|
22782
22858
|
}
|
|
22783
22859
|
function resolveRepairLayers(catalog, source) {
|
|
22784
22860
|
if (!catalog) return void 0;
|
|
22785
22861
|
const sourceName = typeof source === "string" ? source : source.name;
|
|
22786
22862
|
const hang = catalog;
|
|
22787
22863
|
const roles = typeof source === "string" ? ["video", "audio"] : source.type === "audio" ? ["audio"] : source.type === "video" ? ["video"] : ["video", "audio"];
|
|
22788
|
-
const
|
|
22789
|
-
if (
|
|
22790
|
-
const renditionPath = `$.${role}.renditions[${JSON.stringify(sourceName)}]`;
|
|
22791
|
-
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;
|
|
22792
22868
|
rejectRepairFieldsOnMediaTrack(renditionPath, rendition, throwRepairContractError);
|
|
22793
|
-
const repairRenditions =
|
|
22869
|
+
const repairRenditions = recordOf3(hang.repair?.renditions) ?? {};
|
|
22794
22870
|
const descriptors2 = Object.entries(repairRenditions).map(([name, entry]) => {
|
|
22795
22871
|
const path = `$.repair.renditions[${JSON.stringify(name)}]`;
|
|
22796
|
-
const fields =
|
|
22872
|
+
const fields = recordOf3(entry);
|
|
22797
22873
|
if (fields === void 0) {
|
|
22798
22874
|
throwRepairContractError("track_repair_layer", path, "a repair rendition must be an object");
|
|
22799
22875
|
}
|
|
@@ -22801,14 +22877,14 @@ function resolveRepairLayers(catalog, source) {
|
|
|
22801
22877
|
return describeRepairTrack(name, path, fields);
|
|
22802
22878
|
});
|
|
22803
22879
|
const fecOfRendition = (entry) => {
|
|
22804
|
-
const fec2 =
|
|
22880
|
+
const fec2 = recordOf3(recordOf3(entry)?.["fec"]);
|
|
22805
22881
|
return fec2 !== void 0 && fec2["algorithm"] !== "none" ? fec2 : void 0;
|
|
22806
22882
|
};
|
|
22807
22883
|
const mediaRenditions = [
|
|
22808
|
-
...Object.values(
|
|
22809
|
-
...Object.values(
|
|
22884
|
+
...Object.values(recordOf3(hang.video?.renditions) ?? {}),
|
|
22885
|
+
...Object.values(recordOf3(hang.audio?.renditions) ?? {})
|
|
22810
22886
|
];
|
|
22811
|
-
const reachability2 = repairReachability(mediaRenditions.map((entry) =>
|
|
22887
|
+
const reachability2 = repairReachability(mediaRenditions.map((entry) => recordOf3(entry)?.["fec"]));
|
|
22812
22888
|
for (const d of descriptors2) {
|
|
22813
22889
|
validateRepairTrackFields(d, throwRepairContractError);
|
|
22814
22890
|
assertRepairTrackReachable(d, reachability2, throwRepairContractError);
|
|
@@ -22824,20 +22900,20 @@ function resolveRepairLayers(catalog, source) {
|
|
|
22824
22900
|
}
|
|
22825
22901
|
}
|
|
22826
22902
|
const layers2 = assembleRepairLayers(
|
|
22827
|
-
geometryOf(sourceName, `${renditionPath}.fec`,
|
|
22903
|
+
geometryOf(sourceName, `${renditionPath}.fec`, recordOf3(rendition["fec"])),
|
|
22828
22904
|
descriptors2,
|
|
22829
22905
|
throwRepairContractError
|
|
22830
22906
|
);
|
|
22831
22907
|
return catalogFecUnavailable(rendition["fec"], `${renditionPath}.fec`) === void 0 ? layers2 : void 0;
|
|
22832
22908
|
}
|
|
22833
22909
|
const msf = msfTracks(catalog);
|
|
22834
|
-
|
|
22835
|
-
|
|
22910
|
+
if (!msf || located?.dialect !== "msf") return void 0;
|
|
22911
|
+
const msfIndex = located.index;
|
|
22836
22912
|
const track = msf.tracks[msfIndex];
|
|
22837
|
-
const fec =
|
|
22913
|
+
const fec = recordOf3(track["fec"]);
|
|
22838
22914
|
const packagingOf = (t) => t["packaging"];
|
|
22839
22915
|
const fecOfTrack = (t) => {
|
|
22840
|
-
const trackFec =
|
|
22916
|
+
const trackFec = recordOf3(t?.["fec"]);
|
|
22841
22917
|
return trackFec !== void 0 && trackFec["algorithm"] !== "none" ? trackFec : void 0;
|
|
22842
22918
|
};
|
|
22843
22919
|
const descriptors = [];
|
|
@@ -22887,8 +22963,8 @@ function catalogRepairTarget(catalog, source) {
|
|
|
22887
22963
|
const entry = msf?.tracks.find((t) => t["name"] === sourceName);
|
|
22888
22964
|
const hang = catalog;
|
|
22889
22965
|
const roles = typeof source === "string" ? ["video", "audio"] : source.type === "video" ? ["video"] : source.type === "audio" ? ["audio"] : ["video", "audio"];
|
|
22890
|
-
const rendition = roles.map((role) => hang[role]?.renditions?.[sourceName]).find((r) =>
|
|
22891
|
-
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);
|
|
22892
22968
|
if (!fec || !(catalogFecInterleaveMs(fec) ?? 0)) return null;
|
|
22893
22969
|
const sourcePriority = entry === void 0 ? null : moqtPriority2(entry["priority"]);
|
|
22894
22970
|
return { repairTrack: layerZero.repairTrackName, sourcePriority, repairPriority: layerZero.priority };
|
|
@@ -22931,10 +23007,14 @@ function isoSpanUnavailable(fec, path, declaresFecInstance) {
|
|
|
22931
23007
|
});
|
|
22932
23008
|
}
|
|
22933
23009
|
function catalogFecUnavailable(fec, fecPath) {
|
|
22934
|
-
|
|
22935
|
-
|
|
23010
|
+
if (catalogFecAvailable(fec)) return void 0;
|
|
23011
|
+
const block = recordOf3(fec);
|
|
22936
23012
|
const declaresFecInstance = block["algorithm"] !== "none";
|
|
22937
|
-
|
|
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;
|
|
22938
23018
|
}
|
|
22939
23019
|
function fecParams(catalog, track, rendition, fps, sampleRate) {
|
|
22940
23020
|
const mediaRate = sampleRate === void 0 ? { fps } : { fps, sampleRate };
|
|
@@ -22943,10 +23023,8 @@ function fecParams(catalog, track, rendition, fps, sampleRate) {
|
|
|
22943
23023
|
const repair = resolveRepairLayers(catalog, track);
|
|
22944
23024
|
const fecPath = `$.${track.type}.renditions[${JSON.stringify(track.name)}].fec`;
|
|
22945
23025
|
if (!catalogDeclaresFec(fec)) {
|
|
22946
|
-
|
|
22947
|
-
|
|
22948
|
-
const tValid = Number.isSafeInteger(fec.symbolSize) && (fec.symbolSize ?? 0) > 0;
|
|
22949
|
-
if (declaresFecInstance && !(kValid && tValid)) {
|
|
23026
|
+
if (catalogFecDeclaresUnconfigurableInstance(fec)) {
|
|
23027
|
+
const kValid = Number.isSafeInteger(fec.sourceSymbols) && (fec.sourceSymbols ?? 0) > 0;
|
|
22950
23028
|
throwRepairContractError(
|
|
22951
23029
|
"track_fec",
|
|
22952
23030
|
`${fecPath}.${kValid ? "symbolSize" : "sourceSymbols"}`,
|
|
@@ -23353,6 +23431,7 @@ var MulticastManager = class {
|
|
|
23353
23431
|
#router;
|
|
23354
23432
|
#hostMfuTimeoutMs;
|
|
23355
23433
|
#transport;
|
|
23434
|
+
#repairReleases = /* @__PURE__ */ new Set();
|
|
23356
23435
|
#reportedFecDiagnosticsFailure = false;
|
|
23357
23436
|
// ── Stream-global FEC timing reduction ──
|
|
23358
23437
|
//
|
|
@@ -24005,6 +24084,63 @@ var MulticastManager = class {
|
|
|
24005
24084
|
};
|
|
24006
24085
|
return ingress === void 0 ? this.#transport.join(transportConfig) : this.#transport.join(transportConfig, ingress);
|
|
24007
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
|
+
}
|
|
24008
24144
|
// ---------------------------------------------------------------------------
|
|
24009
24145
|
// In-place rendition switch
|
|
24010
24146
|
// ---------------------------------------------------------------------------
|
|
@@ -24748,6 +24884,7 @@ var MulticastManager = class {
|
|
|
24748
24884
|
this.#trackResetObservers.clear();
|
|
24749
24885
|
this.#repairLifecycleObservers.clear();
|
|
24750
24886
|
this.#transport.dispose();
|
|
24887
|
+
for (const release of [...this.#repairReleases]) release();
|
|
24751
24888
|
this.#router.dispose();
|
|
24752
24889
|
this.#fec.dispose();
|
|
24753
24890
|
}
|
|
@@ -26982,6 +27119,8 @@ export {
|
|
|
26982
27119
|
buildVideoInitSegment,
|
|
26983
27120
|
catalogAmtNetworkSource,
|
|
26984
27121
|
catalogDeclaresFec,
|
|
27122
|
+
catalogFecAvailable,
|
|
27123
|
+
catalogFecDeclaresUnconfigurableInstance,
|
|
26985
27124
|
catalogFecInterleaveMs,
|
|
26986
27125
|
catalogFecMediaUnitsPerSecond,
|
|
26987
27126
|
catalogFecUnavailable,
|
|
@@ -27056,6 +27195,7 @@ export {
|
|
|
27056
27195
|
isTrackTimingConfig,
|
|
27057
27196
|
joinedRepairSymbolCount,
|
|
27058
27197
|
keyframeIntervalMediaTicks,
|
|
27198
|
+
locateCatalogFecSource,
|
|
27059
27199
|
mergeOverrideIntoCmsfTracks,
|
|
27060
27200
|
mergeOverrideIntoHangRenditions,
|
|
27061
27201
|
mfuReassemblyTimeoutMs,
|