@blockcast/mmt-container 2.2.0-main.caa271d80062 → 2.2.0-main.cac63e154194
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 +856 -146
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +40 -1
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +163 -10
- package/dist/carp-catalog.js.map +4 -4
- package/dist/catalog-fec-params.js +34 -0
- package/dist/catalog-fec-params.js.map +3 -3
- package/dist/catalog-network-source.d.ts +1 -17
- package/dist/catalog-network-source.d.ts.map +1 -1
- package/dist/catalog-network-source.js +59 -19
- package/dist/catalog-network-source.js.map +3 -3
- package/dist/datagram-leg-deadline.d.ts +138 -0
- package/dist/datagram-leg-deadline.d.ts.map +1 -0
- package/dist/datagram-leg-deadline.js +229 -0
- package/dist/datagram-leg-deadline.js.map +7 -0
- package/dist/delivery-catalog.js +68 -0
- package/dist/delivery-catalog.js.map +4 -4
- package/dist/delta-fallback-config.js +34 -0
- package/dist/delta-fallback-config.js.map +3 -3
- package/dist/fec-manager.d.ts +78 -18
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +167 -60
- package/dist/fec-manager.js.map +3 -3
- package/dist/fec-state.d.ts +17 -5
- package/dist/fec-state.d.ts.map +1 -1
- package/dist/fec-state.js +36 -0
- package/dist/fec-state.js.map +3 -3
- package/dist/fec-worker-setup.js +34 -0
- package/dist/fec-worker-setup.js.map +3 -3
- package/dist/held-layer-admission.js +34 -0
- package/dist/held-layer-admission.js.map +3 -3
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.js +34 -0
- package/dist/iso-block-locator.js.map +3 -3
- package/dist/mfu-reassembler.js +34 -0
- package/dist/mfu-reassembler.js.map +3 -3
- package/dist/mmtp-container-parser.js +34 -0
- package/dist/mmtp-container-parser.js.map +3 -3
- package/dist/mmtp-container-parser.no-modules.js +192 -32
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +34 -0
- package/dist/mmtp-decode-pipeline.js.map +3 -3
- package/dist/mmtp-fec-session.js +34 -0
- package/dist/mmtp-fec-session.js.map +3 -3
- package/dist/mmtp-mode-selection.d.ts +48 -0
- package/dist/mmtp-mode-selection.d.ts.map +1 -0
- package/dist/mmtp-mode-selection.js +79 -0
- package/dist/mmtp-mode-selection.js.map +7 -0
- package/dist/mmtp-router.d.ts +49 -4
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +182 -25
- package/dist/mmtp-router.js.map +4 -4
- package/dist/multicast-auth-catalog.js +42 -2
- package/dist/multicast-auth-catalog.js.map +3 -3
- package/dist/multicast-input.js +42 -2
- package/dist/multicast-input.js.map +3 -3
- package/dist/multicast-manager.d.ts +99 -2
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +384 -86
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.js +68 -0
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js +34 -0
- package/dist/multicast-unwrap.js.map +3 -3
- package/dist/no-modules.js +192 -32
- package/dist/no-modules.js.map +4 -4
- package/dist/phase14-catalog-override.d.ts +2 -1
- package/dist/phase14-catalog-override.d.ts.map +1 -1
- package/dist/phase14-catalog-override.js +69 -2
- package/dist/phase14-catalog-override.js.map +3 -3
- package/dist/repair-fetch.d.ts +8 -5
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +84 -7
- package/dist/repair-fetch.js.map +3 -3
- package/dist/repair-layer-subscriptions.js +34 -0
- package/dist/repair-layer-subscriptions.js.map +3 -3
- package/dist/signaling.js +34 -0
- package/dist/signaling.js.map +3 -3
- package/dist/timestamp-codec.js +34 -0
- package/dist/timestamp-codec.js.map +3 -3
- package/dist/wasm-mfu-reassembler.js +34 -0
- package/dist/wasm-mfu-reassembler.js.map +3 -3
- package/dist/wasm-mmtp-container-parser.js +34 -0
- package/dist/wasm-mmtp-container-parser.js.map +3 -3
- package/package.json +5 -5
- package/schemas/catalog.schema.json +2 -2
- package/src/carp-catalog.ts +165 -5
- package/src/catalog-network-source.ts +3 -37
- package/src/datagram-leg-deadline.ts +370 -0
- package/src/fec-manager.ts +188 -70
- package/src/fec-state.ts +21 -5
- package/src/index.ts +37 -0
- package/src/mmtp-mode-selection.ts +80 -0
- package/src/mmtp-router.ts +175 -35
- package/src/multicast-manager.ts +127 -0
- package/src/phase14-catalog-override.ts +14 -3
- package/src/repair-fetch.ts +86 -17
- package/test-vectors/catalog/README.md +36 -2
- package/test-vectors/catalog/mmtp-siblings/ambiguous-sibling.json +158 -0
- package/test-vectors/catalog/mmtp-siblings/ladder-bitrate-only.json +231 -0
- package/test-vectors/catalog/mmtp-siblings/ladder-four-rungs.json +405 -0
- package/test-vectors/catalog/mmtp-siblings/ladder-other-names.json +231 -0
- package/test-vectors/catalog/mmtp-siblings/mmtp-mode-unknown.json +143 -0
- package/test-vectors/catalog/mmtp-siblings/multicast-endpoint-lists-datagram-track.json +143 -0
- package/test-vectors/catalog/mmtp-siblings/no-sibling.json +79 -0
- package/test-vectors/catalog/mmtp-siblings/rendition-mismatch.json +143 -0
- package/test-vectors/catalog/mmtp-siblings/stream-delivery-mode.json +143 -0
- package/test-vectors/catalog/mmtp-siblings/timescale-mismatch.json +143 -0
- package/test-vectors/catalog/mmtp-siblings/valid-pair.json +142 -0
- package/test-vectors/catalog/section-codes.json +3 -3
- package/test-vectors/catalog-timing.json +742 -1
- package/test-vectors/catalog-validation.json +266 -7
- package/test-vectors/moq/mmtp-mode-selection.json +259 -0
- package/test-vectors/repair-policy-v1.json +98 -18
package/dist/browser-runtime.js
CHANGED
|
@@ -852,14 +852,14 @@ function readRepairFecPayloadIdFields(mmtpPacket, parsedHeader) {
|
|
|
852
852
|
};
|
|
853
853
|
}
|
|
854
854
|
function extractRepairFecPayloadId(mmtpPacket) {
|
|
855
|
-
const
|
|
856
|
-
if (!
|
|
855
|
+
const fields2 = readRepairFecPayloadIdFields(mmtpPacket);
|
|
856
|
+
if (!fields2)
|
|
857
857
|
return null;
|
|
858
858
|
return {
|
|
859
|
-
ssStart:
|
|
860
|
-
rsbLength:
|
|
861
|
-
rsId:
|
|
862
|
-
ssbLength:
|
|
859
|
+
ssStart: fields2.ssStart,
|
|
860
|
+
rsbLength: fields2.rsbLength,
|
|
861
|
+
rsId: fields2.rsId,
|
|
862
|
+
ssbLength: fields2.ssbLength
|
|
863
863
|
};
|
|
864
864
|
}
|
|
865
865
|
function parseMoqRepairFrame(frame) {
|
|
@@ -1028,11 +1028,11 @@ function isoBlocksBehindLowerBound(a, b, kMax) {
|
|
|
1028
1028
|
var DEC_OCTET = /^(?:0|[1-9]\d{0,2})$/;
|
|
1029
1029
|
var H16 = /^[0-9A-Fa-f]{1,4}$/;
|
|
1030
1030
|
function parseIpv4(text2) {
|
|
1031
|
-
const
|
|
1032
|
-
if (
|
|
1031
|
+
const fields2 = text2.split(".");
|
|
1032
|
+
if (fields2.length !== 4)
|
|
1033
1033
|
return void 0;
|
|
1034
1034
|
const octets = [];
|
|
1035
|
-
for (const field of
|
|
1035
|
+
for (const field of fields2) {
|
|
1036
1036
|
if (!DEC_OCTET.test(field))
|
|
1037
1037
|
return void 0;
|
|
1038
1038
|
const value = Number(field);
|
|
@@ -1266,9 +1266,12 @@ function multicastCatalogIssues(catalog, options = {}) {
|
|
|
1266
1266
|
return issues;
|
|
1267
1267
|
const tracks = Array.isArray(catalog["tracks"]) ? catalog["tracks"] : [];
|
|
1268
1268
|
const namespaceOf = /* @__PURE__ */ new Map();
|
|
1269
|
+
const modeOf = /* @__PURE__ */ new Map();
|
|
1269
1270
|
for (const track of tracks) {
|
|
1270
|
-
if (isObject(track)
|
|
1271
|
-
|
|
1271
|
+
if (!isObject(track) || typeof track["name"] !== "string")
|
|
1272
|
+
continue;
|
|
1273
|
+
namespaceOf.set(track["name"], track["namespace"]);
|
|
1274
|
+
modeOf.set(track["name"], track["mmtpMode"]);
|
|
1272
1275
|
}
|
|
1273
1276
|
const tagged = catalog[CATALOG_NAMESPACE];
|
|
1274
1277
|
let referenceNamespace = options.catalogNamespace ?? (typeof tagged === "string" ? tagged : void 0);
|
|
@@ -1338,6 +1341,9 @@ function multicastCatalogIssues(catalog, options = {}) {
|
|
|
1338
1341
|
const name = isObject(ref) ? ref["name"] : ref;
|
|
1339
1342
|
if (typeof name !== "string")
|
|
1340
1343
|
continue;
|
|
1344
|
+
if (modeOf.get(name) === "mfu-datagram") {
|
|
1345
|
+
fail("multicast_track", `${at2}.tracks[${refIndex}].name`, `track ${JSON.stringify(name)} is an "mfu-datagram" track, which rides no multicast endpoint; list its "mfu" sibling (draft-ramadan-moq-mmt-02 4.3.1)`);
|
|
1346
|
+
}
|
|
1341
1347
|
const namespace = namespaceOf.get(name);
|
|
1342
1348
|
if (typeof namespace !== "string")
|
|
1343
1349
|
continue;
|
|
@@ -1368,6 +1374,23 @@ function multicastCatalogIssues(catalog, options = {}) {
|
|
|
1368
1374
|
}
|
|
1369
1375
|
return issues;
|
|
1370
1376
|
}
|
|
1377
|
+
function catalogAtsc3NetworkSource(networkSource) {
|
|
1378
|
+
const entries = Array.isArray(networkSource) ? networkSource : networkSource ? [networkSource] : [];
|
|
1379
|
+
for (const ns of entries) {
|
|
1380
|
+
if (!isObject(ns))
|
|
1381
|
+
continue;
|
|
1382
|
+
if (ns.type !== "atsc3" || !isIntegerIn(ns.frequency, 1, Number.MAX_SAFE_INTEGER))
|
|
1383
|
+
continue;
|
|
1384
|
+
const slsUri = typeof ns.slsUri === "string" ? ns.slsUri.trim() : "";
|
|
1385
|
+
return {
|
|
1386
|
+
frequency: ns.frequency,
|
|
1387
|
+
...isIntegerIn(ns.plpId, 0, 63) ? { plpId: ns.plpId } : {},
|
|
1388
|
+
...isIntegerIn(ns.serviceId, 0, 65535) ? { serviceId: ns.serviceId } : {},
|
|
1389
|
+
...slsUri ? { slsUri } : {}
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1392
|
+
return void 0;
|
|
1393
|
+
}
|
|
1371
1394
|
|
|
1372
1395
|
// ../mmt-base/dist/fec-catalog.js
|
|
1373
1396
|
var DEFAULT_SCHEMES = ["reed-solomon", "raptorq"];
|
|
@@ -1913,6 +1936,70 @@ function geometry(o, instanceId, symbolTrack) {
|
|
|
1913
1936
|
});
|
|
1914
1937
|
}
|
|
1915
1938
|
|
|
1939
|
+
// ../mmt-base/dist/mmtp-siblings.js
|
|
1940
|
+
var MMTP_MODES = Object.freeze(["mfu", "mfu-datagram"]);
|
|
1941
|
+
function isMmtpMode(value) {
|
|
1942
|
+
return typeof value === "string" && MMTP_MODES.includes(value);
|
|
1943
|
+
}
|
|
1944
|
+
var MMTP_SIBLING_HARD_FIELDS = Object.freeze([
|
|
1945
|
+
"namespace",
|
|
1946
|
+
"timescale",
|
|
1947
|
+
"presentationAnchorTicks",
|
|
1948
|
+
"groupDuration"
|
|
1949
|
+
]);
|
|
1950
|
+
var MMTP_SIBLING_RENDITION_FIELDS = Object.freeze([
|
|
1951
|
+
"codec",
|
|
1952
|
+
"width",
|
|
1953
|
+
"height",
|
|
1954
|
+
"framerate",
|
|
1955
|
+
"bitrate",
|
|
1956
|
+
"samplerate",
|
|
1957
|
+
"channelConfig",
|
|
1958
|
+
"lang"
|
|
1959
|
+
]);
|
|
1960
|
+
var MMTP_SIBLING_SOFT_FIELDS = Object.freeze([
|
|
1961
|
+
"initRef",
|
|
1962
|
+
"keyframeIntervalMs",
|
|
1963
|
+
"keyframeIntervalTicks",
|
|
1964
|
+
"isLive",
|
|
1965
|
+
"altGroup"
|
|
1966
|
+
]);
|
|
1967
|
+
function fields(track) {
|
|
1968
|
+
return track;
|
|
1969
|
+
}
|
|
1970
|
+
function groupDurationTicks(track) {
|
|
1971
|
+
const ticks = track["groupDurationTicks"];
|
|
1972
|
+
if (Number.isSafeInteger(ticks))
|
|
1973
|
+
return BigInt(ticks);
|
|
1974
|
+
const ms = track["groupDurationMs"];
|
|
1975
|
+
const timescale = track["timescale"];
|
|
1976
|
+
if (!Number.isSafeInteger(ms) || !Number.isSafeInteger(timescale))
|
|
1977
|
+
return void 0;
|
|
1978
|
+
return BigInt(ms) * BigInt(timescale) / 1000n;
|
|
1979
|
+
}
|
|
1980
|
+
function identityEqual(a, b) {
|
|
1981
|
+
return a["namespace"] === b["namespace"] && a["timescale"] === b["timescale"] && a["presentationAnchorTicks"] === b["presentationAnchorTicks"] && groupDurationTicks(a) === groupDurationTicks(b) && MMTP_SIBLING_RENDITION_FIELDS.every((field) => a[field] === b[field]);
|
|
1982
|
+
}
|
|
1983
|
+
function isMmtpTrack(track, mode) {
|
|
1984
|
+
return typeof track === "object" && track !== null && !Array.isArray(track) && fields(track)["packaging"] === "mmtp" && fields(track)["mmtpMode"] === mode;
|
|
1985
|
+
}
|
|
1986
|
+
function mmtpSiblingCandidates(tracks, datagram) {
|
|
1987
|
+
const own = fields(datagram);
|
|
1988
|
+
return tracks.filter((track) => isMmtpTrack(track, "mfu") && identityEqual(fields(track), own));
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
// ../mmt-base/dist/datagram-leg-size.js
|
|
1992
|
+
var DATAGRAM_LEG_UDP_FLOOR = 1200;
|
|
1993
|
+
var DATAGRAM_LEG_QUIC_WT_FRAMING = 48;
|
|
1994
|
+
var DATAGRAM_LEG_OBJECT_HEADER = 13;
|
|
1995
|
+
var DATAGRAM_LEG_RELAY_ROOM = 16;
|
|
1996
|
+
var DATAGRAM_LEG_REPAIR_OVERHEAD = 25;
|
|
1997
|
+
var DATAGRAM_LEG_DATAGRAM_MAX = DATAGRAM_LEG_UDP_FLOOR - DATAGRAM_LEG_QUIC_WT_FRAMING;
|
|
1998
|
+
var DATAGRAM_LEG_BODY_MAX = DATAGRAM_LEG_DATAGRAM_MAX - DATAGRAM_LEG_OBJECT_HEADER - DATAGRAM_LEG_RELAY_ROOM;
|
|
1999
|
+
function datagramLegObjectMax(symbolSize) {
|
|
2000
|
+
return DATAGRAM_LEG_OBJECT_HEADER + DATAGRAM_LEG_REPAIR_OVERHEAD + symbolSize;
|
|
2001
|
+
}
|
|
2002
|
+
|
|
1916
2003
|
// src/mfu-reassembler.ts
|
|
1917
2004
|
function fragmentProvenance(fragment) {
|
|
1918
2005
|
if (fragment.deliveryProvenance !== void 0) return fragment.deliveryProvenance;
|
|
@@ -7241,13 +7328,13 @@ function validateCmsfMmtpCatalog(value, _options = {}) {
|
|
|
7241
7328
|
}
|
|
7242
7329
|
const timescale = track["timescale"];
|
|
7243
7330
|
const groupDurationMs = track["groupDurationMs"];
|
|
7244
|
-
const
|
|
7331
|
+
const groupDurationTicks2 = track["groupDurationTicks"];
|
|
7245
7332
|
const keyframeIntervalMs = track["keyframeIntervalMs"];
|
|
7246
7333
|
const keyframeIntervalTicks = track["keyframeIntervalTicks"];
|
|
7247
7334
|
if (groupDurationMs !== void 0 && !positiveInteger2(groupDurationMs)) {
|
|
7248
7335
|
catalogError("track_group_duration_ms", `${path}.groupDurationMs`, "must be a positive integer");
|
|
7249
7336
|
}
|
|
7250
|
-
if (
|
|
7337
|
+
if (groupDurationTicks2 !== void 0 && !positiveInteger2(groupDurationTicks2)) {
|
|
7251
7338
|
catalogError("track_group_duration_ticks", `${path}.groupDurationTicks`, "must be a positive integer");
|
|
7252
7339
|
}
|
|
7253
7340
|
if (keyframeIntervalMs !== void 0 && !positiveNumber2(keyframeIntervalMs) || keyframeIntervalTicks !== void 0 && !positiveInteger2(keyframeIntervalTicks)) {
|
|
@@ -7262,20 +7349,17 @@ function validateCmsfMmtpCatalog(value, _options = {}) {
|
|
|
7262
7349
|
catalogError("track_init_ref", `${path}.initRef`, "must be a non-empty string");
|
|
7263
7350
|
}
|
|
7264
7351
|
if (packaging === "mmtp") {
|
|
7265
|
-
if (track["mmtpMode"] !== "mfu") {
|
|
7266
|
-
catalogError("track_mmtp_mode", `${path}.mmtpMode`, "must be mfu");
|
|
7267
|
-
}
|
|
7268
7352
|
if (!positiveInteger2(timescale)) {
|
|
7269
7353
|
catalogError("track_timescale", `${path}.timescale`, "must be a positive integer");
|
|
7270
7354
|
}
|
|
7271
|
-
if (groupDurationMs === void 0 &&
|
|
7355
|
+
if (groupDurationMs === void 0 && groupDurationTicks2 === void 0) {
|
|
7272
7356
|
catalogError(
|
|
7273
7357
|
"track_group_duration_ms",
|
|
7274
7358
|
path,
|
|
7275
7359
|
"groupDurationMs or groupDurationTicks must be a positive integer"
|
|
7276
7360
|
);
|
|
7277
7361
|
}
|
|
7278
|
-
if (
|
|
7362
|
+
if (groupDurationTicks2 === void 0 && BigInt(groupDurationMs) * BigInt(timescale) % 1000n !== 0n) {
|
|
7279
7363
|
catalogError("track_group_duration_exact", `${path}.groupDurationMs`, "does not resolve to an exact integer tick count");
|
|
7280
7364
|
}
|
|
7281
7365
|
}
|
|
@@ -7357,8 +7441,103 @@ function validateCmsfMmtpCatalog(value, _options = {}) {
|
|
|
7357
7441
|
}
|
|
7358
7442
|
}
|
|
7359
7443
|
validateArchive(catalog);
|
|
7444
|
+
dropRejectedMmtpTracks(catalog);
|
|
7360
7445
|
return catalog;
|
|
7361
7446
|
}
|
|
7447
|
+
function dropRejectedMmtpTracks(catalog) {
|
|
7448
|
+
const rejected = mmtpTrackIssues(catalog);
|
|
7449
|
+
if (rejected.length === 0) return;
|
|
7450
|
+
const tracks = catalog["tracks"];
|
|
7451
|
+
const rejectedIndexes = new Set(rejected.map((issue) => issue.index));
|
|
7452
|
+
const nameOf = (track) => track?.["name"];
|
|
7453
|
+
const mediaNames = new Set(tracks.filter((_, index) => !rejectedIndexes.has(index)).map(nameOf));
|
|
7454
|
+
const kept = tracks.filter((track, index) => {
|
|
7455
|
+
if (rejectedIndexes.has(index)) return false;
|
|
7456
|
+
const t = track;
|
|
7457
|
+
return !(t?.["packaging"] === "fec-repair" && typeof t["source"] === "string" && !mediaNames.has(t["source"]) && rejected.some((issue) => issue.name === t["source"]));
|
|
7458
|
+
});
|
|
7459
|
+
catalog["tracks"] = kept;
|
|
7460
|
+
const keptNames = new Set(kept.map(nameOf));
|
|
7461
|
+
const endpoints = catalog["multicast"]?.["endpoints"];
|
|
7462
|
+
if (Array.isArray(endpoints)) {
|
|
7463
|
+
for (const endpoint of endpoints) {
|
|
7464
|
+
const refs = endpoint?.["tracks"];
|
|
7465
|
+
if (!endpoint || !Array.isArray(refs)) continue;
|
|
7466
|
+
endpoint["tracks"] = refs.filter((ref) => keptNames.has(typeof ref === "object" ? nameOf(ref) : ref));
|
|
7467
|
+
}
|
|
7468
|
+
}
|
|
7469
|
+
Object.defineProperty(catalog, "rejectedTracks", { value: rejected, enumerable: false, configurable: true, writable: true });
|
|
7470
|
+
}
|
|
7471
|
+
function mmtpTrackIssues(catalog) {
|
|
7472
|
+
if (typeof catalog !== "object" || catalog === null || Array.isArray(catalog)) return [];
|
|
7473
|
+
const tracks = catalog["tracks"];
|
|
7474
|
+
if (!Array.isArray(tracks)) return [];
|
|
7475
|
+
const records = tracks.filter(
|
|
7476
|
+
(track) => typeof track === "object" && track !== null && !Array.isArray(track)
|
|
7477
|
+
);
|
|
7478
|
+
const issues = [];
|
|
7479
|
+
const streamPaths = (track) => {
|
|
7480
|
+
const name = typeof track["name"] === "string" ? track["name"] : "";
|
|
7481
|
+
return [track, ...records.filter((repair) => repair["packaging"] === "fec-repair" && repair["source"] === name)].filter((declaring) => declaring["deliveryMode"] === "stream").map((declaring) => `$.tracks[${tracks.indexOf(declaring)}]`);
|
|
7482
|
+
};
|
|
7483
|
+
const candidatesOf = /* @__PURE__ */ new Map();
|
|
7484
|
+
const mirrorsOf = /* @__PURE__ */ new Map();
|
|
7485
|
+
for (const track of records) {
|
|
7486
|
+
if (track["packaging"] !== "mmtp" || track["mmtpMode"] !== "mfu-datagram") continue;
|
|
7487
|
+
const candidates = mmtpSiblingCandidates(records, track);
|
|
7488
|
+
candidatesOf.set(track, candidates);
|
|
7489
|
+
if (candidates.length === 1 && streamPaths(track).length === 0) {
|
|
7490
|
+
mirrorsOf.set(candidates[0], [...mirrorsOf.get(candidates[0]) ?? [], track]);
|
|
7491
|
+
}
|
|
7492
|
+
}
|
|
7493
|
+
for (const track of records) {
|
|
7494
|
+
const index = tracks.indexOf(track);
|
|
7495
|
+
const path = `$.tracks[${index}]`;
|
|
7496
|
+
const name = typeof track["name"] === "string" ? track["name"] : "";
|
|
7497
|
+
if (track["packaging"] !== "mmtp") continue;
|
|
7498
|
+
const mode = track["mmtpMode"];
|
|
7499
|
+
if (!isMmtpMode(mode)) {
|
|
7500
|
+
issues.push({
|
|
7501
|
+
code: "track_mmtp_mode",
|
|
7502
|
+
path: `${path}.mmtpMode`,
|
|
7503
|
+
message: `mmtpMode must be "mfu" or "mfu-datagram", got ${JSON.stringify(mode)}; a subscriber rejects the track (draft-ramadan-moq-mmt-02 13.1)`,
|
|
7504
|
+
name,
|
|
7505
|
+
index
|
|
7506
|
+
});
|
|
7507
|
+
continue;
|
|
7508
|
+
}
|
|
7509
|
+
if (mode !== "mfu-datagram") continue;
|
|
7510
|
+
const conflict = (at2) => issues.push({
|
|
7511
|
+
code: "track_delivery_mode_conflict",
|
|
7512
|
+
path: `${at2}.deliveryMode`,
|
|
7513
|
+
message: `"mfu-datagram" track ${JSON.stringify(name)} and its repair tracks are sent as datagrams; deliveryMode "stream" would subscribe no repair (draft-ramadan-moq-mmt-02 4.3.1)`,
|
|
7514
|
+
name,
|
|
7515
|
+
index
|
|
7516
|
+
});
|
|
7517
|
+
const streams = streamPaths(track);
|
|
7518
|
+
for (const at2 of streams) conflict(at2);
|
|
7519
|
+
const candidates = candidatesOf.get(track) ?? [];
|
|
7520
|
+
const rivals = candidates.length === 1 && streams.length === 0 ? (mirrorsOf.get(candidates[0]) ?? []).filter((other) => other !== track) : [];
|
|
7521
|
+
if (rivals.length > 0) {
|
|
7522
|
+
issues.push({
|
|
7523
|
+
code: "track_mmtp_sibling",
|
|
7524
|
+
path,
|
|
7525
|
+
message: `"mfu-datagram" track ${JSON.stringify(name)} mirrors "mfu" track ${JSON.stringify(candidates[0]["name"])}, and so ${rivals.length === 1 ? "does" : "do"} ${rivals.map((rival) => JSON.stringify(rival["name"])).join(", ")}; the catalog does not say which one mirrors it, so a subscriber pairs none (draft-ramadan-moq-mmt-02 4.3.1)`,
|
|
7526
|
+
name,
|
|
7527
|
+
index
|
|
7528
|
+
});
|
|
7529
|
+
} else if (candidates.length !== 1) {
|
|
7530
|
+
issues.push({
|
|
7531
|
+
code: "track_mmtp_sibling",
|
|
7532
|
+
path,
|
|
7533
|
+
message: candidates.length === 0 ? `"mfu-datagram" track ${JSON.stringify(name)} mirrors no "mfu" track of its namespace with the same timescale, presentationAnchorTicks, group duration and rendition fields (${MMTP_SIBLING_RENDITION_FIELDS.join(", ")}), each equal or absent on both (draft-ramadan-moq-mmt-02 4.3.1, 13.1)` : `"mfu-datagram" track ${JSON.stringify(name)} could mirror ${candidates.length} "mfu" tracks (${candidates.map((c) => JSON.stringify(c["name"])).join(", ")}) that carry one description; the pair is ambiguous`,
|
|
7534
|
+
name,
|
|
7535
|
+
index
|
|
7536
|
+
});
|
|
7537
|
+
}
|
|
7538
|
+
}
|
|
7539
|
+
return issues;
|
|
7540
|
+
}
|
|
7362
7541
|
function resolveGroupDurationTicks(timing, timescale) {
|
|
7363
7542
|
if (!Number.isFinite(timescale) || !Number.isInteger(timescale) || timescale <= 0) {
|
|
7364
7543
|
throw new Error(
|
|
@@ -7674,6 +7853,40 @@ var RUNTIME_FEC_RECEIVER2 = Object.freeze({
|
|
|
7674
7853
|
overlays: true
|
|
7675
7854
|
});
|
|
7676
7855
|
|
|
7856
|
+
// node_modules/@blockcast/mmt-base/dist/mmtp-siblings.js
|
|
7857
|
+
var MMTP_MODES2 = Object.freeze(["mfu", "mfu-datagram"]);
|
|
7858
|
+
var MMTP_SIBLING_HARD_FIELDS2 = Object.freeze([
|
|
7859
|
+
"namespace",
|
|
7860
|
+
"timescale",
|
|
7861
|
+
"presentationAnchorTicks",
|
|
7862
|
+
"groupDuration"
|
|
7863
|
+
]);
|
|
7864
|
+
var MMTP_SIBLING_RENDITION_FIELDS2 = Object.freeze([
|
|
7865
|
+
"codec",
|
|
7866
|
+
"width",
|
|
7867
|
+
"height",
|
|
7868
|
+
"framerate",
|
|
7869
|
+
"bitrate",
|
|
7870
|
+
"samplerate",
|
|
7871
|
+
"channelConfig",
|
|
7872
|
+
"lang"
|
|
7873
|
+
]);
|
|
7874
|
+
var MMTP_SIBLING_SOFT_FIELDS2 = Object.freeze([
|
|
7875
|
+
"initRef",
|
|
7876
|
+
"keyframeIntervalMs",
|
|
7877
|
+
"keyframeIntervalTicks",
|
|
7878
|
+
"isLive",
|
|
7879
|
+
"altGroup"
|
|
7880
|
+
]);
|
|
7881
|
+
|
|
7882
|
+
// node_modules/@blockcast/mmt-base/dist/datagram-leg-size.js
|
|
7883
|
+
var DATAGRAM_LEG_UDP_FLOOR2 = 1200;
|
|
7884
|
+
var DATAGRAM_LEG_QUIC_WT_FRAMING2 = 48;
|
|
7885
|
+
var DATAGRAM_LEG_OBJECT_HEADER2 = 13;
|
|
7886
|
+
var DATAGRAM_LEG_RELAY_ROOM2 = 16;
|
|
7887
|
+
var DATAGRAM_LEG_DATAGRAM_MAX2 = DATAGRAM_LEG_UDP_FLOOR2 - DATAGRAM_LEG_QUIC_WT_FRAMING2;
|
|
7888
|
+
var DATAGRAM_LEG_BODY_MAX2 = DATAGRAM_LEG_DATAGRAM_MAX2 - DATAGRAM_LEG_OBJECT_HEADER2 - DATAGRAM_LEG_RELAY_ROOM2;
|
|
7889
|
+
|
|
7677
7890
|
// node_modules/@blockcast/mmt-transport/dist/multicast-orchestrator.js
|
|
7678
7891
|
var DEFAULT_DWELL_MS = 3e3;
|
|
7679
7892
|
var DEFAULT_JOIN_DEADLINE_MS = 5e3;
|
|
@@ -9843,11 +10056,15 @@ function mergeOverrideIntoCmsfTracks(tracks, override) {
|
|
|
9843
10056
|
if (ot.role !== void 0 && existing.role === void 0) existing.role = ot.role;
|
|
9844
10057
|
if (existing.packaging === "mmtp") {
|
|
9845
10058
|
const mode = existing.mmtpMode ?? ot.mmtpMode;
|
|
9846
|
-
if (mode
|
|
10059
|
+
if (mode === void 0) {
|
|
9847
10060
|
throw new Error(
|
|
9848
10061
|
`[phase14-catalog-override] track "${ot.name}" has packaging='mmtp' but no valid mmtpMode`
|
|
9849
10062
|
);
|
|
9850
10063
|
}
|
|
10064
|
+
if (!isMmtpMode(mode)) {
|
|
10065
|
+
console.warn(`[phase14-catalog-override] track "${ot.name}" has unknown mmtpMode ${JSON.stringify(mode)}; skipping the override`);
|
|
10066
|
+
continue;
|
|
10067
|
+
}
|
|
9851
10068
|
existing.mmtpMode = mode;
|
|
9852
10069
|
if (existing.timescale === void 0 && ot.timescale !== void 0) existing.timescale = ot.timescale;
|
|
9853
10070
|
if (existing.groupDurationMs === void 0 && ot.groupDurationMs !== void 0) {
|
|
@@ -9884,11 +10101,15 @@ function mergeOverrideIntoCmsfTracks(tracks, override) {
|
|
|
9884
10101
|
);
|
|
9885
10102
|
}
|
|
9886
10103
|
const mmtpMode = ot.mmtpMode;
|
|
9887
|
-
if (packaging === "mmtp" && mmtpMode
|
|
10104
|
+
if (packaging === "mmtp" && mmtpMode === void 0) {
|
|
9888
10105
|
throw new Error(
|
|
9889
10106
|
`[phase14-catalog-override] track "${ot.name}" has packaging='mmtp' but no valid mmtpMode`
|
|
9890
10107
|
);
|
|
9891
10108
|
}
|
|
10109
|
+
if (packaging === "mmtp" && !isMmtpMode(mmtpMode)) {
|
|
10110
|
+
console.warn(`[phase14-catalog-override] track "${ot.name}" has unknown mmtpMode ${JSON.stringify(mmtpMode)}; skipping the track`);
|
|
10111
|
+
continue;
|
|
10112
|
+
}
|
|
9892
10113
|
if (packaging === "mmtp" && !isPositiveInteger(ot.timescale)) {
|
|
9893
10114
|
throw new Error(
|
|
9894
10115
|
`[phase14-catalog-override] track "${ot.name}" has packaging='mmtp' but no valid timescale`
|
|
@@ -13478,6 +13699,7 @@ function resolveFecState(evidence) {
|
|
|
13478
13699
|
const catalogFec = requireBoolean(evidence.catalogFec, "catalogFec");
|
|
13479
13700
|
const bridgeAvailable = requireBoolean(evidence.bridgeAvailable, "bridgeAvailable");
|
|
13480
13701
|
const multicastLegJoined = requireBoolean(evidence.multicastLegJoined, "multicastLegJoined");
|
|
13702
|
+
const datagramLegJoined = evidence.datagramLegJoined === void 0 ? false : requireBoolean(evidence.datagramLegJoined, "datagramLegJoined");
|
|
13481
13703
|
const { transportPolicy, stats } = evidence;
|
|
13482
13704
|
if (typeof transportPolicy !== "string" || !TRANSPORT_POLICIES.has(transportPolicy)) {
|
|
13483
13705
|
throw new TypeError(`resolveFecState: unsupported transportPolicy ${JSON.stringify(transportPolicy)}`);
|
|
@@ -13486,6 +13708,7 @@ function resolveFecState(evidence) {
|
|
|
13486
13708
|
throw new TypeError("resolveFecState: stats must be a plain object, null or undefined");
|
|
13487
13709
|
}
|
|
13488
13710
|
if (!catalogFec) return INACTIVE["no-catalog-fec"];
|
|
13711
|
+
if (datagramLegJoined) return { ...stats ?? {}, state: "active" };
|
|
13489
13712
|
if (transportPolicy === "moq-only") return INACTIVE["reliable-moq"];
|
|
13490
13713
|
if (!bridgeAvailable) return INACTIVE["no-multicast-bridge"];
|
|
13491
13714
|
if (transportPolicy === "multicast-only" || multicastLegJoined) {
|
|
@@ -14241,7 +14464,12 @@ var FECManager = class _FECManager {
|
|
|
14241
14464
|
this.#repairHoldUntilMs = /* @__PURE__ */ new Map();
|
|
14242
14465
|
// Receiver-measured multicast delivery gap: the late-symbol wait's jitter
|
|
14243
14466
|
// term (see DeliveryGapEstimator for the statistic and why).
|
|
14244
|
-
|
|
14467
|
+
// One estimator per lossy path, so a hybrid session never lets one leg's
|
|
14468
|
+
// stall widen the other's wait; the wait reads the larger peak.
|
|
14469
|
+
this.#deliveryGaps = {
|
|
14470
|
+
multicast: new DeliveryGapEstimator(),
|
|
14471
|
+
"moq-datagram": new DeliveryGapEstimator()
|
|
14472
|
+
};
|
|
14245
14473
|
this.#lifecycleTrace = [];
|
|
14246
14474
|
// Worker-backed timeouts enqueue cleanup behind all prior symbol messages.
|
|
14247
14475
|
// Failure remains pending until cleanupComplete acknowledges that queue drain.
|
|
@@ -14477,6 +14705,7 @@ var FECManager = class _FECManager {
|
|
|
14477
14705
|
this.#decoderUnavailableEvents = 0;
|
|
14478
14706
|
this.#repairSymbolSizeMismatchCount = 0;
|
|
14479
14707
|
this.#unlistedRepairTrackRefusals = 0;
|
|
14708
|
+
this.#unresolvedRepairOwnerDrops = { unregistered: 0, ownerAbsent: 0, ownerAmbiguous: 0 };
|
|
14480
14709
|
// Event callbacks — block lifecycle notifications for MmtpRouter wiring.
|
|
14481
14710
|
// NOTE: For sync WASM path, recovery routing is handled by MmtpRouter from
|
|
14482
14711
|
// feedSourceSymbol/feedRepairSymbol return values. For Worker path, recovery
|
|
@@ -14654,6 +14883,7 @@ var FECManager = class _FECManager {
|
|
|
14654
14883
|
#decoderUnavailableEvents;
|
|
14655
14884
|
#repairSymbolSizeMismatchCount;
|
|
14656
14885
|
#unlistedRepairTrackRefusals;
|
|
14886
|
+
#unresolvedRepairOwnerDrops;
|
|
14657
14887
|
#onUndelimitedLoss;
|
|
14658
14888
|
#onIsoHoleExpired;
|
|
14659
14889
|
#encodeTrackName(catalogTrackName) {
|
|
@@ -15474,7 +15704,7 @@ var FECManager = class _FECManager {
|
|
|
15474
15704
|
consider(geometry2, this.#parseStreamKey(streamKey).packetId);
|
|
15475
15705
|
}
|
|
15476
15706
|
for (const [packetId, config] of this.#trackConfigs) consider(config.geometry, packetId);
|
|
15477
|
-
this.#deliveryGaps.setWindowMs(windowMs);
|
|
15707
|
+
for (const estimator of Object.values(this.#deliveryGaps)) estimator.setWindowMs(windowMs);
|
|
15478
15708
|
}
|
|
15479
15709
|
/**
|
|
15480
15710
|
* The multicast late-symbol wait: the block span plus the larger of the
|
|
@@ -15487,14 +15717,14 @@ var FECManager = class _FECManager {
|
|
|
15487
15717
|
* stream order and never feeds the estimator.
|
|
15488
15718
|
*/
|
|
15489
15719
|
#multicastWaitMs(config) {
|
|
15490
|
-
return this.#waitForGapMs(config, this.#
|
|
15720
|
+
return this.#waitForGapMs(config, this.#peakDeliveryGapMs());
|
|
15491
15721
|
}
|
|
15492
15722
|
/**
|
|
15493
15723
|
* The widest #multicastWaitMs can become: the estimator reports at most its
|
|
15494
15724
|
* catalog window, so this is a catalog quantity that no measurement moves.
|
|
15495
15725
|
*/
|
|
15496
15726
|
#maxMulticastWaitMs(config) {
|
|
15497
|
-
return this.#waitForGapMs(config, this.#deliveryGaps.windowMs ?? 0);
|
|
15727
|
+
return this.#waitForGapMs(config, this.#deliveryGaps.multicast.windowMs ?? 0);
|
|
15498
15728
|
}
|
|
15499
15729
|
#waitForGapMs(config, gapMs) {
|
|
15500
15730
|
if (!(gapMs > 0) || !(config.interleaveDepthMs > 0)) return config.timeoutMs;
|
|
@@ -15678,6 +15908,7 @@ var FECManager = class _FECManager {
|
|
|
15678
15908
|
...(config.trackKind ?? previous.trackKind) === void 0 ? {} : { trackKind: config.trackKind ?? previous.trackKind },
|
|
15679
15909
|
...(config.codec ?? previous.codec) === void 0 ? {} : { codec: config.codec ?? previous.codec },
|
|
15680
15910
|
...(config.geometry ?? previous.geometry) === void 0 ? {} : { geometry: config.geometry ?? previous.geometry },
|
|
15911
|
+
...(config.groupDurationMs ?? previous.groupDurationMs) === void 0 ? {} : { groupDurationMs: config.groupDurationMs ?? previous.groupDurationMs },
|
|
15681
15912
|
...(config.repairLayers ?? previous.repairLayers) === void 0 ? {} : { repairLayers: config.repairLayers ?? previous.repairLayers },
|
|
15682
15913
|
...(config.heldLayers ?? previous.heldLayers) === void 0 ? {} : { heldLayers: config.heldLayers ?? previous.heldLayers }
|
|
15683
15914
|
};
|
|
@@ -15784,6 +16015,10 @@ var FECManager = class _FECManager {
|
|
|
15784
16015
|
lifecycleTrace: this.#lifecycleTrace.map((entry) => ({ ...entry }))
|
|
15785
16016
|
};
|
|
15786
16017
|
}
|
|
16018
|
+
/** Count a repair packet the router dropped for want of an owning track (BLO-55759). */
|
|
16019
|
+
countUnresolvedRepairOwner(reason) {
|
|
16020
|
+
this.#unresolvedRepairOwnerDrops[reason]++;
|
|
16021
|
+
}
|
|
15787
16022
|
get fecStats() {
|
|
15788
16023
|
const s = this.#fecStats;
|
|
15789
16024
|
const affected = s.blocksRecovered + s.blocksFailed;
|
|
@@ -15824,6 +16059,7 @@ var FECManager = class _FECManager {
|
|
|
15824
16059
|
})),
|
|
15825
16060
|
repairSymbolSizeMismatches: this.#repairSymbolSizeMismatchCount,
|
|
15826
16061
|
unlistedRepairTrackRefusals: this.#unlistedRepairTrackRefusals,
|
|
16062
|
+
unresolvedRepairOwnerDrops: { ...this.#unresolvedRepairOwnerDrops },
|
|
15827
16063
|
repairObjectRejects: [...this.#repairObjectRejects.values()].map((r) => ({ ...r })),
|
|
15828
16064
|
workerErrors: Object.fromEntries(this.#workerErrorCounts)
|
|
15829
16065
|
};
|
|
@@ -15848,6 +16084,16 @@ var FECManager = class _FECManager {
|
|
|
15848
16084
|
this.#startupRepairBoundaryCounts.clear();
|
|
15849
16085
|
this.#startupRepairFailOpenPackets.clear();
|
|
15850
16086
|
}
|
|
16087
|
+
/**
|
|
16088
|
+
* Start a new "mfu-datagram" leg (mmt-02 4.3.1) without discarding
|
|
16089
|
+
* track/decoder state: the same join-boundary rules as a multicast join,
|
|
16090
|
+
* since the leg starts at an arbitrary datagram too. It resets the whole
|
|
16091
|
+
* join boundary of this manager, a multicast ordered-relay frontier
|
|
16092
|
+
* included, so a host gives the leg a manager of its own.
|
|
16093
|
+
*/
|
|
16094
|
+
beginLegJoin() {
|
|
16095
|
+
this.beginMulticastJoin();
|
|
16096
|
+
}
|
|
15851
16097
|
/** How the multicast leg currently delivers symbols. */
|
|
15852
16098
|
get multicastSymbolDelivery() {
|
|
15853
16099
|
return this.#multicastSymbolDelivery;
|
|
@@ -15870,7 +16116,8 @@ var FECManager = class _FECManager {
|
|
|
15870
16116
|
);
|
|
15871
16117
|
}
|
|
15872
16118
|
if (delivery === this.#multicastSymbolDelivery) return;
|
|
15873
|
-
this.#deliveryGaps.reset();
|
|
16119
|
+
this.#deliveryGaps.multicast.reset();
|
|
16120
|
+
this.#runAnchors.clear();
|
|
15874
16121
|
if (delivery === "ordered-relay") {
|
|
15875
16122
|
for (const [packetId, config] of this.#trackConfigs) {
|
|
15876
16123
|
this.#orderedHorizonBlocksFor(packetId, config);
|
|
@@ -16137,8 +16384,8 @@ var FECManager = class _FECManager {
|
|
|
16137
16384
|
const sourceSymbols = this.#isoLocatorFor(packetId, catalogTrackName).blockAt(sbn)?.length ?? this.#trackConfig(packetId).k;
|
|
16138
16385
|
const isSourceSymbol = esi >= 0 && esi < sourceSymbols;
|
|
16139
16386
|
const isStartupPartial = this.#startupPartialBlocks.has(blockKey);
|
|
16140
|
-
const isReadyMulticastRepair = this.#startupRequireRepairReady && source
|
|
16141
|
-
const awaitingMulticastRepair = this.#startupRequireRepairReady && source
|
|
16387
|
+
const isReadyMulticastRepair = this.#startupRequireRepairReady && source !== "moq" && !isSourceSymbol && this.#startupRepairReadyPackets.has(streamKey);
|
|
16388
|
+
const awaitingMulticastRepair = this.#startupRequireRepairReady && source !== "moq" && !this.#startupRepairReadyPackets.has(streamKey) && !this.#startupRepairFailOpenPackets.has(streamKey);
|
|
16142
16389
|
if (awaitingMulticastRepair) {
|
|
16143
16390
|
if (!isSourceSymbol) {
|
|
16144
16391
|
this.#startupRepairReadyPackets.add(streamKey);
|
|
@@ -16192,12 +16439,14 @@ var FECManager = class _FECManager {
|
|
|
16192
16439
|
...catalogTrackName === void 0 ? {} : { catalogTrackName },
|
|
16193
16440
|
multicastSymbols: 0,
|
|
16194
16441
|
moqSymbols: 0,
|
|
16442
|
+
datagramSymbols: 0,
|
|
16195
16443
|
complete: false
|
|
16196
16444
|
};
|
|
16197
16445
|
const receivedAtMs = this.#receiptNow();
|
|
16198
16446
|
const anchorMs = this.#blockAnchorsMs.get(blockKey);
|
|
16199
16447
|
if (anchorMs === void 0 || receivedAtMs < anchorMs) this.#blockAnchorsMs.set(blockKey, receivedAtMs);
|
|
16200
16448
|
if (source === "multicast") counts.multicastSymbols++;
|
|
16449
|
+
else if (source === "moq-datagram") counts.datagramSymbols++;
|
|
16201
16450
|
else counts.moqSymbols++;
|
|
16202
16451
|
this.#blockPathCounts.set(blockKey, counts);
|
|
16203
16452
|
this.#observeBlockCatalogTrackName(blockKey, sbn, packetId, catalogTrackName);
|
|
@@ -16218,7 +16467,7 @@ var FECManager = class _FECManager {
|
|
|
16218
16467
|
this.#unindexBlockKey(key);
|
|
16219
16468
|
}
|
|
16220
16469
|
}
|
|
16221
|
-
if (isSourceSymbol && source
|
|
16470
|
+
if (isSourceSymbol && source !== "moq") {
|
|
16222
16471
|
this.#noteMulticastSource(this.#isoLocatorFor(packetId, catalogTrackName), sbn + esi >>> 0, packetId, catalogTrackName);
|
|
16223
16472
|
}
|
|
16224
16473
|
return true;
|
|
@@ -16307,8 +16556,22 @@ var FECManager = class _FECManager {
|
|
|
16307
16556
|
* DeliveryGapEstimator). Datagram delivery only.
|
|
16308
16557
|
*/
|
|
16309
16558
|
noteMulticastArrival(packetId, packetSequenceNumber) {
|
|
16310
|
-
|
|
16311
|
-
|
|
16559
|
+
this.noteArrival("multicast", packetId, packetSequenceNumber);
|
|
16560
|
+
}
|
|
16561
|
+
/**
|
|
16562
|
+
* Record one MMTP packet arrival on a lossy path for that path's
|
|
16563
|
+
* delivery-gap measurement: the multicast leg (datagram delivery only; an
|
|
16564
|
+
* ordered relay settles by stream order) or an "mfu-datagram" leg, whose
|
|
16565
|
+
* datagrams are always a lossy path (#lossyDatagramPath).
|
|
16566
|
+
*/
|
|
16567
|
+
noteArrival(path, packetId, packetSequenceNumber) {
|
|
16568
|
+
if (!this.#lossyDatagramPath(path)) return;
|
|
16569
|
+
this.#deliveryGaps[path].noteArrival(performance.now(), packetId, packetSequenceNumber);
|
|
16570
|
+
}
|
|
16571
|
+
/** The largest delivery gap any lossy path measured over its window. */
|
|
16572
|
+
#peakDeliveryGapMs() {
|
|
16573
|
+
const now = performance.now();
|
|
16574
|
+
return Math.max(...Object.values(this.#deliveryGaps).map((estimator) => estimator.peakGapMs(now)));
|
|
16312
16575
|
}
|
|
16313
16576
|
/**
|
|
16314
16577
|
* Resolved per-track multicast late-symbol wait in milliseconds: the span
|
|
@@ -16322,10 +16585,10 @@ var FECManager = class _FECManager {
|
|
|
16322
16585
|
* Largest multicast delivery gap measured over the current window (ms), and
|
|
16323
16586
|
* that window (undefined: held since the last reset). Diagnostics.
|
|
16324
16587
|
*/
|
|
16325
|
-
multicastDeliveryGap() {
|
|
16588
|
+
multicastDeliveryGap(path = "multicast") {
|
|
16326
16589
|
return {
|
|
16327
|
-
peakGapMs: this.#deliveryGaps.peakGapMs(performance.now()),
|
|
16328
|
-
windowMs: this.#deliveryGaps.windowMs
|
|
16590
|
+
peakGapMs: this.#deliveryGaps[path].peakGapMs(performance.now()),
|
|
16591
|
+
windowMs: this.#deliveryGaps[path].windowMs
|
|
16329
16592
|
};
|
|
16330
16593
|
}
|
|
16331
16594
|
/**
|
|
@@ -16423,6 +16686,23 @@ var FECManager = class _FECManager {
|
|
|
16423
16686
|
const config = this.#trackConfigs.get(packetId);
|
|
16424
16687
|
return config === void 0 ? void 0 : this.#blockLifetimeMs(config);
|
|
16425
16688
|
}
|
|
16689
|
+
/**
|
|
16690
|
+
* How long an "mfu-datagram" leg's duplicate ledgers must remember a packet
|
|
16691
|
+
* so a legal reorder never reads as a publisher restart: one block span,
|
|
16692
|
+
* the reorder tolerance (`timeoutMs` is span + tolerance) and one group,
|
|
16693
|
+
* since a datagram may trail the stream by a whole group behind a joining
|
|
16694
|
+
* FETCH (mmt-02 6.1 step 3). The group is the catalog group duration
|
|
16695
|
+
* (`groupDurationMs`), whatever the track kind; a video track configured
|
|
16696
|
+
* without one falls back to its keyframe interval (one GOP per group).
|
|
16697
|
+
* Undefined for an unconfigured packet id.
|
|
16698
|
+
*/
|
|
16699
|
+
datagramLegLedgerRetentionMsForPacket(packetId) {
|
|
16700
|
+
const config = this.#trackConfigs.get(packetId);
|
|
16701
|
+
if (config === void 0) return void 0;
|
|
16702
|
+
const geometry2 = config.geometry;
|
|
16703
|
+
const groupMs = config.groupDurationMs ?? (geometry2?.trackKind === "video" && geometry2.mode === "classifying" ? geometry2.keyframeInterval.ticks / geometry2.keyframeInterval.timescale * 1e3 : 0);
|
|
16704
|
+
return config.timeoutMs + (Number.isFinite(groupMs) ? groupMs : 0);
|
|
16705
|
+
}
|
|
16426
16706
|
/**
|
|
16427
16707
|
* How long a terminal (clean, recovered or failed) block stays authoritative,
|
|
16428
16708
|
* for late symbols and for the in-order release gate. It is also the gate's
|
|
@@ -16545,7 +16825,7 @@ var FECManager = class _FECManager {
|
|
|
16545
16825
|
const evictedBefore = locator.heldEvicted;
|
|
16546
16826
|
const held = locator.hold(ssId, source.arrivedAtMs === void 0 ? { ...source, arrivedAtMs: this.#receiptNow() } : source);
|
|
16547
16827
|
this.#settleExpiredIsoHoles(locator, packetId, catalogTrackName);
|
|
16548
|
-
if (held && source.source
|
|
16828
|
+
if (held && source.source !== "moq") this.#noteMulticastSource(locator, ssId, packetId, catalogTrackName);
|
|
16549
16829
|
const evicted = locator.heldEvicted - evictedBefore;
|
|
16550
16830
|
if (evicted > 0) {
|
|
16551
16831
|
const before = this.#isoHeldEvictedCount;
|
|
@@ -16665,9 +16945,9 @@ var FECManager = class _FECManager {
|
|
|
16665
16945
|
* that could hold them is pending or not yet stated by a repair, else the
|
|
16666
16946
|
* starts of the blocks that failed or vanished. SS_IDs no repair has
|
|
16667
16947
|
* delimited yet that all arrived lost nothing and wait for no repair, only
|
|
16668
|
-
* the late-source allowance after the
|
|
16669
|
-
* arrived (#lossFreeRunReadyAtMs), and not even that when none of them
|
|
16670
|
-
* as one; one missing makes a run that waits as one block
|
|
16948
|
+
* the late-source allowance after the datagram of a lossy path that clocks
|
|
16949
|
+
* them arrived (#lossFreeRunReadyAtMs), and not even that when none of them
|
|
16950
|
+
* came as one; one missing makes a run that waits as one block
|
|
16671
16951
|
* (isoRepairlessWaitMs).
|
|
16672
16952
|
*
|
|
16673
16953
|
* `untracked` reads as the release gate reads it (MmtpRouter
|
|
@@ -16710,25 +16990,26 @@ var FECManager = class _FECManager {
|
|
|
16710
16990
|
}
|
|
16711
16991
|
/**
|
|
16712
16992
|
* When undelimited SS_IDs from `runStart` up to `toSsId` that all arrived
|
|
16713
|
-
* stop holding its frame: the late-source allowance after
|
|
16714
|
-
* datagram
|
|
16715
|
-
*
|
|
16716
|
-
*
|
|
16717
|
-
*
|
|
16718
|
-
*
|
|
16719
|
-
*
|
|
16993
|
+
* stop holding its frame: the late-source allowance after the receipt of
|
|
16994
|
+
* a datagram of a lossy path (#lossyDatagramPath: a multicast datagram, or
|
|
16995
|
+
* one of an "mfu-datagram" leg). Until then a frame between them may still
|
|
16996
|
+
* complete from a packet with no SS_ID (an untagged FT=0/FT=1 reordered
|
|
16997
|
+
* behind the next frame), and a repair may delimit them. The receipt is
|
|
16998
|
+
* `toSsId`'s own when it is held from such a datagram. Otherwise (its
|
|
16999
|
+
* packet came only as an overlap copy or from a MoQ stream, or was evicted
|
|
17000
|
+
* or retired) it is the newest among those SS_IDs, every one of which is
|
|
16720
17001
|
* held and states its path. So the time moves at most once, when the
|
|
16721
|
-
* head's own
|
|
17002
|
+
* head's own datagram copy arrives while its frame waits or its held
|
|
16722
17003
|
* source is dropped, and never on a later ask.
|
|
16723
17004
|
*
|
|
16724
|
-
* Undefined, so the range releases at once, when no SS_ID of it came as
|
|
16725
|
-
*
|
|
16726
|
-
*
|
|
16727
|
-
*
|
|
16728
|
-
*
|
|
16729
|
-
*
|
|
16730
|
-
* on
|
|
16731
|
-
* of such a track is dropped stale.
|
|
17005
|
+
* Undefined, so the range releases at once, when no SS_ID of it came as
|
|
17006
|
+
* such a datagram: a MoQ arrival, an ordered relay's and the frame's own
|
|
17007
|
+
* are no clock for datagram reordering (#lossyReceiptMs). Undefined too
|
|
17008
|
+
* on a track with no catalog span, which states no allowance: the local
|
|
17009
|
+
* timeout is a cleanup bound, and isoRepairlessWaitMs arms no wake there,
|
|
17010
|
+
* so a wait would hold the frame until the next packet. The cost, on
|
|
17011
|
+
* multicast and on the leg too: an untagged FT=0/FT=1 reordered behind
|
|
17012
|
+
* the next frame of such a track is dropped stale.
|
|
16732
17013
|
*/
|
|
16733
17014
|
#lossFreeRunReadyAtMs(config, locator, runStart, toSsId) {
|
|
16734
17015
|
if (!_FECManager.#hasCatalogTiming(config)) return void 0;
|
|
@@ -16743,14 +17024,26 @@ var FECManager = class _FECManager {
|
|
|
16743
17024
|
return clockMs + Math.max(0, this.#multicastWaitMs(config) - config.interleaveDepthMs);
|
|
16744
17025
|
}
|
|
16745
17026
|
/**
|
|
16746
|
-
* Receipt time of a held source that came as a
|
|
16747
|
-
*
|
|
16748
|
-
*
|
|
16749
|
-
*
|
|
16750
|
-
*
|
|
17027
|
+
* Receipt time of a held source that came as a datagram of a lossy path
|
|
17028
|
+
* (#lossyDatagramPath), else undefined: a MoQ stream and an ordered relay
|
|
17029
|
+
* deliver in order, so their arrivals clock no reorder allowance and no
|
|
17030
|
+
* FEC deadline. The path is the one the feed stated (IsoHeldSource.source,
|
|
17031
|
+
* and MulticastSymbolDelivery for a multicast source), never a guess.
|
|
16751
17032
|
*/
|
|
16752
17033
|
#lossyReceiptMs(held) {
|
|
16753
|
-
return held
|
|
17034
|
+
return held !== void 0 && this.#lossyDatagramPath(held.source) ? held.arrivedAtMs : void 0;
|
|
17035
|
+
}
|
|
17036
|
+
/**
|
|
17037
|
+
* The one path predicate of the loss gates: whether a symbol fed as
|
|
17038
|
+
* `source` reached this manager as a datagram of its own, on a path that
|
|
17039
|
+
* loses and reorders (mmt-02 Section 2, a datagram leg). A multicast
|
|
17040
|
+
* symbol does unless its provider declared an ordered relay. An
|
|
17041
|
+
* "mfu-datagram" object always does (4.3.1): MulticastSymbolDelivery is
|
|
17042
|
+
* the multicast provider's statement and is never read for the leg. A MoQ
|
|
17043
|
+
* stream object never does, a stream copy of the leg included.
|
|
17044
|
+
*/
|
|
17045
|
+
#lossyDatagramPath(source) {
|
|
17046
|
+
return source === "moq-datagram" || source === "multicast" && this.#multicastSymbolDelivery === "datagram";
|
|
16754
17047
|
}
|
|
16755
17048
|
/**
|
|
16756
17049
|
* The release gate's wait, from a frame's arrival, for the SS_IDs strictly
|
|
@@ -16759,10 +17052,11 @@ var FECManager = class _FECManager {
|
|
|
16759
17052
|
* arrived nor held) lies in a repair-less span longer than K, which no
|
|
16760
17053
|
* repair can state a block of (#openIsoSpan), or in a stated block its
|
|
16761
17054
|
* own repair group cannot complete every SS_ID of which it misses lies
|
|
16762
|
-
* between them (so the gap's decision covers all it lost), and a
|
|
16763
|
-
*
|
|
16764
|
-
*
|
|
16765
|
-
*
|
|
17055
|
+
* between them (so the gap's decision covers all it lost), and a source of
|
|
17056
|
+
* a lossy leg (multicast, or an "mfu-datagram" leg's datagram) at or past
|
|
17057
|
+
* `toSsId` arrived, so each is lost or reordered behind it (a MoQ source
|
|
17058
|
+
* shows nothing: MoQ streams overtake one another). The span or block
|
|
17059
|
+
* itself keeps its own wait.
|
|
16766
17060
|
*
|
|
16767
17061
|
* The wait is the late-symbol allowance, unless `rapMayHide`: the gap may
|
|
16768
17062
|
* hold a RAP packet an installed keyframe overlay can still rebuild (its
|
|
@@ -16776,15 +17070,17 @@ var FECManager = class _FECManager {
|
|
|
16776
17070
|
*
|
|
16777
17071
|
* A run of SS_IDs no repair has delimited yet, one of which never arrived,
|
|
16778
17072
|
* is one block of its own instead (draft-ramadan-moq-fec-multicast-00,
|
|
16779
|
-
* Receiver Repair Policy
|
|
16780
|
-
* that block's FEC deadline,
|
|
16781
|
-
* multicast wait (fec-core-00 9.3),
|
|
16782
|
-
*
|
|
16783
|
-
*
|
|
16784
|
-
*
|
|
16785
|
-
*
|
|
16786
|
-
*
|
|
16787
|
-
*
|
|
17073
|
+
* Receiver Repair Policy; on an "mfu-datagram" leg fec-core-00 9.3 and
|
|
17074
|
+
* mmt-02 5.3.3): the frame then waits for that block's FEC deadline,
|
|
17075
|
+
* whatever the flags: ts plus the whole multicast wait (fec-core-00 9.3),
|
|
17076
|
+
* ts the receipt of the lowest held source above the run that came as a
|
|
17077
|
+
* datagram of a lossy path (#lossyDatagramPath), up to the newest
|
|
17078
|
+
* (fec-multicast-00, Deadline Anchoring; under reordering at or after the
|
|
17079
|
+
* draft's first signal, never before). The wait returned counts from
|
|
17080
|
+
* `arrivedAtMs`, the frame's arrival; without it, it is the whole wait.
|
|
17081
|
+
* With no such source held (never arrived, retired, or evicted, or every
|
|
17082
|
+
* one from a MoQ stream or an ordered relay) the frame keeps the hold
|
|
17083
|
+
* ceiling: a stream arrival is no clock for a datagram deadline.
|
|
16788
17084
|
*/
|
|
16789
17085
|
isoRepairlessWaitMs(packetId, catalogTrackName, fromSsId, toSsId, rapMayHide = false, rapNext = false, arrivedAtMs) {
|
|
16790
17086
|
const config = this.#trackConfigs.get(packetId);
|
|
@@ -16800,9 +17096,7 @@ var FECManager = class _FECManager {
|
|
|
16800
17096
|
const newestSource = locator.newestSource;
|
|
16801
17097
|
if (newestSource === void 0 || serial32Precedes(newestSource, toSsId)) return void 0;
|
|
16802
17098
|
if (run?.missing !== void 0) {
|
|
16803
|
-
if (this
|
|
16804
|
-
return void 0;
|
|
16805
|
-
}
|
|
17099
|
+
if (this.isoSpanResolution(packetId, catalogTrackName, fromSsId, run.start) === null) return void 0;
|
|
16806
17100
|
const kept = this.#runAnchors.get(streamKey);
|
|
16807
17101
|
const anchor = kept?.fromSsId === fromSsId && this.#receiptNow() - kept.tsMs <= 2 * (config.interleaveDepthMs + 2 * this.#blockLifetimeMs(config)) ? kept : void 0;
|
|
16808
17102
|
let tsMs = anchor?.tsMs;
|
|
@@ -17673,9 +17967,11 @@ var FECManager = class _FECManager {
|
|
|
17673
17967
|
* its sources in send order, so one that moves the stream's newest source
|
|
17674
17968
|
* position past a block leaves the sources that block still misses
|
|
17675
17969
|
* reordered behind it at best: it shortens the wait of every block it
|
|
17676
|
-
* passed that only a late source can complete. MoQ is left out:
|
|
17677
|
-
* can overtake one another, so a MoQ source shows nothing
|
|
17678
|
-
* sent before it.
|
|
17970
|
+
* passed that only a late source can complete. Reliable MoQ is left out:
|
|
17971
|
+
* its streams can overtake one another, so a MoQ source shows nothing
|
|
17972
|
+
* about the sources sent before it. An "mfu-datagram" leg is in: its
|
|
17973
|
+
* datagrams leave the publisher in send order and reorder only within the
|
|
17974
|
+
* path's tolerance, as multicast does.
|
|
17679
17975
|
*/
|
|
17680
17976
|
#noteMulticastSource(locator, ssId, packetId, catalogTrackName) {
|
|
17681
17977
|
const previous = locator.newestSource;
|
|
@@ -18142,7 +18438,7 @@ var FECManager = class _FECManager {
|
|
|
18142
18438
|
blockDeliveryProvenance(sbn, packetId, catalogTrackName) {
|
|
18143
18439
|
const counts = this.blockPathCount(sbn, packetId, catalogTrackName);
|
|
18144
18440
|
if (!counts) return "unknown";
|
|
18145
|
-
if (counts.moqSymbols > 0) return "mixed";
|
|
18441
|
+
if (counts.moqSymbols > 0 || counts.datagramSymbols > 0) return "mixed";
|
|
18146
18442
|
if (counts.multicastSymbols > 0) return "multicast";
|
|
18147
18443
|
return "unknown";
|
|
18148
18444
|
}
|
|
@@ -18169,7 +18465,7 @@ var FECManager = class _FECManager {
|
|
|
18169
18465
|
this.#activeBlockDeadlinesMs.clear();
|
|
18170
18466
|
this.#blockWaitDeadlinesMs.clear();
|
|
18171
18467
|
this.#repairHoldUntilMs.clear();
|
|
18172
|
-
this.#deliveryGaps.reset();
|
|
18468
|
+
for (const estimator of Object.values(this.#deliveryGaps)) estimator.reset();
|
|
18173
18469
|
this.#pendingWorkerCleanups.clear();
|
|
18174
18470
|
this.#pendingWorkerCleanupClients.clear();
|
|
18175
18471
|
for (const bound of this.#pendingWorkerCleanupBounds.values()) clearTimeout(bound.handle);
|
|
@@ -21691,12 +21987,12 @@ function validPort(value) {
|
|
|
21691
21987
|
return Number.isInteger(value) && value >= 0 && value <= 65535;
|
|
21692
21988
|
}
|
|
21693
21989
|
function parseIpv42(address) {
|
|
21694
|
-
const
|
|
21695
|
-
if (
|
|
21990
|
+
const fields2 = address.split(".");
|
|
21991
|
+
if (fields2.length !== 4 || fields2.some((field) => !/^\d+$/.test(field))) {
|
|
21696
21992
|
throw new Error(`invalid IPv4 address ${address}`);
|
|
21697
21993
|
}
|
|
21698
|
-
const values =
|
|
21699
|
-
if (values.some((value, index) => value > 255 || String(value) !==
|
|
21994
|
+
const values = fields2.map(Number);
|
|
21995
|
+
if (values.some((value, index) => value > 255 || String(value) !== fields2[index])) {
|
|
21700
21996
|
throw new Error(`invalid IPv4 address ${address}`);
|
|
21701
21997
|
}
|
|
21702
21998
|
return Uint8Array.from(values);
|
|
@@ -21910,7 +22206,7 @@ function bitLen(n) {
|
|
|
21910
22206
|
return len;
|
|
21911
22207
|
}
|
|
21912
22208
|
var bitMask = (n) => (_1n << BigInt(n)) - _1n;
|
|
21913
|
-
function _validateObject(object2,
|
|
22209
|
+
function _validateObject(object2, fields2, optFields = {}) {
|
|
21914
22210
|
if (!object2 || typeof object2 !== "object")
|
|
21915
22211
|
throw new Error("expected valid options object");
|
|
21916
22212
|
function checkField2(fieldName, expectedType, isOpt) {
|
|
@@ -21921,7 +22217,7 @@ function _validateObject(object2, fields, optFields = {}) {
|
|
|
21921
22217
|
if (current !== expectedType || val === null)
|
|
21922
22218
|
throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`);
|
|
21923
22219
|
}
|
|
21924
|
-
Object.entries(
|
|
22220
|
+
Object.entries(fields2).forEach(([k, v]) => checkField2(k, v, false));
|
|
21925
22221
|
Object.entries(optFields).forEach(([k, v]) => checkField2(k, v, true));
|
|
21926
22222
|
}
|
|
21927
22223
|
var notImplemented = () => {
|
|
@@ -23902,6 +24198,20 @@ var MmtpRouter = class {
|
|
|
23902
24198
|
/** The flow whose receiver admitted a stream's source datagrams, by packetId then catalog track name: recovered packets answer to it. */
|
|
23903
24199
|
#provenanceStreamFlow = /* @__PURE__ */ new Map();
|
|
23904
24200
|
#unregisteredFlowDrops = 0;
|
|
24201
|
+
/** "mfu-datagram" leg packets of a packet id the ingress does not name (never the signaling flow). */
|
|
24202
|
+
#datagramLegIngressDrops = 0;
|
|
24203
|
+
/** "mfu-datagram" leg packets of the signaling flow (packet id 0): expected, one per group. */
|
|
24204
|
+
#datagramLegSignalingPackets = 0;
|
|
24205
|
+
/**
|
|
24206
|
+
* The streams a live "mfu-datagram" leg has fed, catalog track names by
|
|
24207
|
+
* packet id: their ledgers and release gate take the leg's bounds. A stream
|
|
24208
|
+
* leaves when its leg does: `endDatagramLeg`, `resetTrack`, `dispose`, or
|
|
24209
|
+
* the first multicast packet of its packet id (the ordered switch retires
|
|
24210
|
+
* the leg first). The "mfu" sibling shares the packet id, never the name.
|
|
24211
|
+
*/
|
|
24212
|
+
#datagramLegStreams = /* @__PURE__ */ new Map();
|
|
24213
|
+
/** The leg's presentation budget (setDatagramLegPresentationBudget), or null: no presentation bound. */
|
|
24214
|
+
#datagramLegPresentationBudgetMs = null;
|
|
23905
24215
|
#ambiguousRecoveredDrops = 0;
|
|
23906
24216
|
// Temp state set by #processMMTP before calling parser.feed(),
|
|
23907
24217
|
// read by the parser's onFrame callback for CMAF assembly + dedup.
|
|
@@ -24277,10 +24587,11 @@ var MmtpRouter = class {
|
|
|
24277
24587
|
const blockLifetimeMs = fec.blockLifetimeMsForPacket(packetId);
|
|
24278
24588
|
if (blockSpanMs === void 0 || blockLifetimeMs === void 0) return NO_FEC_GEOMETRY_HORIZON;
|
|
24279
24589
|
if (blockSpanMs === 0) return NO_BLOCK_SPAN_HORIZON;
|
|
24280
|
-
|
|
24281
|
-
|
|
24282
|
-
retentionMs
|
|
24283
|
-
}
|
|
24590
|
+
let retentionMs = duplicateRetentionMs({ blockSpanMs, blockLifetimeMs });
|
|
24591
|
+
if (this.#datagramLegStreams.has(packetId)) {
|
|
24592
|
+
retentionMs = Math.max(retentionMs, fec.datagramLegLedgerRetentionMsForPacket?.(packetId) ?? 0);
|
|
24593
|
+
}
|
|
24594
|
+
return { kind: "fec-horizon", retentionMs };
|
|
24284
24595
|
}
|
|
24285
24596
|
/**
|
|
24286
24597
|
* Init segments rejected since construction because their packetId had no
|
|
@@ -24703,7 +25014,7 @@ var MmtpRouter = class {
|
|
|
24703
25014
|
const blockStart = placement.block.start;
|
|
24704
25015
|
if (placement.span !== void 0) this.#replayOverlaySources(inst, placement.span.block.start, placement.span.placed);
|
|
24705
25016
|
this.#replayOverlaySources(inst, blockStart, placement.placed);
|
|
24706
|
-
if (source
|
|
25017
|
+
if (source !== "multicast") this.#noteOverlayMoqBlock(inst, blockStart);
|
|
24707
25018
|
const alreadyCompleted = fec.isBlockCompleted(blockStart, pid, name);
|
|
24708
25019
|
const recovered = fec.feedRepairSymbol(pid, repair.ssStart, repair.ssbLength, repair.rsId, repair.symbolData, name);
|
|
24709
25020
|
if (recovered && !alreadyCompleted) this.#routeOverlayRecovered(inst, blockStart, recovered);
|
|
@@ -24711,7 +25022,7 @@ var MmtpRouter = class {
|
|
|
24711
25022
|
#replayOverlaySources(inst, blockStart, placed) {
|
|
24712
25023
|
const { fec, repairPacketId: pid, streamName: name } = inst;
|
|
24713
25024
|
for (const { ssId, payload } of placed) {
|
|
24714
|
-
if (payload.source
|
|
25025
|
+
if (payload.source !== "multicast") this.#noteOverlayMoqBlock(inst, blockStart);
|
|
24715
25026
|
if (payload.oversized) continue;
|
|
24716
25027
|
const alreadyCompleted = fec.isBlockCompleted(blockStart, pid, name);
|
|
24717
25028
|
const recovered = fec.feedSourceSymbol(pid, ssId, payload.symbolData, name);
|
|
@@ -24764,7 +25075,7 @@ var MmtpRouter = class {
|
|
|
24764
25075
|
});
|
|
24765
25076
|
continue;
|
|
24766
25077
|
}
|
|
24767
|
-
if (source
|
|
25078
|
+
if (source !== "multicast") this.#noteOverlayMoqBlock(inst, coords.sbn);
|
|
24768
25079
|
if (oversized) continue;
|
|
24769
25080
|
const alreadyCompleted = fec.isBlockCompleted(coords.sbn, pid, name);
|
|
24770
25081
|
const recovered = fec.feedSourceSymbol(pid, ssId, symbolData, name);
|
|
@@ -25353,6 +25664,46 @@ var MmtpRouter = class {
|
|
|
25353
25664
|
get unregisteredFlowDropCount() {
|
|
25354
25665
|
return this.#unregisteredFlowDrops;
|
|
25355
25666
|
}
|
|
25667
|
+
/** "mfu-datagram" leg packets dropped because the leg's ingress does not name their packet id (packet id 0 apart). */
|
|
25668
|
+
get datagramLegIngressDropCount() {
|
|
25669
|
+
return this.#datagramLegIngressDrops;
|
|
25670
|
+
}
|
|
25671
|
+
/** "mfu-datagram" leg packets of the MMTP signaling flow (packet id 0), which no track owns. */
|
|
25672
|
+
get datagramLegSignalingPacketCount() {
|
|
25673
|
+
return this.#datagramLegSignalingPackets;
|
|
25674
|
+
}
|
|
25675
|
+
/**
|
|
25676
|
+
* The "mfu-datagram" leg's presentation bound (mmt-02 6.1 step 6): how
|
|
25677
|
+
* long after a frame arrives it must leave the release gate when the gap
|
|
25678
|
+
* before it holds no RAP, FT=0 or FT=1 data (the player's presentation
|
|
25679
|
+
* delay less its decode lead). The gap is then decided at the earlier of
|
|
25680
|
+
* the FEC block deadline and this bound; a gap that may hold a RAP keeps
|
|
25681
|
+
* the block deadline. Null, or a value that is not finite and positive:
|
|
25682
|
+
* the block deadline alone, as on multicast.
|
|
25683
|
+
*/
|
|
25684
|
+
setDatagramLegPresentationBudget(budgetMs) {
|
|
25685
|
+
this.#datagramLegPresentationBudgetMs = budgetMs;
|
|
25686
|
+
}
|
|
25687
|
+
/**
|
|
25688
|
+
* The "mfu-datagram" leg is over (unsubscribed, or switched to another
|
|
25689
|
+
* path): no stream keeps its presentation bound or its ledger retention.
|
|
25690
|
+
* Parser, FEC and ledger state stay, so the packet ids continue on the
|
|
25691
|
+
* next path without an epoch. A later leg datagram starts a leg again.
|
|
25692
|
+
*/
|
|
25693
|
+
endDatagramLeg() {
|
|
25694
|
+
this.#datagramLegStreams.clear();
|
|
25695
|
+
this.#datagramLegPresentationBudgetMs = null;
|
|
25696
|
+
}
|
|
25697
|
+
#datagramLegPresentationWaitMs(packetId, catalogTrackName) {
|
|
25698
|
+
if (this.#datagramLegPresentationBudgetMs === null || this.#datagramLegStreams.get(packetId)?.has(catalogTrackName) !== true) return void 0;
|
|
25699
|
+
let budgetMs;
|
|
25700
|
+
try {
|
|
25701
|
+
budgetMs = this.#datagramLegPresentationBudgetMs(packetId, catalogTrackName);
|
|
25702
|
+
} catch {
|
|
25703
|
+
return void 0;
|
|
25704
|
+
}
|
|
25705
|
+
return Number.isFinite(budgetMs) && budgetMs > 0 ? budgetMs : void 0;
|
|
25706
|
+
}
|
|
25356
25707
|
/** Recovered packets dropped because more than one protected flow could own their stream. */
|
|
25357
25708
|
get ambiguousRecoveredDropCount() {
|
|
25358
25709
|
return this.#ambiguousRecoveredDrops;
|
|
@@ -25370,6 +25721,10 @@ var MmtpRouter = class {
|
|
|
25370
25721
|
* caller that forgot it silently attributed its bytes to a multicast socket
|
|
25371
25722
|
* they may never have crossed — and that attribution is what the physical-
|
|
25372
25723
|
* delivery evidence path is built on. Absence is not multicast; say which.
|
|
25724
|
+
* `"moq-datagram"` is an "mfu-datagram" subscription (MmtpIngestSource):
|
|
25725
|
+
* `ingress.tracks` MUST name the datagram catalog track for its packet id,
|
|
25726
|
+
* and a packet of a packet id it does not name is dropped and counted
|
|
25727
|
+
* (`datagramLegIngressDropCount`; the signaling flow, packet id 0, apart).
|
|
25373
25728
|
*/
|
|
25374
25729
|
feedPacket(packet, source, ingress) {
|
|
25375
25730
|
if (this.#disposed) return;
|
|
@@ -25419,15 +25774,18 @@ var MmtpRouter = class {
|
|
|
25419
25774
|
}
|
|
25420
25775
|
/**
|
|
25421
25776
|
* Feed a repair packet from MoQ (reliable QUIC) — parses MMTP repair
|
|
25422
|
-
* header and delegates to FECManager for FEC recovery.
|
|
25777
|
+
* header and delegates to FECManager for FEC recovery. `source` is
|
|
25778
|
+
* `"moq-datagram"` for a repair object of an "mfu-datagram" track's repair
|
|
25779
|
+
* track, which arrives as a datagram and so counts as an in-band symbol of
|
|
25780
|
+
* the leg; a FETCHed repair stays `"moq"` (RepairVia `quic`).
|
|
25423
25781
|
*/
|
|
25424
|
-
feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName) {
|
|
25782
|
+
feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source = "moq") {
|
|
25425
25783
|
if (this.#disposed) return;
|
|
25426
25784
|
this.#withDeferredFecPokes(() => {
|
|
25427
|
-
this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName);
|
|
25785
|
+
this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source);
|
|
25428
25786
|
});
|
|
25429
25787
|
}
|
|
25430
|
-
#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, admitted = false) {
|
|
25788
|
+
#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source, admitted = false) {
|
|
25431
25789
|
let header;
|
|
25432
25790
|
try {
|
|
25433
25791
|
header = parseMMTPHeader(packet);
|
|
@@ -25437,7 +25795,7 @@ var MmtpRouter = class {
|
|
|
25437
25795
|
const repairPacketId = header.packetId;
|
|
25438
25796
|
const overlay = this.#overlayRepairTarget(repairPacketId, repairTrackName);
|
|
25439
25797
|
if (overlay !== void 0) {
|
|
25440
|
-
this.#routeOverlayRepair(overlay, repairPacketId, packet, header,
|
|
25798
|
+
this.#routeOverlayRepair(overlay, repairPacketId, packet, header, source);
|
|
25441
25799
|
return;
|
|
25442
25800
|
}
|
|
25443
25801
|
const hintedOwner = ownerPacketIdHint != null && this.#classifyPacketId(ownerPacketIdHint) !== null ? ownerPacketIdHint : null;
|
|
@@ -25449,7 +25807,7 @@ var MmtpRouter = class {
|
|
|
25449
25807
|
}
|
|
25450
25808
|
let unlisted = false;
|
|
25451
25809
|
if (ownerPacketId != null && !admitted) {
|
|
25452
|
-
const admit = this.#admitUnicast(repairPacketId, packet, () => this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, true));
|
|
25810
|
+
const admit = this.#admitUnicast(repairPacketId, packet, () => this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source, true));
|
|
25453
25811
|
if (admit === "held" || admit === "dropped") return;
|
|
25454
25812
|
unlisted = admit === "unlisted";
|
|
25455
25813
|
}
|
|
@@ -25470,7 +25828,7 @@ var MmtpRouter = class {
|
|
|
25470
25828
|
this.#noteUnreadableFecPayloadId(ownerPacketId, "repair");
|
|
25471
25829
|
return;
|
|
25472
25830
|
}
|
|
25473
|
-
this.#handleIsoRepair(ownerPacketId, catalogTrackName, parsed,
|
|
25831
|
+
this.#handleIsoRepair(ownerPacketId, catalogTrackName, parsed, source, repairTrackName);
|
|
25474
25832
|
}
|
|
25475
25833
|
}
|
|
25476
25834
|
// ── Packet FEC geometry and block profile ───────────────────────
|
|
@@ -25675,6 +26033,7 @@ var MmtpRouter = class {
|
|
|
25675
26033
|
debugRouter(
|
|
25676
26034
|
`[MmtpRouter] Dropping repair packet pid=${packetId}: physical PID is unregistered`
|
|
25677
26035
|
);
|
|
26036
|
+
this.#fecManager?.countUnresolvedRepairOwner?.("unregistered");
|
|
25678
26037
|
return null;
|
|
25679
26038
|
}
|
|
25680
26039
|
const registeredOwners = this.#repairOwnersByPacketId.get(packetId) ?? /* @__PURE__ */ new Set();
|
|
@@ -25683,6 +26042,7 @@ var MmtpRouter = class {
|
|
|
25683
26042
|
debugRouter(
|
|
25684
26043
|
`[MmtpRouter] Dropping repair packet pid=${packetId}: catalog owner is ${owners.length === 0 ? "absent" : "ambiguous"}`
|
|
25685
26044
|
);
|
|
26045
|
+
this.#fecManager?.countUnresolvedRepairOwner?.(owners.length === 0 ? "ownerAbsent" : "ownerAmbiguous");
|
|
25686
26046
|
return null;
|
|
25687
26047
|
}
|
|
25688
26048
|
/** Route a recovered FEC block through the parser + dedup pipeline.
|
|
@@ -25732,6 +26092,8 @@ var MmtpRouter = class {
|
|
|
25732
26092
|
}
|
|
25733
26093
|
this.#parser.resetTrack(packetId, catalogTrackName);
|
|
25734
26094
|
this.resetKeyframeOverlays(packetId, catalogTrackName);
|
|
26095
|
+
const legNames = this.#datagramLegStreams.get(packetId);
|
|
26096
|
+
if (legNames?.delete(catalogTrackName) && legNames.size === 0) this.#datagramLegStreams.delete(packetId);
|
|
25735
26097
|
this.#restampedStreams.delete(this.#mediaStreamKey(packetId, catalogTrackName));
|
|
25736
26098
|
const assistPrefix = assistKey(packetId, catalogTrackName, 0).slice(0, -1);
|
|
25737
26099
|
for (const key of this.#assistBlocks.keys()) if (key.startsWith(assistPrefix)) this.#assistBlocks.delete(key);
|
|
@@ -26073,6 +26435,7 @@ var MmtpRouter = class {
|
|
|
26073
26435
|
this.#fecWakes.clear();
|
|
26074
26436
|
this.#parser.dispose();
|
|
26075
26437
|
this.#streams.clear();
|
|
26438
|
+
this.endDatagramLeg();
|
|
26076
26439
|
this.#trackPacketCallbacks.clear();
|
|
26077
26440
|
this.#latestVideoSeqByStream.clear();
|
|
26078
26441
|
this.#lastDirectSourceVideoTsByStream.clear();
|
|
@@ -26271,14 +26634,18 @@ var MmtpRouter = class {
|
|
|
26271
26634
|
const { packetId, catalogTrackName } = after.meta;
|
|
26272
26635
|
const arrivedAtMs = after.arrivedAtMs;
|
|
26273
26636
|
const allowanceMs = fec?.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, false, false, arrivedAtMs);
|
|
26274
|
-
|
|
26637
|
+
const presentationMs = this.#datagramLegPresentationWaitMs(packetId, catalogTrackName);
|
|
26638
|
+
if (!fec || allowanceMs === void 0 && presentationMs === void 0) return void 0;
|
|
26275
26639
|
const decision = this.#decideGap(before, after, [], false);
|
|
26276
26640
|
const mpu = before.meta.mpuSequenceNumber;
|
|
26277
26641
|
const intoNextMpu = decision.reason === "rap-next" && mpu !== void 0 && after.meta.mpuSequenceNumber === mpu + 1 >>> 0 && fec.mpuBoundsRapsFor?.(packetId, catalogTrackName) === true;
|
|
26278
26642
|
if (decision.action === "stall" || decision.reason === "rap-next" && !intoNextMpu) {
|
|
26279
|
-
return fec.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, true, false, arrivedAtMs);
|
|
26643
|
+
return allowanceMs === void 0 ? void 0 : fec.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, true, false, arrivedAtMs);
|
|
26280
26644
|
}
|
|
26281
|
-
|
|
26645
|
+
const waitMs = allowanceMs === void 0 ? void 0 : decision.reason === "rap-next" ? fec.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, false, true, arrivedAtMs) : allowanceMs;
|
|
26646
|
+
if (decision.reason === "delta-lost" && !((fec.interleaveDepthMsForPacket?.(packetId) ?? 0) > 0)) return waitMs;
|
|
26647
|
+
if (presentationMs === void 0) return waitMs;
|
|
26648
|
+
return waitMs === void 0 ? presentationMs : Math.min(waitMs, presentationMs);
|
|
26282
26649
|
},
|
|
26283
26650
|
decide: (before, after, lostBlocks, discontinuity) => {
|
|
26284
26651
|
const decision = this.#decideGap(before, after, lostBlocks, discontinuity);
|
|
@@ -26468,18 +26835,34 @@ var MmtpRouter = class {
|
|
|
26468
26835
|
if (manifestAdmitted && !info.isRepair && ingress?.admittedBy !== USER_AGENT_VERIFIED) this.#admittedSourceDatagrams++;
|
|
26469
26836
|
if (source === "multicast" && !manifestAdmitted) {
|
|
26470
26837
|
this.#fecManager?.noteMulticastArrival?.(info.packetId, info.sequenceNumber);
|
|
26838
|
+
} else if (source === "moq-datagram" && !manifestAdmitted) {
|
|
26839
|
+
this.#fecManager?.noteArrival?.("moq-datagram", info.packetId, info.sequenceNumber);
|
|
26471
26840
|
}
|
|
26472
|
-
if (source
|
|
26841
|
+
if (source !== "moq" && !ingressHasPacketId(ingress, info.packetId)) {
|
|
26842
|
+
if (source === "moq-datagram") {
|
|
26843
|
+
if (info.packetId === MMTP_SIGNALING_PACKET_ID) this.#datagramLegSignalingPackets++;
|
|
26844
|
+
else this.#datagramLegIngressDrops++;
|
|
26845
|
+
}
|
|
26473
26846
|
debugRouter(
|
|
26474
|
-
`[MmtpRouter] Dropping
|
|
26847
|
+
`[MmtpRouter] Dropping ${source} packet pid=${info.packetId}: absent from ingress tracks`
|
|
26475
26848
|
);
|
|
26476
26849
|
return;
|
|
26477
26850
|
}
|
|
26851
|
+
if (source === "moq-datagram") {
|
|
26852
|
+
if (!info.isRepair) {
|
|
26853
|
+
let names = this.#datagramLegStreams.get(info.packetId);
|
|
26854
|
+
if (!names) this.#datagramLegStreams.set(info.packetId, names = /* @__PURE__ */ new Set());
|
|
26855
|
+
names.add(catalogTrackNameForPacket(ingress, info.packetId));
|
|
26856
|
+
}
|
|
26857
|
+
} else if (source === "multicast") {
|
|
26858
|
+
this.#datagramLegStreams.delete(info.packetId);
|
|
26859
|
+
}
|
|
26478
26860
|
const packetRole = this.#packetIdRoles.get(info.packetId);
|
|
26479
|
-
if (source
|
|
26861
|
+
if (source !== "moq" && this.#classifyPacketId(info.packetId) === null && (!info.isRepair || packetRole !== "repair")) {
|
|
26480
26862
|
debugRouter(
|
|
26481
|
-
`[MmtpRouter] Dropping
|
|
26863
|
+
`[MmtpRouter] Dropping ${source} packet pid=${info.packetId}: physical PID is unregistered`
|
|
26482
26864
|
);
|
|
26865
|
+
if (info.isRepair) this.#fecManager?.countUnresolvedRepairOwner?.("unregistered");
|
|
26483
26866
|
return;
|
|
26484
26867
|
}
|
|
26485
26868
|
if (!info.isRepair && hasAmbiguousCatalogTrackName(ingress, info.packetId)) {
|
|
@@ -26515,7 +26898,7 @@ var MmtpRouter = class {
|
|
|
26515
26898
|
}
|
|
26516
26899
|
return;
|
|
26517
26900
|
}
|
|
26518
|
-
if (source
|
|
26901
|
+
if (source !== "multicast" && !manifestAdmitted) {
|
|
26519
26902
|
const admit = this.#admitUnicast(info.packetId, packet, () => this.#processMMTP(packet, source, true, ingress, overlapCopy, true), overlapCopy);
|
|
26520
26903
|
if (admit !== "unlisted") {
|
|
26521
26904
|
if (admit === "admitted") this.#processMMTP(packet, source, true, ingress, overlapCopy);
|
|
@@ -26544,7 +26927,7 @@ var MmtpRouter = class {
|
|
|
26544
26927
|
);
|
|
26545
26928
|
if (!repair) return;
|
|
26546
26929
|
if (ownerPacketId != null && this.#fecManager) {
|
|
26547
|
-
if ((flowless && this.#userAgentGoverns(ownerPacketId) || source
|
|
26930
|
+
if ((flowless && this.#userAgentGoverns(ownerPacketId) || source !== "multicast" && !manifestAdmitted) && this.#setAsideUnlistedRepair(ownerPacketId, catalogTrackNameForPacket(ingress, ownerPacketId), repair)) return;
|
|
26548
26931
|
this.#repairPidCounts[info.packetId] = (this.#repairPidCounts[info.packetId] || 0) + 1;
|
|
26549
26932
|
const count = this.#repairPidCounts[info.packetId];
|
|
26550
26933
|
if (count <= 2 || count % 500 === 0) {
|
|
@@ -26583,7 +26966,7 @@ var MmtpRouter = class {
|
|
|
26583
26966
|
const fecSource = this.#fecManager !== null && fecPayloadId != null;
|
|
26584
26967
|
const coords = fecSource && fecPayloadId ? this.#locateFecSource(info.packetId, catalogTrackName, fecPayloadId.ssId) ?? void 0 : void 0;
|
|
26585
26968
|
duplicates.advance(coords?.sbn);
|
|
26586
|
-
if (source
|
|
26969
|
+
if (source !== "moq" && !overlapCopy && !releasedFromQuarantine && catalogTrackName !== void 0 && duplicates.predatesHorizon(info.sequenceNumber, fecPayloadId?.ssId)) {
|
|
26587
26970
|
this.#publisherRestarts++;
|
|
26588
26971
|
console.warn(
|
|
26589
26972
|
`[MmtpRouter] publisher restart on pid=${info.packetId} track=${catalogTrackName}: packet_sequence_number=${info.sequenceNumber} predates the stream's FEC horizon; starting a new epoch`
|
|
@@ -26772,7 +27155,9 @@ var MmtpRouter = class {
|
|
|
26772
27155
|
const feedOptions = {
|
|
26773
27156
|
skipFecPayloadId: parserOptions?.skipFecPayloadId,
|
|
26774
27157
|
recovered: parserOptions?.recovered,
|
|
26775
|
-
|
|
27158
|
+
// Frame attribution is the transport path: an "mfu-datagram" object
|
|
27159
|
+
// crossed QUIC, so its frames are 'moq' (provenance 'mixed').
|
|
27160
|
+
source: parserOptions?.source === "moq-datagram" ? "moq" : parserOptions?.source,
|
|
26776
27161
|
deliveryProvenance: parserOptions?.deliveryProvenance,
|
|
26777
27162
|
catalogTrackName: parserOptions?.catalogTrackName,
|
|
26778
27163
|
...parserOptions?.fecSbn === void 0 ? {} : { fecSbn: parserOptions.fecSbn },
|
|
@@ -28032,14 +28417,14 @@ function createWasmMmtpContainerParser(config) {
|
|
|
28032
28417
|
var JOIN_SUCCEEDED = Object.freeze({ ok: true });
|
|
28033
28418
|
function providerErrorOf(error) {
|
|
28034
28419
|
if (typeof error !== "object" || error === null) return void 0;
|
|
28035
|
-
const
|
|
28420
|
+
const fields2 = error;
|
|
28036
28421
|
let name;
|
|
28037
28422
|
let message;
|
|
28038
28423
|
let code;
|
|
28039
28424
|
try {
|
|
28040
|
-
name =
|
|
28041
|
-
message =
|
|
28042
|
-
code =
|
|
28425
|
+
name = fields2.name;
|
|
28426
|
+
message = fields2.message;
|
|
28427
|
+
code = fields2.code;
|
|
28043
28428
|
} catch {
|
|
28044
28429
|
return void 0;
|
|
28045
28430
|
}
|
|
@@ -28866,25 +29251,6 @@ function catalogAmtNetworkSource(networkSource) {
|
|
|
28866
29251
|
}
|
|
28867
29252
|
return void 0;
|
|
28868
29253
|
}
|
|
28869
|
-
function intIn2(value, min, max) {
|
|
28870
|
-
return Number.isInteger(value) && value >= min && value <= max;
|
|
28871
|
-
}
|
|
28872
|
-
function catalogAtsc3NetworkSource(networkSource) {
|
|
28873
|
-
const entries = Array.isArray(networkSource) ? networkSource : networkSource ? [networkSource] : [];
|
|
28874
|
-
for (const raw of entries) {
|
|
28875
|
-
if (!raw || typeof raw !== "object") continue;
|
|
28876
|
-
const ns = raw;
|
|
28877
|
-
if (ns.type !== "atsc3" || !intIn2(ns.frequency, 1, Number.MAX_SAFE_INTEGER)) continue;
|
|
28878
|
-
const slsUri = typeof ns.slsUri === "string" ? ns.slsUri.trim() : "";
|
|
28879
|
-
return {
|
|
28880
|
-
frequency: ns.frequency,
|
|
28881
|
-
...intIn2(ns.plpId, 0, 63) ? { plpId: ns.plpId } : {},
|
|
28882
|
-
...intIn2(ns.serviceId, 0, 65535) ? { serviceId: ns.serviceId } : {},
|
|
28883
|
-
...slsUri ? { slsUri } : {}
|
|
28884
|
-
};
|
|
28885
|
-
}
|
|
28886
|
-
return void 0;
|
|
28887
|
-
}
|
|
28888
29254
|
|
|
28889
29255
|
// src/multicast-manager.ts
|
|
28890
29256
|
function freezeIngress(tracks, flow) {
|
|
@@ -29751,6 +30117,7 @@ var MulticastManager = class {
|
|
|
29751
30117
|
assertPositiveGeometry("timescale", config.timescale);
|
|
29752
30118
|
assertPositiveGeometry("keyframeIntervalTicks", config.keyframeIntervalTicks);
|
|
29753
30119
|
assertPositiveGeometry("keyframeIntervalMs", config.keyframeIntervalMs);
|
|
30120
|
+
assertPositiveGeometry("groupDurationMs", config.groupDurationMs);
|
|
29754
30121
|
assertNonNegativeGeometry("fecRepairSymbols", config.fecRepairSymbols);
|
|
29755
30122
|
assertNonNegativeGeometry(
|
|
29756
30123
|
"fecReorderToleranceMs",
|
|
@@ -29783,7 +30150,8 @@ var MulticastManager = class {
|
|
|
29783
30150
|
timeoutMs: deliveryWindowMs,
|
|
29784
30151
|
...trackKind === void 0 ? {} : { trackKind },
|
|
29785
30152
|
...config.codec === void 0 ? {} : { codec: config.codec },
|
|
29786
|
-
...geometry2 === void 0 ? {} : { geometry: geometry2 }
|
|
30153
|
+
...geometry2 === void 0 ? {} : { geometry: geometry2 },
|
|
30154
|
+
...config.groupDurationMs === void 0 ? {} : { groupDurationMs: config.groupDurationMs }
|
|
29787
30155
|
};
|
|
29788
30156
|
this.#fec.configureTrack(packetId, fecConfig, catalogTrackName);
|
|
29789
30157
|
this.#configureTrackMapper(packetId, fecConfig);
|
|
@@ -30045,6 +30413,7 @@ var MulticastManager = class {
|
|
|
30045
30413
|
// worse behaviour.
|
|
30046
30414
|
amtRelayPort: config.amtRelayPort ?? config.relayPort ?? (amtRelay?.trim() ? DEFAULT_AMT_RELAY_PORT : void 0),
|
|
30047
30415
|
amtDiscovery: config.amtDiscovery,
|
|
30416
|
+
atsc3: config.atsc3,
|
|
30048
30417
|
packetIds: config.packetIds,
|
|
30049
30418
|
tracks: catalogTracks?.map(({ name, packetId }) => ({ name, packetId })),
|
|
30050
30419
|
...provenance === void 0 ? {} : { protected: true }
|
|
@@ -30198,6 +30567,7 @@ var MulticastManager = class {
|
|
|
30198
30567
|
amtRelay: endpoint.amtRelay,
|
|
30199
30568
|
amtRelayPort: endpoint.amtRelayPort ?? (endpoint.amtRelay?.trim() ? DEFAULT_AMT_RELAY_PORT : void 0),
|
|
30200
30569
|
amtDiscovery: endpoint.amtDiscovery,
|
|
30570
|
+
atsc3: endpoint.atsc3,
|
|
30201
30571
|
packetIds: endpoint.packetIds,
|
|
30202
30572
|
tracks: endpoint.tracks.map(({ name, packetId }) => ({ name, packetId })),
|
|
30203
30573
|
// A protected repair group's records ride in band on its port (7.2.3).
|
|
@@ -30484,6 +30854,70 @@ var MulticastManager = class {
|
|
|
30484
30854
|
feedPacket(data, ingress, sourceAddress) {
|
|
30485
30855
|
this.#transport.feedPacket(data, ingress, sourceAddress);
|
|
30486
30856
|
}
|
|
30857
|
+
/**
|
|
30858
|
+
* Start an "mfu-datagram" leg (draft-ramadan-moq-mmt-02 4.3.1): a
|
|
30859
|
+
* subscription whose objects arrive as datagrams, a lossy unicast path.
|
|
30860
|
+
* Arms the join-boundary rules exactly as a multicast join does (the leg
|
|
30861
|
+
* starts at an arbitrary datagram), keeping configured tracks, decoders
|
|
30862
|
+
* and diagnostics. No MulticastTransport is involved: no takeover, no
|
|
30863
|
+
* failback watchdog, no bridge. While the leg is up the player publishes
|
|
30864
|
+
* `datagramLegDiagnostics(...)` in its FEC stats (`DatagramLegDiagnostics`:
|
|
30865
|
+
* `datagramLegJoined`, `datagramLegIngressDrops`,
|
|
30866
|
+
* `datagramLegRepairBeforePacketId`, `datagramUnknownAlias`,
|
|
30867
|
+
* `transport.maxDatagramSize`), the same keys in every player.
|
|
30868
|
+
*/
|
|
30869
|
+
startDatagramLeg(options = {}) {
|
|
30870
|
+
this.#router.setDatagramLegPresentationBudget(options.presentationBudgetMs ?? null);
|
|
30871
|
+
this.#fec.beginLegJoin();
|
|
30872
|
+
}
|
|
30873
|
+
/**
|
|
30874
|
+
* Feed one object of an "mfu-datagram" subscription (one MMTP packet) in
|
|
30875
|
+
* arrival order. `ingress.tracks` names the datagram catalog track for the
|
|
30876
|
+
* packet id; the router restores serial order, holds FEC sources until a
|
|
30877
|
+
* repair states their block, and declares loss at the block deadline
|
|
30878
|
+
* (mmt-02 5.3.3). Bypasses MulticastTransport, unlike `feedPacket`.
|
|
30879
|
+
*/
|
|
30880
|
+
feedDatagramLegPacket(packet, ingress) {
|
|
30881
|
+
this.#router.feedPacket(packet, "moq-datagram", ingress);
|
|
30882
|
+
}
|
|
30883
|
+
/**
|
|
30884
|
+
* Feed one repair object of an "mfu-datagram" track's repair track (sent
|
|
30885
|
+
* as datagrams, mmt-02 4.3.1): the repair track's own packet id names no
|
|
30886
|
+
* owner, so the subscription supplies it, as `router.feedRepairPacket`
|
|
30887
|
+
* does for a MoQ repair; the symbol counts as in-band (`RepairVia`
|
|
30888
|
+
* `inband`), unlike a FETCHed repair.
|
|
30889
|
+
*/
|
|
30890
|
+
feedDatagramLegRepair(packet, ownerPacketId, catalogTrackName, repairTrackName) {
|
|
30891
|
+
this.#router.feedRepairPacket(packet, ownerPacketId, catalogTrackName, repairTrackName, "moq-datagram");
|
|
30892
|
+
}
|
|
30893
|
+
/**
|
|
30894
|
+
* End the "mfu-datagram" leg: call it when the subscription is dropped and
|
|
30895
|
+
* before the first packet of the path that replaces it (the ordered switch
|
|
30896
|
+
* to multicast, a fallback to the "mfu" track). The leg's presentation
|
|
30897
|
+
* bound and ledger retention stop applying; tracks, decoders, FEC state
|
|
30898
|
+
* and diagnostics stay, so the next path continues without a new epoch.
|
|
30899
|
+
*/
|
|
30900
|
+
stopDatagramLeg() {
|
|
30901
|
+
this.#router.endDatagramLeg();
|
|
30902
|
+
}
|
|
30903
|
+
/** "mfu-datagram" leg packets dropped because their packet id is not the leg's (`MmtpRouter.datagramLegIngressDropCount`). */
|
|
30904
|
+
get datagramLegIngressDropCount() {
|
|
30905
|
+
return this.#router.datagramLegIngressDropCount;
|
|
30906
|
+
}
|
|
30907
|
+
/**
|
|
30908
|
+
* The leg's diagnostics as one object with the shared names
|
|
30909
|
+
* (`DatagramLegDiagnostics`): the player supplies what it alone counts and
|
|
30910
|
+
* spreads the result into its published FEC stats while a leg is up.
|
|
30911
|
+
*/
|
|
30912
|
+
datagramLegDiagnostics(player) {
|
|
30913
|
+
return {
|
|
30914
|
+
datagramLegJoined: player.joined,
|
|
30915
|
+
datagramLegIngressDrops: this.#router.datagramLegIngressDropCount,
|
|
30916
|
+
datagramLegRepairBeforePacketId: player.repairBeforePacketId,
|
|
30917
|
+
datagramUnknownAlias: player.unknownAlias,
|
|
30918
|
+
transport: { maxDatagramSize: player.maxDatagramSize ?? null }
|
|
30919
|
+
};
|
|
30920
|
+
}
|
|
30487
30921
|
/**
|
|
30488
30922
|
* Declare how packets given to feedPacket() reach this manager. A consumer
|
|
30489
30923
|
* that owns the multicast socket itself declares its own leg; join()
|
|
@@ -31853,15 +32287,15 @@ function asSeconds(n) {
|
|
|
31853
32287
|
}
|
|
31854
32288
|
return n;
|
|
31855
32289
|
}
|
|
31856
|
-
function groupIdForTicks(ticks,
|
|
32290
|
+
function groupIdForTicks(ticks, groupDurationTicks2, presentationAnchorTicks = 0) {
|
|
31857
32291
|
if (!Number.isInteger(ticks)) {
|
|
31858
32292
|
throw new Error(
|
|
31859
32293
|
`[align] groupIdForTicks: ticks must be an integer, got ${ticks}`
|
|
31860
32294
|
);
|
|
31861
32295
|
}
|
|
31862
|
-
if (!Number.isInteger(
|
|
32296
|
+
if (!Number.isInteger(groupDurationTicks2) || groupDurationTicks2 <= 0) {
|
|
31863
32297
|
throw new Error(
|
|
31864
|
-
`[align] groupIdForTicks: groupDurationTicks must be a positive integer, got ${
|
|
32298
|
+
`[align] groupIdForTicks: groupDurationTicks must be a positive integer, got ${groupDurationTicks2}`
|
|
31865
32299
|
);
|
|
31866
32300
|
}
|
|
31867
32301
|
if (!Number.isInteger(presentationAnchorTicks)) {
|
|
@@ -31880,7 +32314,7 @@ function groupIdForTicks(ticks, groupDurationTicks, presentationAnchorTicks = 0)
|
|
|
31880
32314
|
`[align] groupIdForTicks: ticks ${ticks} precede presentationAnchorTicks ${presentationAnchorTicks}; the publisher must reject this MPU (moq-mmt-01 4.4.1)`
|
|
31881
32315
|
);
|
|
31882
32316
|
}
|
|
31883
|
-
return Math.floor(relativeTicks /
|
|
32317
|
+
return Math.floor(relativeTicks / groupDurationTicks2);
|
|
31884
32318
|
}
|
|
31885
32319
|
function groupIdFor(mediaTimeSec, groupDurationSec) {
|
|
31886
32320
|
if (!Number.isFinite(mediaTimeSec)) {
|
|
@@ -33105,6 +33539,234 @@ function resolveCatalogTrackFec(catalog, tracks) {
|
|
|
33105
33539
|
};
|
|
33106
33540
|
}
|
|
33107
33541
|
|
|
33542
|
+
// src/mmtp-mode-selection.ts
|
|
33543
|
+
function selectMmtpMode(input) {
|
|
33544
|
+
if (input.transportPolicy === "multicast-only") return { mode: "mfu", reason: "multicast-only" };
|
|
33545
|
+
if (input.override === "mfu") return { mode: "mfu", reason: "override" };
|
|
33546
|
+
if (!input.datagramSibling) return { mode: "mfu", reason: "no-datagram-sibling" };
|
|
33547
|
+
if (input.datagramFecDecodable === false) return { mode: "mfu", reason: "datagram-fec-undecodable" };
|
|
33548
|
+
if (input.override === "mfu-datagram") {
|
|
33549
|
+
return input.unreliable ? { mode: "mfu-datagram", reason: "override" } : { mode: "mfu", reason: "override-refused-reliable" };
|
|
33550
|
+
}
|
|
33551
|
+
if (!input.unreliable) return { mode: "mfu", reason: "reliable-session" };
|
|
33552
|
+
if (input.maxDatagramSize !== void 0 && input.symbolSize !== void 0 && input.maxDatagramSize < datagramLegObjectMax(input.symbolSize)) {
|
|
33553
|
+
return { mode: "mfu", reason: "repair-object-too-large" };
|
|
33554
|
+
}
|
|
33555
|
+
return { mode: "mfu-datagram", reason: "datagram" };
|
|
33556
|
+
}
|
|
33557
|
+
|
|
33558
|
+
// src/datagram-leg-deadline.ts
|
|
33559
|
+
var positive = (value) => typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
33560
|
+
function fecWindow(fec) {
|
|
33561
|
+
if (!Array.isArray(fec) || !positive(fec[0]?.interleaveDepthMs)) return void 0;
|
|
33562
|
+
let window2 = 0;
|
|
33563
|
+
for (const instance of fec) {
|
|
33564
|
+
const tolerance = instance?.reorderToleranceMs;
|
|
33565
|
+
if (tolerance !== void 0 && !(typeof tolerance === "number" && Number.isFinite(tolerance) && tolerance >= 0)) {
|
|
33566
|
+
return void 0;
|
|
33567
|
+
}
|
|
33568
|
+
if (!positive(instance?.interleaveDepthMs)) continue;
|
|
33569
|
+
try {
|
|
33570
|
+
window2 = Math.max(window2, fecSpanDeliveryWindowMs(instance.interleaveDepthMs, tolerance));
|
|
33571
|
+
} catch {
|
|
33572
|
+
return void 0;
|
|
33573
|
+
}
|
|
33574
|
+
}
|
|
33575
|
+
return window2;
|
|
33576
|
+
}
|
|
33577
|
+
function computeDatagramLegDeadlines(input) {
|
|
33578
|
+
const window2 = fecWindow(input?.fec);
|
|
33579
|
+
if (window2 === void 0) return { take: false, reason: "no-fec-span" };
|
|
33580
|
+
const group = input.groupDurationMs;
|
|
33581
|
+
if (!positive(group)) return { take: false, reason: "no-group-duration", fecWindowMs: window2 };
|
|
33582
|
+
const delay = input.delayTargetMs;
|
|
33583
|
+
if (!positive(delay)) return { take: false, reason: "no-delay-target", fecWindowMs: window2 };
|
|
33584
|
+
const unit = positive(input.mediaUnitMs) ? input.mediaUnitMs : 0;
|
|
33585
|
+
const tolerance = input.fec[0]?.reorderToleranceMs;
|
|
33586
|
+
const fits = window2 <= delay;
|
|
33587
|
+
return {
|
|
33588
|
+
take: fits || input.forced === true,
|
|
33589
|
+
reason: fits ? "ok" : "fec-window-exceeds-delay-target",
|
|
33590
|
+
fecWindowMs: window2,
|
|
33591
|
+
joinDarkMs: Math.ceil(group + window2),
|
|
33592
|
+
darkMs: Math.ceil(Math.max(delay, window2)),
|
|
33593
|
+
noFrameMs: Math.ceil(Math.max(delay, group + unit + window2)),
|
|
33594
|
+
confirmMs: positive(tolerance) ? tolerance : unit
|
|
33595
|
+
};
|
|
33596
|
+
}
|
|
33597
|
+
var DatagramLegWatch = class {
|
|
33598
|
+
#options;
|
|
33599
|
+
#setTimeout;
|
|
33600
|
+
#clearTimeout;
|
|
33601
|
+
#now;
|
|
33602
|
+
#limits;
|
|
33603
|
+
#timer;
|
|
33604
|
+
#stopped = false;
|
|
33605
|
+
#pausedMs = 0;
|
|
33606
|
+
#pausedAt;
|
|
33607
|
+
#joinAt;
|
|
33608
|
+
#lastSourceAt;
|
|
33609
|
+
#frameClockAt;
|
|
33610
|
+
#chain = false;
|
|
33611
|
+
#suspect;
|
|
33612
|
+
constructor(options) {
|
|
33613
|
+
this.#options = options;
|
|
33614
|
+
const timers = options.timers;
|
|
33615
|
+
this.#setTimeout = (handler, ms) => timers ? timers.setTimeout(handler, ms) : setTimeout(handler, ms);
|
|
33616
|
+
this.#clearTimeout = (handle) => timers ? timers.clearTimeout(handle) : clearTimeout(handle);
|
|
33617
|
+
this.#now = options.now ?? (() => typeof performance === "undefined" ? Date.now() : performance.now());
|
|
33618
|
+
this.#joinAt = this.#clock();
|
|
33619
|
+
this.#arm();
|
|
33620
|
+
}
|
|
33621
|
+
/** SUBSCRIBE_OK: the join clock starts again. */
|
|
33622
|
+
subscribed() {
|
|
33623
|
+
if (this.#stopped || this.#lastSourceAt !== void 0) return;
|
|
33624
|
+
this.#joinAt = this.#clock();
|
|
33625
|
+
}
|
|
33626
|
+
/** A source object of the track arrived as a datagram. Never call it for repair, fill or FETCH objects. */
|
|
33627
|
+
source() {
|
|
33628
|
+
if (this.#stopped) return;
|
|
33629
|
+
const at2 = this.#clock();
|
|
33630
|
+
const first = this.#lastSourceAt === void 0;
|
|
33631
|
+
this.#lastSourceAt = at2;
|
|
33632
|
+
this.#frameClockAt ??= at2;
|
|
33633
|
+
if (first) this.#arm();
|
|
33634
|
+
}
|
|
33635
|
+
/**
|
|
33636
|
+
* A frame left the leg. Without `meta` every frame counts (audio, or a sink
|
|
33637
|
+
* that already counts decodable frames). With `meta` a frame counts when it
|
|
33638
|
+
* is a keyframe, or stands behind one with no stall decision between.
|
|
33639
|
+
*/
|
|
33640
|
+
frame(meta) {
|
|
33641
|
+
if (this.#stopped) return;
|
|
33642
|
+
if (meta !== void 0) {
|
|
33643
|
+
if (meta.keyframe === true) this.#chain = true;
|
|
33644
|
+
else if (meta.gapBefore?.action === "stall") this.#chain = false;
|
|
33645
|
+
if (!this.#chain) return;
|
|
33646
|
+
}
|
|
33647
|
+
if (this.#frameClockAt !== void 0) this.#frameClockAt = this.#clock();
|
|
33648
|
+
}
|
|
33649
|
+
/** false while the player itself does not read the track: that time is not silence. */
|
|
33650
|
+
setReading(reading) {
|
|
33651
|
+
if (this.#stopped) return;
|
|
33652
|
+
if (!reading) {
|
|
33653
|
+
this.#pausedAt ??= this.#now();
|
|
33654
|
+
return;
|
|
33655
|
+
}
|
|
33656
|
+
if (this.#pausedAt === void 0) return;
|
|
33657
|
+
this.#pausedMs += this.#now() - this.#pausedAt;
|
|
33658
|
+
this.#pausedAt = void 0;
|
|
33659
|
+
if (this.#timer === void 0) this.#arm();
|
|
33660
|
+
}
|
|
33661
|
+
/**
|
|
33662
|
+
* The limits moved: arm on the new ones now. Call it when the delay target
|
|
33663
|
+
* shrinks, and when `limits()` first has numbers after the watch started
|
|
33664
|
+
* without them: an unarmed watch stays unarmed through frames and through
|
|
33665
|
+
* every source datagram but the first.
|
|
33666
|
+
*/
|
|
33667
|
+
refresh() {
|
|
33668
|
+
if (this.#stopped) return;
|
|
33669
|
+
this.#suspect = void 0;
|
|
33670
|
+
this.#arm();
|
|
33671
|
+
}
|
|
33672
|
+
stop() {
|
|
33673
|
+
this.#stopped = true;
|
|
33674
|
+
this.#clear();
|
|
33675
|
+
}
|
|
33676
|
+
/** The leg's own time: it stands still while the player is not reading. */
|
|
33677
|
+
#clock() {
|
|
33678
|
+
return (this.#pausedAt ?? this.#now()) - this.#pausedMs;
|
|
33679
|
+
}
|
|
33680
|
+
#clear() {
|
|
33681
|
+
if (this.#timer === void 0) return;
|
|
33682
|
+
this.#clearTimeout(this.#timer);
|
|
33683
|
+
this.#timer = void 0;
|
|
33684
|
+
}
|
|
33685
|
+
#readLimits() {
|
|
33686
|
+
const next = this.#options.limits();
|
|
33687
|
+
const usable = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
33688
|
+
if (next && usable(next.joinDarkMs) && usable(next.darkMs) && usable(next.noFrameMs)) {
|
|
33689
|
+
this.#limits = {
|
|
33690
|
+
joinDarkMs: next.joinDarkMs,
|
|
33691
|
+
darkMs: next.darkMs,
|
|
33692
|
+
noFrameMs: next.noFrameMs,
|
|
33693
|
+
confirmMs: usable(next.confirmMs) ? next.confirmMs : 0
|
|
33694
|
+
};
|
|
33695
|
+
}
|
|
33696
|
+
return this.#limits;
|
|
33697
|
+
}
|
|
33698
|
+
#clocks(limits) {
|
|
33699
|
+
const joining = this.#lastSourceAt === void 0 && this.#options.joinsAtNextGroup;
|
|
33700
|
+
const clocks = [
|
|
33701
|
+
{
|
|
33702
|
+
clock: "dark",
|
|
33703
|
+
since: this.#lastSourceAt ?? this.#joinAt,
|
|
33704
|
+
limit: joining ? limits.joinDarkMs : limits.darkMs
|
|
33705
|
+
}
|
|
33706
|
+
];
|
|
33707
|
+
if (this.#frameClockAt !== void 0) {
|
|
33708
|
+
clocks.push({ clock: "frame", since: this.#frameClockAt, limit: limits.noFrameMs });
|
|
33709
|
+
}
|
|
33710
|
+
return clocks;
|
|
33711
|
+
}
|
|
33712
|
+
#arm() {
|
|
33713
|
+
this.#clear();
|
|
33714
|
+
if (this.#stopped || this.#pausedAt !== void 0) return;
|
|
33715
|
+
const limits = this.#readLimits();
|
|
33716
|
+
if (!limits) return;
|
|
33717
|
+
const at2 = this.#clock();
|
|
33718
|
+
let wait = Number.POSITIVE_INFINITY;
|
|
33719
|
+
for (const clock of this.#clocks(limits)) {
|
|
33720
|
+
wait = Math.min(wait, clock.since + clock.limit - limits.confirmMs - at2);
|
|
33721
|
+
}
|
|
33722
|
+
this.#timer = this.#setTimeout(() => this.#suspectTurn(), Math.max(0, wait));
|
|
33723
|
+
}
|
|
33724
|
+
#suspectTurn() {
|
|
33725
|
+
this.#timer = void 0;
|
|
33726
|
+
if (this.#stopped || this.#pausedAt !== void 0) return;
|
|
33727
|
+
const limits = this.#readLimits();
|
|
33728
|
+
if (!limits) return;
|
|
33729
|
+
const at2 = this.#clock();
|
|
33730
|
+
const reached = this.#clocks(limits).find((clock) => at2 >= clock.since + clock.limit - limits.confirmMs);
|
|
33731
|
+
if (!reached) {
|
|
33732
|
+
this.#arm();
|
|
33733
|
+
return;
|
|
33734
|
+
}
|
|
33735
|
+
this.#suspect = { clock: reached.clock, since: reached.since };
|
|
33736
|
+
this.#timer = this.#setTimeout(() => this.#verdictTurn(), limits.confirmMs);
|
|
33737
|
+
}
|
|
33738
|
+
#verdictTurn() {
|
|
33739
|
+
this.#timer = void 0;
|
|
33740
|
+
const suspect = this.#suspect;
|
|
33741
|
+
this.#suspect = void 0;
|
|
33742
|
+
if (this.#stopped || suspect === void 0 || this.#pausedAt !== void 0) return;
|
|
33743
|
+
const limits = this.#readLimits();
|
|
33744
|
+
if (!limits) return;
|
|
33745
|
+
const at2 = this.#clock();
|
|
33746
|
+
const clock = this.#clocks(limits).find((candidate) => candidate.clock === suspect.clock);
|
|
33747
|
+
if (!clock || clock.since !== suspect.since) {
|
|
33748
|
+
this.#arm();
|
|
33749
|
+
return;
|
|
33750
|
+
}
|
|
33751
|
+
const silentMs = at2 - clock.since;
|
|
33752
|
+
if (silentMs < clock.limit) {
|
|
33753
|
+
this.#suspect = suspect;
|
|
33754
|
+
this.#timer = this.#setTimeout(() => this.#verdictTurn(), clock.limit - silentMs);
|
|
33755
|
+
return;
|
|
33756
|
+
}
|
|
33757
|
+
this.#stopped = true;
|
|
33758
|
+
const joining = this.#lastSourceAt === void 0 && this.#options.joinsAtNextGroup;
|
|
33759
|
+
const verdict = clock.clock === "frame" ? "no-frame" : joining ? "join" : "dark";
|
|
33760
|
+
this.#options.onVerdict(verdict, silentMs, clock.limit);
|
|
33761
|
+
}
|
|
33762
|
+
};
|
|
33763
|
+
var wholeCount = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : 0;
|
|
33764
|
+
function datagramLegRetryDelayMs(joinDarkMs, n, rand) {
|
|
33765
|
+
if (!positive(joinDarkMs)) return void 0;
|
|
33766
|
+
const jitter = typeof rand === "number" && rand >= 0 && rand < 1 ? rand : 0;
|
|
33767
|
+
return Math.ceil(joinDarkMs * 2 ** wholeCount(n) * (1 + jitter));
|
|
33768
|
+
}
|
|
33769
|
+
|
|
33108
33770
|
// src/mmtp-fec-session.ts
|
|
33109
33771
|
var PATH_BITS = { moq: 1, multicast: 2 };
|
|
33110
33772
|
var MIXED_PATHS = PATH_BITS.moq | PATH_BITS.multicast;
|
|
@@ -33784,6 +34446,7 @@ function wireRepairFetch(mc, opts) {
|
|
|
33784
34446
|
const run = entry.running;
|
|
33785
34447
|
if (!run) return;
|
|
33786
34448
|
entry.running = null;
|
|
34449
|
+
if (run.mootTimer !== void 0) clearTimeout(run.mootTimer);
|
|
33787
34450
|
run.stopped = reason;
|
|
33788
34451
|
run.controller.abort(reason);
|
|
33789
34452
|
if (reason === "preempted") releaseHold(entry);
|
|
@@ -33797,8 +34460,9 @@ function wireRepairFetch(mc, opts) {
|
|
|
33797
34460
|
const moot = (entry) => {
|
|
33798
34461
|
if (entry.priority !== 0) return false;
|
|
33799
34462
|
const rttMs = readRtt();
|
|
33800
|
-
const
|
|
33801
|
-
|
|
34463
|
+
const now = performance.now();
|
|
34464
|
+
const sentAt = entry.running?.sentAt ?? now;
|
|
34465
|
+
if (rttMs !== null && now < entry.playoutDeadlineAt && sentAt + rttMs < entry.playoutDeadlineAt) return false;
|
|
33802
34466
|
const last = lastSsId(entry);
|
|
33803
34467
|
if (last === void 0) return false;
|
|
33804
34468
|
try {
|
|
@@ -33807,6 +34471,31 @@ function wireRepairFetch(mc, opts) {
|
|
|
33807
34471
|
return false;
|
|
33808
34472
|
}
|
|
33809
34473
|
};
|
|
34474
|
+
const dropMoot = (entry) => {
|
|
34475
|
+
stop(entry, "moot");
|
|
34476
|
+
retire(entry);
|
|
34477
|
+
releaseHold(entry);
|
|
34478
|
+
clearEntry(entry);
|
|
34479
|
+
};
|
|
34480
|
+
const mootAtPlayout = (entry) => {
|
|
34481
|
+
const run = entry.running;
|
|
34482
|
+
if (run === null || run.mootTimer !== void 0 || entry.priority !== 0) return;
|
|
34483
|
+
const last = lastSsId(entry);
|
|
34484
|
+
if (last === void 0) return;
|
|
34485
|
+
try {
|
|
34486
|
+
if (mc.rapCompleteAbove?.(entry.packetId, entry.catalogTrackName, last) !== true) return;
|
|
34487
|
+
} catch {
|
|
34488
|
+
return;
|
|
34489
|
+
}
|
|
34490
|
+
run.mootTimer = setTimeout(() => {
|
|
34491
|
+
run.mootTimer = void 0;
|
|
34492
|
+
if (disposed || entry.running !== run) return;
|
|
34493
|
+
if (performance.now() < entry.playoutDeadlineAt) return mootAtPlayout(entry);
|
|
34494
|
+
if (!moot(entry)) return;
|
|
34495
|
+
dropMoot(entry);
|
|
34496
|
+
dispatch();
|
|
34497
|
+
}, Math.max(0, entry.playoutDeadlineAt - performance.now()));
|
|
34498
|
+
};
|
|
33810
34499
|
const skip = (entry, reason, rttMs, budgetMs) => {
|
|
33811
34500
|
retire(entry);
|
|
33812
34501
|
releaseHold(entry);
|
|
@@ -33917,6 +34606,7 @@ function wireRepairFetch(mc, opts) {
|
|
|
33917
34606
|
});
|
|
33918
34607
|
const run = { controller: new AbortController(), sentAt: now, stopped: null };
|
|
33919
34608
|
entry.running = run;
|
|
34609
|
+
mootAtPlayout(entry);
|
|
33920
34610
|
if (!entry.range) {
|
|
33921
34611
|
mc.fecManager.holdBlockForRepair(
|
|
33922
34612
|
entry.sbn,
|
|
@@ -34001,6 +34691,7 @@ function wireRepairFetch(mc, opts) {
|
|
|
34001
34691
|
return;
|
|
34002
34692
|
}
|
|
34003
34693
|
entry.running = null;
|
|
34694
|
+
if (run.mootTimer !== void 0) clearTimeout(run.mootTimer);
|
|
34004
34695
|
if (error === void 0) {
|
|
34005
34696
|
retire(entry);
|
|
34006
34697
|
if (entry.range || fed === 0 || !decodable(entry)) {
|
|
@@ -34163,6 +34854,22 @@ function wireRepairFetch(mc, opts) {
|
|
|
34163
34854
|
dispatch();
|
|
34164
34855
|
return;
|
|
34165
34856
|
}
|
|
34857
|
+
if (event.type === "gap") {
|
|
34858
|
+
if (event.action !== "stall" || event.reason !== "discontinuity") return;
|
|
34859
|
+
const now = performance.now();
|
|
34860
|
+
let expired = false;
|
|
34861
|
+
for (const entry2 of [...entries.values()]) {
|
|
34862
|
+
if (entry2.packetId !== event.stream.packetId) continue;
|
|
34863
|
+
if (entry2.catalogTrackName !== (event.stream.catalogTrackName ?? void 0)) continue;
|
|
34864
|
+
if (!entry2.running || entry2.deadlineAt > now) continue;
|
|
34865
|
+
stop(entry2, "expired");
|
|
34866
|
+
retire(entry2);
|
|
34867
|
+
clearEntry(entry2);
|
|
34868
|
+
expired = true;
|
|
34869
|
+
}
|
|
34870
|
+
if (expired) dispatch();
|
|
34871
|
+
return;
|
|
34872
|
+
}
|
|
34166
34873
|
if (event.type !== "recovered" && event.type !== "failed") return;
|
|
34167
34874
|
const entry = entries.get(
|
|
34168
34875
|
requestKey(event.block.sbn, event.block.packetId, event.block.catalogTrackName ?? void 0)
|
|
@@ -34411,11 +35118,9 @@ function wireRepairFetch(mc, opts) {
|
|
|
34411
35118
|
queueMicrotask(() => {
|
|
34412
35119
|
if (disposed) return;
|
|
34413
35120
|
for (const entry of [...entries.values()]) {
|
|
34414
|
-
if (entry.packetId !== packetId || !entry.running
|
|
34415
|
-
|
|
34416
|
-
|
|
34417
|
-
releaseHold(entry);
|
|
34418
|
-
clearEntry(entry);
|
|
35121
|
+
if (entry.packetId !== packetId || !entry.running) continue;
|
|
35122
|
+
if (moot(entry)) dropMoot(entry);
|
|
35123
|
+
else mootAtPlayout(entry);
|
|
34419
35124
|
}
|
|
34420
35125
|
dispatch();
|
|
34421
35126
|
});
|
|
@@ -34461,6 +35166,7 @@ export {
|
|
|
34461
35166
|
CmsfCatalogValidationError,
|
|
34462
35167
|
DEFAULT_AMT_RELAY_PORT,
|
|
34463
35168
|
DEFAULT_REPAIR_PRIORITY,
|
|
35169
|
+
DatagramLegWatch,
|
|
34464
35170
|
DeliveryGapEstimator,
|
|
34465
35171
|
FECManager,
|
|
34466
35172
|
FEC_BLOCK_PROFILES,
|
|
@@ -34527,11 +35233,13 @@ export {
|
|
|
34527
35233
|
classifyHevcKeyframe,
|
|
34528
35234
|
classifyPacket,
|
|
34529
35235
|
codecStringFromAvcC,
|
|
35236
|
+
computeDatagramLegDeadlines,
|
|
34530
35237
|
computeFecDeliveryWindowMediaUnits,
|
|
34531
35238
|
computeFecDeliveryWindowMs,
|
|
34532
35239
|
computeFecLossWindowMs,
|
|
34533
35240
|
createFragment,
|
|
34534
35241
|
createWasmMmtpContainerParser,
|
|
35242
|
+
datagramLegRetryDelayMs,
|
|
34535
35243
|
datagramMfuReassembly,
|
|
34536
35244
|
decideGap,
|
|
34537
35245
|
decodeFecSourceInfo,
|
|
@@ -34593,6 +35301,7 @@ export {
|
|
|
34593
35301
|
mfuReassemblyTimeoutMs,
|
|
34594
35302
|
mmtpFrameReorderWindowFrames,
|
|
34595
35303
|
mmtpTimestampToMicros,
|
|
35304
|
+
mmtpTrackIssues,
|
|
34596
35305
|
multicastFromConfig,
|
|
34597
35306
|
multicastFromEnv,
|
|
34598
35307
|
normalizeDeliveryCatalog,
|
|
@@ -34621,6 +35330,7 @@ export {
|
|
|
34621
35330
|
resolveRepairLayers,
|
|
34622
35331
|
runtimeFecCatalogReport,
|
|
34623
35332
|
secondsFromTicks,
|
|
35333
|
+
selectMmtpMode,
|
|
34624
35334
|
setupFecWorkerForTrack,
|
|
34625
35335
|
setupTrackPipeline,
|
|
34626
35336
|
splitAnnexBNalUnits,
|