@blockcast/mmt-container 0.4.0-main.66aaafd6f03d → 0.4.0-main.726ce14f2b17
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 +108 -37
- 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.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.js +35 -11
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.js +10 -0
- 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/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"];
|
|
@@ -22778,28 +22844,28 @@ function joinedRepairSymbolCount(params, joinedRepairTrackNames) {
|
|
|
22778
22844
|
}
|
|
22779
22845
|
return total;
|
|
22780
22846
|
}
|
|
22781
|
-
function
|
|
22847
|
+
function recordOf3(value) {
|
|
22782
22848
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
22783
22849
|
}
|
|
22784
22850
|
function msfTracks(catalog) {
|
|
22785
22851
|
const raw = catalog.tracks;
|
|
22786
22852
|
if (!Array.isArray(raw)) return void 0;
|
|
22787
|
-
return { tracks: raw.map((t) =>
|
|
22853
|
+
return { tracks: raw.map((t) => recordOf3(t) ?? {}) };
|
|
22788
22854
|
}
|
|
22789
22855
|
function resolveRepairLayers(catalog, source) {
|
|
22790
22856
|
if (!catalog) return void 0;
|
|
22791
22857
|
const sourceName = typeof source === "string" ? source : source.name;
|
|
22792
22858
|
const hang = catalog;
|
|
22793
22859
|
const roles = typeof source === "string" ? ["video", "audio"] : source.type === "audio" ? ["audio"] : source.type === "video" ? ["video"] : ["video", "audio"];
|
|
22794
|
-
const
|
|
22795
|
-
if (
|
|
22796
|
-
const renditionPath = `$.${role}.renditions[${JSON.stringify(sourceName)}]`;
|
|
22797
|
-
const rendition =
|
|
22860
|
+
const located = locateCatalogFecSource(catalog, sourceName, roles);
|
|
22861
|
+
if (located?.dialect === "hang") {
|
|
22862
|
+
const renditionPath = `$.${located.role}.renditions[${JSON.stringify(sourceName)}]`;
|
|
22863
|
+
const rendition = located.entry;
|
|
22798
22864
|
rejectRepairFieldsOnMediaTrack(renditionPath, rendition, throwRepairContractError);
|
|
22799
|
-
const repairRenditions =
|
|
22865
|
+
const repairRenditions = recordOf3(hang.repair?.renditions) ?? {};
|
|
22800
22866
|
const descriptors2 = Object.entries(repairRenditions).map(([name, entry]) => {
|
|
22801
22867
|
const path = `$.repair.renditions[${JSON.stringify(name)}]`;
|
|
22802
|
-
const fields =
|
|
22868
|
+
const fields = recordOf3(entry);
|
|
22803
22869
|
if (fields === void 0) {
|
|
22804
22870
|
throwRepairContractError("track_repair_layer", path, "a repair rendition must be an object");
|
|
22805
22871
|
}
|
|
@@ -22807,14 +22873,14 @@ function resolveRepairLayers(catalog, source) {
|
|
|
22807
22873
|
return describeRepairTrack(name, path, fields);
|
|
22808
22874
|
});
|
|
22809
22875
|
const fecOfRendition = (entry) => {
|
|
22810
|
-
const fec2 =
|
|
22876
|
+
const fec2 = recordOf3(recordOf3(entry)?.["fec"]);
|
|
22811
22877
|
return fec2 !== void 0 && fec2["algorithm"] !== "none" ? fec2 : void 0;
|
|
22812
22878
|
};
|
|
22813
22879
|
const mediaRenditions = [
|
|
22814
|
-
...Object.values(
|
|
22815
|
-
...Object.values(
|
|
22880
|
+
...Object.values(recordOf3(hang.video?.renditions) ?? {}),
|
|
22881
|
+
...Object.values(recordOf3(hang.audio?.renditions) ?? {})
|
|
22816
22882
|
];
|
|
22817
|
-
const reachability2 = repairReachability(mediaRenditions.map((entry) =>
|
|
22883
|
+
const reachability2 = repairReachability(mediaRenditions.map((entry) => recordOf3(entry)?.["fec"]));
|
|
22818
22884
|
for (const d of descriptors2) {
|
|
22819
22885
|
validateRepairTrackFields(d, throwRepairContractError);
|
|
22820
22886
|
assertRepairTrackReachable(d, reachability2, throwRepairContractError);
|
|
@@ -22830,20 +22896,20 @@ function resolveRepairLayers(catalog, source) {
|
|
|
22830
22896
|
}
|
|
22831
22897
|
}
|
|
22832
22898
|
const layers2 = assembleRepairLayers(
|
|
22833
|
-
geometryOf(sourceName, `${renditionPath}.fec`,
|
|
22899
|
+
geometryOf(sourceName, `${renditionPath}.fec`, recordOf3(rendition["fec"])),
|
|
22834
22900
|
descriptors2,
|
|
22835
22901
|
throwRepairContractError
|
|
22836
22902
|
);
|
|
22837
22903
|
return catalogFecUnavailable(rendition["fec"], `${renditionPath}.fec`) === void 0 ? layers2 : void 0;
|
|
22838
22904
|
}
|
|
22839
22905
|
const msf = msfTracks(catalog);
|
|
22840
|
-
|
|
22841
|
-
|
|
22906
|
+
if (!msf || located?.dialect !== "msf") return void 0;
|
|
22907
|
+
const msfIndex = located.index;
|
|
22842
22908
|
const track = msf.tracks[msfIndex];
|
|
22843
|
-
const fec =
|
|
22909
|
+
const fec = recordOf3(track["fec"]);
|
|
22844
22910
|
const packagingOf = (t) => t["packaging"];
|
|
22845
22911
|
const fecOfTrack = (t) => {
|
|
22846
|
-
const trackFec =
|
|
22912
|
+
const trackFec = recordOf3(t?.["fec"]);
|
|
22847
22913
|
return trackFec !== void 0 && trackFec["algorithm"] !== "none" ? trackFec : void 0;
|
|
22848
22914
|
};
|
|
22849
22915
|
const descriptors = [];
|
|
@@ -22893,8 +22959,8 @@ function catalogRepairTarget(catalog, source) {
|
|
|
22893
22959
|
const entry = msf?.tracks.find((t) => t["name"] === sourceName);
|
|
22894
22960
|
const hang = catalog;
|
|
22895
22961
|
const roles = typeof source === "string" ? ["video", "audio"] : source.type === "video" ? ["video"] : source.type === "audio" ? ["audio"] : ["video", "audio"];
|
|
22896
|
-
const rendition = roles.map((role) => hang[role]?.renditions?.[sourceName]).find((r) =>
|
|
22897
|
-
const fec = rendition === void 0 ?
|
|
22962
|
+
const rendition = roles.map((role) => hang[role]?.renditions?.[sourceName]).find((r) => recordOf3(r) !== void 0);
|
|
22963
|
+
const fec = rendition === void 0 ? recordOf3(entry?.["fec"]) : recordOf3(rendition.fec);
|
|
22898
22964
|
if (!fec || !(catalogFecInterleaveMs(fec) ?? 0)) return null;
|
|
22899
22965
|
const sourcePriority = entry === void 0 ? null : moqtPriority2(entry["priority"]);
|
|
22900
22966
|
return { repairTrack: layerZero.repairTrackName, sourcePriority, repairPriority: layerZero.priority };
|
|
@@ -22937,10 +23003,14 @@ function isoSpanUnavailable(fec, path, declaresFecInstance) {
|
|
|
22937
23003
|
});
|
|
22938
23004
|
}
|
|
22939
23005
|
function catalogFecUnavailable(fec, fecPath) {
|
|
22940
|
-
|
|
22941
|
-
|
|
23006
|
+
if (catalogFecAvailable(fec)) return void 0;
|
|
23007
|
+
const block = recordOf3(fec);
|
|
22942
23008
|
const declaresFecInstance = block["algorithm"] !== "none";
|
|
22943
|
-
|
|
23009
|
+
const reason = blockProfileUnavailable(block["blockProfile"], `${fecPath}.blockProfile`, declaresFecInstance) ?? isoSpanUnavailable(block, `${fecPath}.interleaveDepthMs`, declaresFecInstance);
|
|
23010
|
+
if (reason === void 0) {
|
|
23011
|
+
throw new Error(`catalogFecUnavailable: ${fecPath} is unavailable but no reason applies (rule drift)`);
|
|
23012
|
+
}
|
|
23013
|
+
return reason;
|
|
22944
23014
|
}
|
|
22945
23015
|
function fecParams(catalog, track, rendition, fps, sampleRate) {
|
|
22946
23016
|
const mediaRate = sampleRate === void 0 ? { fps } : { fps, sampleRate };
|
|
@@ -22949,10 +23019,8 @@ function fecParams(catalog, track, rendition, fps, sampleRate) {
|
|
|
22949
23019
|
const repair = resolveRepairLayers(catalog, track);
|
|
22950
23020
|
const fecPath = `$.${track.type}.renditions[${JSON.stringify(track.name)}].fec`;
|
|
22951
23021
|
if (!catalogDeclaresFec(fec)) {
|
|
22952
|
-
|
|
22953
|
-
|
|
22954
|
-
const tValid = Number.isSafeInteger(fec.symbolSize) && (fec.symbolSize ?? 0) > 0;
|
|
22955
|
-
if (declaresFecInstance && !(kValid && tValid)) {
|
|
23022
|
+
if (catalogFecDeclaresUnconfigurableInstance(fec)) {
|
|
23023
|
+
const kValid = Number.isSafeInteger(fec.sourceSymbols) && (fec.sourceSymbols ?? 0) > 0;
|
|
22956
23024
|
throwRepairContractError(
|
|
22957
23025
|
"track_fec",
|
|
22958
23026
|
`${fecPath}.${kValid ? "symbolSize" : "sourceSymbols"}`,
|
|
@@ -26988,6 +27056,8 @@ export {
|
|
|
26988
27056
|
buildVideoInitSegment,
|
|
26989
27057
|
catalogAmtNetworkSource,
|
|
26990
27058
|
catalogDeclaresFec,
|
|
27059
|
+
catalogFecAvailable,
|
|
27060
|
+
catalogFecDeclaresUnconfigurableInstance,
|
|
26991
27061
|
catalogFecInterleaveMs,
|
|
26992
27062
|
catalogFecMediaUnitsPerSecond,
|
|
26993
27063
|
catalogFecUnavailable,
|
|
@@ -27062,6 +27132,7 @@ export {
|
|
|
27062
27132
|
isTrackTimingConfig,
|
|
27063
27133
|
joinedRepairSymbolCount,
|
|
27064
27134
|
keyframeIntervalMediaTicks,
|
|
27135
|
+
locateCatalogFecSource,
|
|
27065
27136
|
mergeOverrideIntoCmsfTracks,
|
|
27066
27137
|
mergeOverrideIntoHangRenditions,
|
|
27067
27138
|
mfuReassemblyTimeoutMs,
|