@blockcast/mmt-container 2.2.0-main.e1bebe787bc9 → 2.2.0-main.ea9223dc11de
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/block-policy.d.ts +33 -3
- package/dist/block-policy.d.ts.map +1 -1
- package/dist/block-policy.js +60 -24
- package/dist/block-policy.js.map +3 -3
- package/dist/browser-runtime.js +1034 -126
- 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.js +34 -0
- 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 +117 -13
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +358 -42
- package/dist/fec-manager.js.map +4 -4
- 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.d.ts +16 -0
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +62 -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.d.ts +6 -3
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- 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 +167 -13
- 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 +66 -10
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +204 -30
- 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 +95 -1
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +613 -92
- 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 +167 -13
- 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.map +1 -1
- package/dist/repair-fetch.js +50 -0
- 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/block-policy.ts +108 -31
- package/src/carp-catalog.ts +165 -5
- package/src/datagram-leg-deadline.ts +370 -0
- package/src/fec-manager.ts +345 -33
- package/src/fec-state.ts +21 -5
- package/src/index.ts +37 -0
- package/src/iso-block-locator.ts +34 -0
- package/src/mmtp-container-parser.ts +6 -4
- package/src/mmtp-mode-selection.ts +80 -0
- package/src/mmtp-router.ts +226 -45
- package/src/multicast-manager.ts +126 -0
- package/src/phase14-catalog-override.ts +14 -3
- package/src/repair-fetch.ts +23 -0
- 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
|
@@ -1062,6 +1062,40 @@ function geometry(o, instanceId, symbolTrack) {
|
|
|
1062
1062
|
});
|
|
1063
1063
|
}
|
|
1064
1064
|
|
|
1065
|
+
// ../mmt-base/dist/mmtp-siblings.js
|
|
1066
|
+
var MMTP_MODES = Object.freeze(["mfu", "mfu-datagram"]);
|
|
1067
|
+
var MMTP_SIBLING_HARD_FIELDS = Object.freeze([
|
|
1068
|
+
"namespace",
|
|
1069
|
+
"timescale",
|
|
1070
|
+
"presentationAnchorTicks",
|
|
1071
|
+
"groupDuration"
|
|
1072
|
+
]);
|
|
1073
|
+
var MMTP_SIBLING_RENDITION_FIELDS = Object.freeze([
|
|
1074
|
+
"codec",
|
|
1075
|
+
"width",
|
|
1076
|
+
"height",
|
|
1077
|
+
"framerate",
|
|
1078
|
+
"bitrate",
|
|
1079
|
+
"samplerate",
|
|
1080
|
+
"channelConfig",
|
|
1081
|
+
"lang"
|
|
1082
|
+
]);
|
|
1083
|
+
var MMTP_SIBLING_SOFT_FIELDS = Object.freeze([
|
|
1084
|
+
"initRef",
|
|
1085
|
+
"keyframeIntervalMs",
|
|
1086
|
+
"keyframeIntervalTicks",
|
|
1087
|
+
"isLive",
|
|
1088
|
+
"altGroup"
|
|
1089
|
+
]);
|
|
1090
|
+
|
|
1091
|
+
// ../mmt-base/dist/datagram-leg-size.js
|
|
1092
|
+
var DATAGRAM_LEG_UDP_FLOOR = 1200;
|
|
1093
|
+
var DATAGRAM_LEG_QUIC_WT_FRAMING = 48;
|
|
1094
|
+
var DATAGRAM_LEG_OBJECT_HEADER = 13;
|
|
1095
|
+
var DATAGRAM_LEG_RELAY_ROOM = 16;
|
|
1096
|
+
var DATAGRAM_LEG_DATAGRAM_MAX = DATAGRAM_LEG_UDP_FLOOR - DATAGRAM_LEG_QUIC_WT_FRAMING;
|
|
1097
|
+
var DATAGRAM_LEG_BODY_MAX = DATAGRAM_LEG_DATAGRAM_MAX - DATAGRAM_LEG_OBJECT_HEADER - DATAGRAM_LEG_RELAY_ROOM;
|
|
1098
|
+
|
|
1065
1099
|
// src/track-session.ts
|
|
1066
1100
|
import { fecBlockBudgetMs } from "@blockcast/mmt-fec";
|
|
1067
1101
|
function computeFecDeliveryWindowMs(config) {
|
|
@@ -1372,6 +1406,34 @@ var IsoBlockLocator = class _IsoBlockLocator {
|
|
|
1372
1406
|
isHeld(ssId) {
|
|
1373
1407
|
return this.#held.has(ssId);
|
|
1374
1408
|
}
|
|
1409
|
+
/** The payload held unplaced for `ssId`, if any. */
|
|
1410
|
+
heldSource(ssId) {
|
|
1411
|
+
return this.#held.get(ssId);
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* The SS_IDs strictly between `a` and `b` that no repair has delimited a
|
|
1415
|
+
* block of yet: those from the coverage end on, or all of them before the
|
|
1416
|
+
* first repair. `missing` is the highest of them no source is held for;
|
|
1417
|
+
* absent, every one of them arrived (C.5.2: SS_IDs are consecutive). Null
|
|
1418
|
+
* when none lies past coverage. `flagged` is whether a source held among
|
|
1419
|
+
* them satisfies `flag` (a RAP fragment, say): the held packets read as
|
|
1420
|
+
* fec-multicast-00 Block Classification item 1 reads bounding packets.
|
|
1421
|
+
*/
|
|
1422
|
+
undelimitedBetween(a, b, flag) {
|
|
1423
|
+
if (!serial32Precedes(a, b) || serial32Distance(a, b) <= 1) return null;
|
|
1424
|
+
const first = a + 1 >>> 0;
|
|
1425
|
+
const end = this.#coverageEnd;
|
|
1426
|
+
const start = end !== void 0 && serial32Precedes(first, end) ? end : first;
|
|
1427
|
+
if (!serial32Precedes(start, b)) return null;
|
|
1428
|
+
const length = serial32Distance(start, b);
|
|
1429
|
+
const missing = this.#highestMissing(start, length);
|
|
1430
|
+
let flagged = false;
|
|
1431
|
+
for (let i = 0; flag !== void 0 && !flagged && i < length; i++) {
|
|
1432
|
+
const payload = this.#held.get(serial32Add(start, i));
|
|
1433
|
+
flagged = payload !== void 0 && flag(payload);
|
|
1434
|
+
}
|
|
1435
|
+
return missing === void 0 ? { start, flagged } : { start, missing, flagged };
|
|
1436
|
+
}
|
|
1375
1437
|
/**
|
|
1376
1438
|
* Apply one repair symbol's `(SS_Start, SSB_length)`. The first repair of a
|
|
1377
1439
|
* block states its range and places every held source in it; later repair
|
|
@@ -1617,31 +1679,26 @@ function deriveBlockClassifierGeometry(input) {
|
|
|
1617
1679
|
);
|
|
1618
1680
|
}
|
|
1619
1681
|
if (input.trackKind === "audio") return { trackKind: "audio" };
|
|
1620
|
-
if (!isPositiveFinite(input.framerate)) {
|
|
1621
|
-
return { trackKind: "video", mode: "all-protected", reason: "framerate-absent" };
|
|
1622
|
-
}
|
|
1623
|
-
const framerate = input.framerate;
|
|
1624
1682
|
let keyframeInterval;
|
|
1625
1683
|
if (isPositiveFinite(input.keyframeIntervalTicks) && isPositiveFinite(input.timescale)) {
|
|
1626
1684
|
keyframeInterval = { ticks: input.keyframeIntervalTicks, timescale: input.timescale };
|
|
1627
1685
|
} else if (isPositiveFinite(input.keyframeIntervalMs)) {
|
|
1628
1686
|
keyframeInterval = { ticks: input.keyframeIntervalMs, timescale: 1e3 };
|
|
1629
|
-
} else {
|
|
1630
|
-
return { trackKind: "video", mode: "all-protected", reason: "keyframe-cadence-absent" };
|
|
1631
1687
|
}
|
|
1688
|
+
const protect = (reason) => ({
|
|
1689
|
+
trackKind: "video",
|
|
1690
|
+
mode: "all-protected",
|
|
1691
|
+
reason,
|
|
1692
|
+
...keyframeInterval === void 0 ? {} : { keyframeInterval }
|
|
1693
|
+
});
|
|
1694
|
+
if (!isPositiveFinite(input.framerate)) return protect("framerate-absent");
|
|
1695
|
+
const framerate = input.framerate;
|
|
1696
|
+
if (keyframeInterval === void 0) return protect("keyframe-cadence-absent");
|
|
1632
1697
|
const gopFrames = exactInteger(keyframeInterval.ticks * framerate, keyframeInterval.timescale);
|
|
1633
|
-
if (gopFrames === null)
|
|
1634
|
-
return {
|
|
1635
|
-
trackKind: "video",
|
|
1636
|
-
mode: "all-protected",
|
|
1637
|
-
reason: "keyframe-interval-not-integral"
|
|
1638
|
-
};
|
|
1639
|
-
}
|
|
1698
|
+
if (gopFrames === null) return protect("keyframe-interval-not-integral");
|
|
1640
1699
|
const frameDurationMs = 1e3 / framerate;
|
|
1641
1700
|
const interleaveUnits = deriveFecInterleaveDepth(input.interleaveDepthMs, frameDurationMs);
|
|
1642
|
-
if (interleaveUnits >= gopFrames)
|
|
1643
|
-
return { trackKind: "video", mode: "all-protected", reason: "block-spans-gop" };
|
|
1644
|
-
}
|
|
1701
|
+
if (interleaveUnits >= gopFrames) return protect("block-spans-gop");
|
|
1645
1702
|
return {
|
|
1646
1703
|
trackKind: "video",
|
|
1647
1704
|
mode: "classifying",
|
|
@@ -1652,7 +1709,7 @@ function deriveBlockClassifierGeometry(input) {
|
|
|
1652
1709
|
};
|
|
1653
1710
|
}
|
|
1654
1711
|
function keyframeIntervalMediaTicks(geometry2, mediaTimescale) {
|
|
1655
|
-
if (geometry2.trackKind !== "video" || geometry2.
|
|
1712
|
+
if (geometry2.trackKind !== "video" || geometry2.keyframeInterval === void 0) return null;
|
|
1656
1713
|
if (!Number.isSafeInteger(mediaTimescale) || mediaTimescale <= 0) return null;
|
|
1657
1714
|
const { ticks, timescale } = geometry2.keyframeInterval;
|
|
1658
1715
|
if (!Number.isSafeInteger(ticks) || !Number.isSafeInteger(timescale)) return null;
|
|
@@ -1661,9 +1718,14 @@ function keyframeIntervalMediaTicks(geometry2, mediaTimescale) {
|
|
|
1661
1718
|
if (scaled % divisor !== 0n) return null;
|
|
1662
1719
|
return scaled / divisor;
|
|
1663
1720
|
}
|
|
1721
|
+
function keyframeInstantBetween(start, interval, from, to) {
|
|
1722
|
+
const k = from >= start ? (from - start) / interval + 1n : 1n;
|
|
1723
|
+
return start + k * interval <= to;
|
|
1724
|
+
}
|
|
1664
1725
|
function compareDataUnitStarts(a, b) {
|
|
1665
1726
|
return a.movieFragment - b.movieFragment | 0 || a.idx - b.idx || a.offset - b.offset;
|
|
1666
1727
|
}
|
|
1728
|
+
var LATE_RAP_MAX_MPUS_BACK = 64;
|
|
1667
1729
|
var UNPLACED = { rapNotMpuStart: false };
|
|
1668
1730
|
var BlockClassifier = class {
|
|
1669
1731
|
#geometry;
|
|
@@ -1704,6 +1766,7 @@ var BlockClassifier = class {
|
|
|
1704
1766
|
#lastAnchor = null;
|
|
1705
1767
|
/** Two anchors were exactly G fragments per MPU apart. */
|
|
1706
1768
|
#fragmentsProven = false;
|
|
1769
|
+
/** The first RAP released of the latest MPU a RAP was released in, recorded in every mode. */
|
|
1707
1770
|
#lastRap = null;
|
|
1708
1771
|
constructor(geometry2) {
|
|
1709
1772
|
this.#geometry = geometry2;
|
|
@@ -1774,6 +1837,7 @@ var BlockClassifier = class {
|
|
|
1774
1837
|
noteSourceDiscontinuity() {
|
|
1775
1838
|
this.#clearContiguityLedger();
|
|
1776
1839
|
this.#clearMpuLayout();
|
|
1840
|
+
this.#lastRap = null;
|
|
1777
1841
|
}
|
|
1778
1842
|
/** Register a block that exists without evidence (a vanished block). */
|
|
1779
1843
|
touch(sbn) {
|
|
@@ -1826,18 +1890,35 @@ var BlockClassifier = class {
|
|
|
1826
1890
|
* RAP-bearing block is the one a wrong G calls delta), because the next
|
|
1827
1891
|
* released RAP then belongs to m+2. Every MPU is one interval long, so the
|
|
1828
1892
|
* span to any later released RAP proves or refutes all MPUs in between.
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1893
|
+
*
|
|
1894
|
+
* In every mode it keeps each MPU's first released RAP, with its decode
|
|
1895
|
+
* time, as the start keyframeFreeBetween measures the catalog interval
|
|
1896
|
+
* from, and a second RAP released inside one MPU refutes `mpuBoundsRaps`
|
|
1897
|
+
* when it lies off the catalog lattice (not a whole number of intervals
|
|
1898
|
+
* after the first; draft-ramadan-moq-mmt-02 4.4.3 binds every keyframe to
|
|
1899
|
+
* it): with no repair, released RAPs are the only evidence of where they
|
|
1900
|
+
* lie. Without a usable interval, or a decode time on either, any second
|
|
1901
|
+
* RAP with another presentation time refutes.
|
|
1902
|
+
*/
|
|
1903
|
+
noteReleasedRap(mpu, presentationTime, mediaTimescale, decodeTime) {
|
|
1904
|
+
if (this.#geometry.trackKind === "audio") return [];
|
|
1836
1905
|
const previous = this.#lastRap;
|
|
1837
1906
|
if (previous !== null && previous.mpu === mpu && previous.mediaTimescale === mediaTimescale) {
|
|
1907
|
+
if (presentationTime === previous.presentationTime) return [];
|
|
1908
|
+
const interval2 = keyframeIntervalMediaTicks(this.#geometry, mediaTimescale);
|
|
1909
|
+
if (interval2 === null || decodeTime === void 0 || previous.decodeTime === void 0 || (decodeTime - previous.decodeTime) % interval2 !== 0n) {
|
|
1910
|
+
this.#mpuBoundsRaps = false;
|
|
1911
|
+
}
|
|
1838
1912
|
return [];
|
|
1839
1913
|
}
|
|
1840
|
-
|
|
1914
|
+
if (previous !== null && previous.mediaTimescale === mediaTimescale) {
|
|
1915
|
+
const back = previous.mpu - mpu >>> 0;
|
|
1916
|
+
if (back !== 0 && back <= LATE_RAP_MAX_MPUS_BACK && presentationTime < previous.presentationTime) return [];
|
|
1917
|
+
}
|
|
1918
|
+
this.#lastRap = { mpu, presentationTime, mediaTimescale, ...decodeTime === void 0 ? {} : { decodeTime } };
|
|
1919
|
+
if (this.#mode === "all-protected") return [];
|
|
1920
|
+
const interval = keyframeIntervalMediaTicks(this.#geometry, mediaTimescale);
|
|
1921
|
+
if (interval === null) return this.#disable("keyframe-interval-not-media-integral");
|
|
1841
1922
|
if (previous === null || mpu < previous.mpu || previous.mediaTimescale !== mediaTimescale) {
|
|
1842
1923
|
return [];
|
|
1843
1924
|
}
|
|
@@ -1846,6 +1927,22 @@ var BlockClassifier = class {
|
|
|
1846
1927
|
}
|
|
1847
1928
|
return this.#disable("rap-spacing-mismatch");
|
|
1848
1929
|
}
|
|
1930
|
+
/**
|
|
1931
|
+
* Whether a gap inside MPU `mpu`, between the decode times `from` and `to`
|
|
1932
|
+
* of the frames on either side, holds no keyframe: MPU boundaries still
|
|
1933
|
+
* bound RAPs, the catalog states an interval exact in this timescale, and
|
|
1934
|
+
* none of its instants after the MPU's first released RAP lies in
|
|
1935
|
+
* `(from, to]` (fec-multicast-00 Block Classification item 3). Anything
|
|
1936
|
+
* unknown counts as a keyframe.
|
|
1937
|
+
*/
|
|
1938
|
+
keyframeFreeBetween(mpu, from, to, mediaTimescale) {
|
|
1939
|
+
const rap = this.#lastRap;
|
|
1940
|
+
if (!this.#mpuBoundsRaps || rap?.mpu !== mpu || rap.mediaTimescale !== mediaTimescale || rap.decodeTime === void 0) {
|
|
1941
|
+
return false;
|
|
1942
|
+
}
|
|
1943
|
+
const interval = keyframeIntervalMediaTicks(this.#geometry, mediaTimescale);
|
|
1944
|
+
return interval !== null && !keyframeInstantBetween(rap.decodeTime, interval, from, to);
|
|
1945
|
+
}
|
|
1849
1946
|
#blockFor(sbn) {
|
|
1850
1947
|
let block = this.#blocks.get(sbn);
|
|
1851
1948
|
if (!block) {
|
|
@@ -2297,7 +2394,12 @@ var FECManager = class _FECManager {
|
|
|
2297
2394
|
this.#repairHoldUntilMs = /* @__PURE__ */ new Map();
|
|
2298
2395
|
// Receiver-measured multicast delivery gap: the late-symbol wait's jitter
|
|
2299
2396
|
// term (see DeliveryGapEstimator for the statistic and why).
|
|
2300
|
-
|
|
2397
|
+
// One estimator per lossy path, so a hybrid session never lets one leg's
|
|
2398
|
+
// stall widen the other's wait; the wait reads the larger peak.
|
|
2399
|
+
this.#deliveryGaps = {
|
|
2400
|
+
multicast: new DeliveryGapEstimator(),
|
|
2401
|
+
"moq-datagram": new DeliveryGapEstimator()
|
|
2402
|
+
};
|
|
2301
2403
|
this.#lifecycleTrace = [];
|
|
2302
2404
|
// Worker-backed timeouts enqueue cleanup behind all prior symbol messages.
|
|
2303
2405
|
// Failure remains pending until cleanupComplete acknowledges that queue drain.
|
|
@@ -2489,6 +2591,14 @@ var FECManager = class _FECManager {
|
|
|
2489
2591
|
// iso-ssbg1-v1 block location per stream (streamKey). A source belongs to a
|
|
2490
2592
|
// block only once a repair symbol stated the block's (SS_Start, SSB_length).
|
|
2491
2593
|
this.#isoLocators = /* @__PURE__ */ new Map();
|
|
2594
|
+
// The ts of the run behind the gap the release gate last asked about, per
|
|
2595
|
+
// stream (isoRepairlessWaitMs), keyed on the frame before the gap: kept, as
|
|
2596
|
+
// the source it came from may retire before the run's deadline, and the
|
|
2597
|
+
// earliest found wins, so a late frame that becomes the head restarts
|
|
2598
|
+
// nothing. It stays until the next run gap: a source discontinuity drops
|
|
2599
|
+
// it, and one older than twice the hold ceiling is not this gap's.
|
|
2600
|
+
// `counted` once the deadline passed (onUndelimitedRunGap).
|
|
2601
|
+
this.#runAnchors = /* @__PURE__ */ new Map();
|
|
2492
2602
|
this.#deferIsoGaps = false;
|
|
2493
2603
|
this.#isoRepairRefusedCount = 0;
|
|
2494
2604
|
this.#isoSourceOversizeCount = 0;
|
|
@@ -2525,6 +2635,7 @@ var FECManager = class _FECManager {
|
|
|
2525
2635
|
this.#decoderUnavailableEvents = 0;
|
|
2526
2636
|
this.#repairSymbolSizeMismatchCount = 0;
|
|
2527
2637
|
this.#unlistedRepairTrackRefusals = 0;
|
|
2638
|
+
this.#unresolvedRepairOwnerDrops = { unregistered: 0, ownerAbsent: 0, ownerAmbiguous: 0 };
|
|
2528
2639
|
// Event callbacks — block lifecycle notifications for MmtpRouter wiring.
|
|
2529
2640
|
// NOTE: For sync WASM path, recovery routing is handled by MmtpRouter from
|
|
2530
2641
|
// feedSourceSymbol/feedRepairSymbol return values. For Worker path, recovery
|
|
@@ -2584,6 +2695,8 @@ var FECManager = class _FECManager {
|
|
|
2584
2695
|
this.onBlockResolved = null;
|
|
2585
2696
|
/** A stream's SBN went backwards (or jumped implausibly): the source restarted. */
|
|
2586
2697
|
this.onSourceDiscontinuity = null;
|
|
2698
|
+
/** The FEC deadline of a run no repair delimited passed, releasing the gap behind it (once per gap). */
|
|
2699
|
+
this.onUndelimitedRunGap = null;
|
|
2587
2700
|
/**
|
|
2588
2701
|
* The span and tolerance the catalog states for a keyframe overlay
|
|
2589
2702
|
* installed over a source track (draft-ramadan-moq-mmt-02 7.4.1: the
|
|
@@ -2684,6 +2797,7 @@ var FECManager = class _FECManager {
|
|
|
2684
2797
|
#highestSbn;
|
|
2685
2798
|
#sourceFrontiers;
|
|
2686
2799
|
#isoLocators;
|
|
2800
|
+
#runAnchors;
|
|
2687
2801
|
#deferIsoGaps;
|
|
2688
2802
|
#isoRepairRefusedCount;
|
|
2689
2803
|
#isoSourceOversizeCount;
|
|
@@ -2699,6 +2813,7 @@ var FECManager = class _FECManager {
|
|
|
2699
2813
|
#decoderUnavailableEvents;
|
|
2700
2814
|
#repairSymbolSizeMismatchCount;
|
|
2701
2815
|
#unlistedRepairTrackRefusals;
|
|
2816
|
+
#unresolvedRepairOwnerDrops;
|
|
2702
2817
|
#onUndelimitedLoss;
|
|
2703
2818
|
#onIsoHoleExpired;
|
|
2704
2819
|
#encodeTrackName(catalogTrackName) {
|
|
@@ -3348,6 +3463,7 @@ var FECManager = class _FECManager {
|
|
|
3348
3463
|
const discontinuity = () => {
|
|
3349
3464
|
this.#classifiers.get(streamKey)?.noteSourceDiscontinuity();
|
|
3350
3465
|
this.#noSpanRaps.delete(streamKey);
|
|
3466
|
+
this.#runAnchors.delete(streamKey);
|
|
3351
3467
|
this.#highestSbn.set(streamKey, { sbn, atMs: now });
|
|
3352
3468
|
this.#sourceFrontiers.set(streamKey, { sbn, atMs: now });
|
|
3353
3469
|
if (psn === void 0) this.#sourceAnchors.delete(streamKey);
|
|
@@ -3518,7 +3634,7 @@ var FECManager = class _FECManager {
|
|
|
3518
3634
|
consider(geometry2, this.#parseStreamKey(streamKey).packetId);
|
|
3519
3635
|
}
|
|
3520
3636
|
for (const [packetId, config] of this.#trackConfigs) consider(config.geometry, packetId);
|
|
3521
|
-
this.#deliveryGaps.setWindowMs(windowMs);
|
|
3637
|
+
for (const estimator of Object.values(this.#deliveryGaps)) estimator.setWindowMs(windowMs);
|
|
3522
3638
|
}
|
|
3523
3639
|
/**
|
|
3524
3640
|
* The multicast late-symbol wait: the block span plus the larger of the
|
|
@@ -3531,14 +3647,14 @@ var FECManager = class _FECManager {
|
|
|
3531
3647
|
* stream order and never feeds the estimator.
|
|
3532
3648
|
*/
|
|
3533
3649
|
#multicastWaitMs(config) {
|
|
3534
|
-
return this.#waitForGapMs(config, this.#
|
|
3650
|
+
return this.#waitForGapMs(config, this.#peakDeliveryGapMs());
|
|
3535
3651
|
}
|
|
3536
3652
|
/**
|
|
3537
3653
|
* The widest #multicastWaitMs can become: the estimator reports at most its
|
|
3538
3654
|
* catalog window, so this is a catalog quantity that no measurement moves.
|
|
3539
3655
|
*/
|
|
3540
3656
|
#maxMulticastWaitMs(config) {
|
|
3541
|
-
return this.#waitForGapMs(config, this.#deliveryGaps.windowMs ?? 0);
|
|
3657
|
+
return this.#waitForGapMs(config, this.#deliveryGaps.multicast.windowMs ?? 0);
|
|
3542
3658
|
}
|
|
3543
3659
|
#waitForGapMs(config, gapMs) {
|
|
3544
3660
|
if (!(gapMs > 0) || !(config.interleaveDepthMs > 0)) return config.timeoutMs;
|
|
@@ -3722,6 +3838,7 @@ var FECManager = class _FECManager {
|
|
|
3722
3838
|
...(config.trackKind ?? previous.trackKind) === void 0 ? {} : { trackKind: config.trackKind ?? previous.trackKind },
|
|
3723
3839
|
...(config.codec ?? previous.codec) === void 0 ? {} : { codec: config.codec ?? previous.codec },
|
|
3724
3840
|
...(config.geometry ?? previous.geometry) === void 0 ? {} : { geometry: config.geometry ?? previous.geometry },
|
|
3841
|
+
...(config.groupDurationMs ?? previous.groupDurationMs) === void 0 ? {} : { groupDurationMs: config.groupDurationMs ?? previous.groupDurationMs },
|
|
3725
3842
|
...(config.repairLayers ?? previous.repairLayers) === void 0 ? {} : { repairLayers: config.repairLayers ?? previous.repairLayers },
|
|
3726
3843
|
...(config.heldLayers ?? previous.heldLayers) === void 0 ? {} : { heldLayers: config.heldLayers ?? previous.heldLayers }
|
|
3727
3844
|
};
|
|
@@ -3828,6 +3945,10 @@ var FECManager = class _FECManager {
|
|
|
3828
3945
|
lifecycleTrace: this.#lifecycleTrace.map((entry) => ({ ...entry }))
|
|
3829
3946
|
};
|
|
3830
3947
|
}
|
|
3948
|
+
/** Count a repair packet the router dropped for want of an owning track (BLO-55759). */
|
|
3949
|
+
countUnresolvedRepairOwner(reason) {
|
|
3950
|
+
this.#unresolvedRepairOwnerDrops[reason]++;
|
|
3951
|
+
}
|
|
3831
3952
|
get fecStats() {
|
|
3832
3953
|
const s = this.#fecStats;
|
|
3833
3954
|
const affected = s.blocksRecovered + s.blocksFailed;
|
|
@@ -3868,6 +3989,7 @@ var FECManager = class _FECManager {
|
|
|
3868
3989
|
})),
|
|
3869
3990
|
repairSymbolSizeMismatches: this.#repairSymbolSizeMismatchCount,
|
|
3870
3991
|
unlistedRepairTrackRefusals: this.#unlistedRepairTrackRefusals,
|
|
3992
|
+
unresolvedRepairOwnerDrops: { ...this.#unresolvedRepairOwnerDrops },
|
|
3871
3993
|
repairObjectRejects: [...this.#repairObjectRejects.values()].map((r) => ({ ...r })),
|
|
3872
3994
|
workerErrors: Object.fromEntries(this.#workerErrorCounts)
|
|
3873
3995
|
};
|
|
@@ -3892,6 +4014,16 @@ var FECManager = class _FECManager {
|
|
|
3892
4014
|
this.#startupRepairBoundaryCounts.clear();
|
|
3893
4015
|
this.#startupRepairFailOpenPackets.clear();
|
|
3894
4016
|
}
|
|
4017
|
+
/**
|
|
4018
|
+
* Start a new "mfu-datagram" leg (mmt-02 4.3.1) without discarding
|
|
4019
|
+
* track/decoder state: the same join-boundary rules as a multicast join,
|
|
4020
|
+
* since the leg starts at an arbitrary datagram too. It resets the whole
|
|
4021
|
+
* join boundary of this manager, a multicast ordered-relay frontier
|
|
4022
|
+
* included, so a host gives the leg a manager of its own.
|
|
4023
|
+
*/
|
|
4024
|
+
beginLegJoin() {
|
|
4025
|
+
this.beginMulticastJoin();
|
|
4026
|
+
}
|
|
3895
4027
|
/** How the multicast leg currently delivers symbols. */
|
|
3896
4028
|
get multicastSymbolDelivery() {
|
|
3897
4029
|
return this.#multicastSymbolDelivery;
|
|
@@ -3914,7 +4046,8 @@ var FECManager = class _FECManager {
|
|
|
3914
4046
|
);
|
|
3915
4047
|
}
|
|
3916
4048
|
if (delivery === this.#multicastSymbolDelivery) return;
|
|
3917
|
-
this.#deliveryGaps.reset();
|
|
4049
|
+
this.#deliveryGaps.multicast.reset();
|
|
4050
|
+
this.#runAnchors.clear();
|
|
3918
4051
|
if (delivery === "ordered-relay") {
|
|
3919
4052
|
for (const [packetId, config] of this.#trackConfigs) {
|
|
3920
4053
|
this.#orderedHorizonBlocksFor(packetId, config);
|
|
@@ -4003,6 +4136,7 @@ var FECManager = class _FECManager {
|
|
|
4003
4136
|
resetMap(this.#highestSbn);
|
|
4004
4137
|
resetMap(this.#sourceFrontiers);
|
|
4005
4138
|
resetMap(this.#isoLocators);
|
|
4139
|
+
resetMap(this.#runAnchors);
|
|
4006
4140
|
resetMap(this.#sourceAnchors);
|
|
4007
4141
|
this.#classifiers.delete(this.#streamKey(packetId, catalogTrackName));
|
|
4008
4142
|
this.#noSpanRaps.delete(this.#streamKey(packetId, catalogTrackName));
|
|
@@ -4112,6 +4246,7 @@ var FECManager = class _FECManager {
|
|
|
4112
4246
|
dropMap(this.#highestSbn);
|
|
4113
4247
|
dropMap(this.#sourceFrontiers);
|
|
4114
4248
|
dropMap(this.#isoLocators);
|
|
4249
|
+
dropMap(this.#runAnchors);
|
|
4115
4250
|
dropMap(this.#sourceAnchors);
|
|
4116
4251
|
dropMap(this.#classifiers);
|
|
4117
4252
|
dropMap(this.#noSpanRaps);
|
|
@@ -4179,8 +4314,8 @@ var FECManager = class _FECManager {
|
|
|
4179
4314
|
const sourceSymbols = this.#isoLocatorFor(packetId, catalogTrackName).blockAt(sbn)?.length ?? this.#trackConfig(packetId).k;
|
|
4180
4315
|
const isSourceSymbol = esi >= 0 && esi < sourceSymbols;
|
|
4181
4316
|
const isStartupPartial = this.#startupPartialBlocks.has(blockKey);
|
|
4182
|
-
const isReadyMulticastRepair = this.#startupRequireRepairReady && source
|
|
4183
|
-
const awaitingMulticastRepair = this.#startupRequireRepairReady && source
|
|
4317
|
+
const isReadyMulticastRepair = this.#startupRequireRepairReady && source !== "moq" && !isSourceSymbol && this.#startupRepairReadyPackets.has(streamKey);
|
|
4318
|
+
const awaitingMulticastRepair = this.#startupRequireRepairReady && source !== "moq" && !this.#startupRepairReadyPackets.has(streamKey) && !this.#startupRepairFailOpenPackets.has(streamKey);
|
|
4184
4319
|
if (awaitingMulticastRepair) {
|
|
4185
4320
|
if (!isSourceSymbol) {
|
|
4186
4321
|
this.#startupRepairReadyPackets.add(streamKey);
|
|
@@ -4234,12 +4369,14 @@ var FECManager = class _FECManager {
|
|
|
4234
4369
|
...catalogTrackName === void 0 ? {} : { catalogTrackName },
|
|
4235
4370
|
multicastSymbols: 0,
|
|
4236
4371
|
moqSymbols: 0,
|
|
4372
|
+
datagramSymbols: 0,
|
|
4237
4373
|
complete: false
|
|
4238
4374
|
};
|
|
4239
4375
|
const receivedAtMs = this.#receiptNow();
|
|
4240
4376
|
const anchorMs = this.#blockAnchorsMs.get(blockKey);
|
|
4241
4377
|
if (anchorMs === void 0 || receivedAtMs < anchorMs) this.#blockAnchorsMs.set(blockKey, receivedAtMs);
|
|
4242
4378
|
if (source === "multicast") counts.multicastSymbols++;
|
|
4379
|
+
else if (source === "moq-datagram") counts.datagramSymbols++;
|
|
4243
4380
|
else counts.moqSymbols++;
|
|
4244
4381
|
this.#blockPathCounts.set(blockKey, counts);
|
|
4245
4382
|
this.#observeBlockCatalogTrackName(blockKey, sbn, packetId, catalogTrackName);
|
|
@@ -4260,7 +4397,7 @@ var FECManager = class _FECManager {
|
|
|
4260
4397
|
this.#unindexBlockKey(key);
|
|
4261
4398
|
}
|
|
4262
4399
|
}
|
|
4263
|
-
if (isSourceSymbol && source
|
|
4400
|
+
if (isSourceSymbol && source !== "moq") {
|
|
4264
4401
|
this.#noteMulticastSource(this.#isoLocatorFor(packetId, catalogTrackName), sbn + esi >>> 0, packetId, catalogTrackName);
|
|
4265
4402
|
}
|
|
4266
4403
|
return true;
|
|
@@ -4349,8 +4486,22 @@ var FECManager = class _FECManager {
|
|
|
4349
4486
|
* DeliveryGapEstimator). Datagram delivery only.
|
|
4350
4487
|
*/
|
|
4351
4488
|
noteMulticastArrival(packetId, packetSequenceNumber) {
|
|
4352
|
-
|
|
4353
|
-
|
|
4489
|
+
this.noteArrival("multicast", packetId, packetSequenceNumber);
|
|
4490
|
+
}
|
|
4491
|
+
/**
|
|
4492
|
+
* Record one MMTP packet arrival on a lossy path for that path's
|
|
4493
|
+
* delivery-gap measurement: the multicast leg (datagram delivery only; an
|
|
4494
|
+
* ordered relay settles by stream order) or an "mfu-datagram" leg, whose
|
|
4495
|
+
* datagrams are always a lossy path (#lossyDatagramPath).
|
|
4496
|
+
*/
|
|
4497
|
+
noteArrival(path, packetId, packetSequenceNumber) {
|
|
4498
|
+
if (!this.#lossyDatagramPath(path)) return;
|
|
4499
|
+
this.#deliveryGaps[path].noteArrival(performance.now(), packetId, packetSequenceNumber);
|
|
4500
|
+
}
|
|
4501
|
+
/** The largest delivery gap any lossy path measured over its window. */
|
|
4502
|
+
#peakDeliveryGapMs() {
|
|
4503
|
+
const now = performance.now();
|
|
4504
|
+
return Math.max(...Object.values(this.#deliveryGaps).map((estimator) => estimator.peakGapMs(now)));
|
|
4354
4505
|
}
|
|
4355
4506
|
/**
|
|
4356
4507
|
* Resolved per-track multicast late-symbol wait in milliseconds: the span
|
|
@@ -4364,10 +4515,10 @@ var FECManager = class _FECManager {
|
|
|
4364
4515
|
* Largest multicast delivery gap measured over the current window (ms), and
|
|
4365
4516
|
* that window (undefined: held since the last reset). Diagnostics.
|
|
4366
4517
|
*/
|
|
4367
|
-
multicastDeliveryGap() {
|
|
4518
|
+
multicastDeliveryGap(path = "multicast") {
|
|
4368
4519
|
return {
|
|
4369
|
-
peakGapMs: this.#deliveryGaps.peakGapMs(performance.now()),
|
|
4370
|
-
windowMs: this.#deliveryGaps.windowMs
|
|
4520
|
+
peakGapMs: this.#deliveryGaps[path].peakGapMs(performance.now()),
|
|
4521
|
+
windowMs: this.#deliveryGaps[path].windowMs
|
|
4371
4522
|
};
|
|
4372
4523
|
}
|
|
4373
4524
|
/**
|
|
@@ -4465,6 +4616,23 @@ var FECManager = class _FECManager {
|
|
|
4465
4616
|
const config = this.#trackConfigs.get(packetId);
|
|
4466
4617
|
return config === void 0 ? void 0 : this.#blockLifetimeMs(config);
|
|
4467
4618
|
}
|
|
4619
|
+
/**
|
|
4620
|
+
* How long an "mfu-datagram" leg's duplicate ledgers must remember a packet
|
|
4621
|
+
* so a legal reorder never reads as a publisher restart: one block span,
|
|
4622
|
+
* the reorder tolerance (`timeoutMs` is span + tolerance) and one group,
|
|
4623
|
+
* since a datagram may trail the stream by a whole group behind a joining
|
|
4624
|
+
* FETCH (mmt-02 6.1 step 3). The group is the catalog group duration
|
|
4625
|
+
* (`groupDurationMs`), whatever the track kind; a video track configured
|
|
4626
|
+
* without one falls back to its keyframe interval (one GOP per group).
|
|
4627
|
+
* Undefined for an unconfigured packet id.
|
|
4628
|
+
*/
|
|
4629
|
+
datagramLegLedgerRetentionMsForPacket(packetId) {
|
|
4630
|
+
const config = this.#trackConfigs.get(packetId);
|
|
4631
|
+
if (config === void 0) return void 0;
|
|
4632
|
+
const geometry2 = config.geometry;
|
|
4633
|
+
const groupMs = config.groupDurationMs ?? (geometry2?.trackKind === "video" && geometry2.mode === "classifying" ? geometry2.keyframeInterval.ticks / geometry2.keyframeInterval.timescale * 1e3 : 0);
|
|
4634
|
+
return config.timeoutMs + (Number.isFinite(groupMs) ? groupMs : 0);
|
|
4635
|
+
}
|
|
4468
4636
|
/**
|
|
4469
4637
|
* How long a terminal (clean, recovered or failed) block stays authoritative,
|
|
4470
4638
|
* for late symbols and for the in-order release gate. It is also the gate's
|
|
@@ -4533,6 +4701,9 @@ var FECManager = class _FECManager {
|
|
|
4533
4701
|
for (const key of [...this.#isoLocators.keys()]) {
|
|
4534
4702
|
if (this.#belongsToPacket(key, packetId)) this.#isoLocators.delete(key);
|
|
4535
4703
|
}
|
|
4704
|
+
for (const key of [...this.#runAnchors.keys()]) {
|
|
4705
|
+
if (this.#belongsToPacket(key, packetId)) this.#runAnchors.delete(key);
|
|
4706
|
+
}
|
|
4536
4707
|
}
|
|
4537
4708
|
/**
|
|
4538
4709
|
* The iso-ssbg1-v1 locator horizon in blocks: every block the manager can
|
|
@@ -4582,9 +4753,9 @@ var FECManager = class _FECManager {
|
|
|
4582
4753
|
holdIsoSource(packetId, catalogTrackName, ssId, source) {
|
|
4583
4754
|
const locator = this.#growingIsoLocatorFor(packetId, catalogTrackName);
|
|
4584
4755
|
const evictedBefore = locator.heldEvicted;
|
|
4585
|
-
const held = locator.hold(ssId, source);
|
|
4756
|
+
const held = locator.hold(ssId, source.arrivedAtMs === void 0 ? { ...source, arrivedAtMs: this.#receiptNow() } : source);
|
|
4586
4757
|
this.#settleExpiredIsoHoles(locator, packetId, catalogTrackName);
|
|
4587
|
-
if (held && source.source
|
|
4758
|
+
if (held && source.source !== "moq") this.#noteMulticastSource(locator, ssId, packetId, catalogTrackName);
|
|
4588
4759
|
const evicted = locator.heldEvicted - evictedBefore;
|
|
4589
4760
|
if (evicted > 0) {
|
|
4590
4761
|
const before = this.#isoHeldEvictedCount;
|
|
@@ -4702,7 +4873,12 @@ var FECManager = class _FECManager {
|
|
|
4702
4873
|
* Resolution of the SS_IDs strictly between two released frames' SS_IDs on
|
|
4703
4874
|
* an iso-ssbg1-v1 stream, for in-order frame release: null while a block
|
|
4704
4875
|
* that could hold them is pending or not yet stated by a repair, else the
|
|
4705
|
-
* starts of the blocks that failed or vanished.
|
|
4876
|
+
* starts of the blocks that failed or vanished. SS_IDs no repair has
|
|
4877
|
+
* delimited yet that all arrived lost nothing and wait for no repair, only
|
|
4878
|
+
* the late-source allowance after the datagram of a lossy path that clocks
|
|
4879
|
+
* them arrived (#lossFreeRunReadyAtMs), and not even that when none of them
|
|
4880
|
+
* came as one; one missing makes a run that waits as one block
|
|
4881
|
+
* (isoRepairlessWaitMs).
|
|
4706
4882
|
*
|
|
4707
4883
|
* `untracked` reads as the release gate reads it (MmtpRouter
|
|
4708
4884
|
* #createFecReleaseGate): a block holding either released frame's SS_ID
|
|
@@ -4715,7 +4891,16 @@ var FECManager = class _FECManager {
|
|
|
4715
4891
|
isoSpanResolution(packetId, catalogTrackName, fromSsId, toSsId) {
|
|
4716
4892
|
if (!serial32Precedes(fromSsId, toSsId) || serial32Distance(fromSsId, toSsId) <= 1) return [];
|
|
4717
4893
|
const locator = this.#isoLocators.get(this.#streamKey(packetId, catalogTrackName));
|
|
4718
|
-
if (!locator
|
|
4894
|
+
if (!locator) return null;
|
|
4895
|
+
const run = locator.undelimitedBetween(fromSsId, toSsId);
|
|
4896
|
+
if (run?.missing !== void 0) return null;
|
|
4897
|
+
if (run !== null) {
|
|
4898
|
+
const config = this.#trackConfigs.get(packetId);
|
|
4899
|
+
const readyAtMs = config === void 0 ? void 0 : this.#lossFreeRunReadyAtMs(config, locator, run.start, toSsId);
|
|
4900
|
+
if (readyAtMs !== void 0 && this.#receiptNow() < readyAtMs) return null;
|
|
4901
|
+
}
|
|
4902
|
+
if (locator.coverageEnd === void 0) return [];
|
|
4903
|
+
if (!locator.coversBetween(fromSsId, run?.start ?? toSsId)) return null;
|
|
4719
4904
|
const highest = this.highestSbn(packetId, catalogTrackName);
|
|
4720
4905
|
const lost = [];
|
|
4721
4906
|
for (const block of locator.blocksBetween(fromSsId, toSsId)) {
|
|
@@ -4733,6 +4918,63 @@ var FECManager = class _FECManager {
|
|
|
4733
4918
|
}
|
|
4734
4919
|
return lost;
|
|
4735
4920
|
}
|
|
4921
|
+
/**
|
|
4922
|
+
* When undelimited SS_IDs from `runStart` up to `toSsId` that all arrived
|
|
4923
|
+
* stop holding its frame: the late-source allowance after the receipt of
|
|
4924
|
+
* a datagram of a lossy path (#lossyDatagramPath: a multicast datagram, or
|
|
4925
|
+
* one of an "mfu-datagram" leg). Until then a frame between them may still
|
|
4926
|
+
* complete from a packet with no SS_ID (an untagged FT=0/FT=1 reordered
|
|
4927
|
+
* behind the next frame), and a repair may delimit them. The receipt is
|
|
4928
|
+
* `toSsId`'s own when it is held from such a datagram. Otherwise (its
|
|
4929
|
+
* packet came only as an overlap copy or from a MoQ stream, or was evicted
|
|
4930
|
+
* or retired) it is the newest among those SS_IDs, every one of which is
|
|
4931
|
+
* held and states its path. So the time moves at most once, when the
|
|
4932
|
+
* head's own datagram copy arrives while its frame waits or its held
|
|
4933
|
+
* source is dropped, and never on a later ask.
|
|
4934
|
+
*
|
|
4935
|
+
* Undefined, so the range releases at once, when no SS_ID of it came as
|
|
4936
|
+
* such a datagram: a MoQ arrival, an ordered relay's and the frame's own
|
|
4937
|
+
* are no clock for datagram reordering (#lossyReceiptMs). Undefined too
|
|
4938
|
+
* on a track with no catalog span, which states no allowance: the local
|
|
4939
|
+
* timeout is a cleanup bound, and isoRepairlessWaitMs arms no wake there,
|
|
4940
|
+
* so a wait would hold the frame until the next packet. The cost, on
|
|
4941
|
+
* multicast and on the leg too: an untagged FT=0/FT=1 reordered behind
|
|
4942
|
+
* the next frame of such a track is dropped stale.
|
|
4943
|
+
*/
|
|
4944
|
+
#lossFreeRunReadyAtMs(config, locator, runStart, toSsId) {
|
|
4945
|
+
if (!_FECManager.#hasCatalogTiming(config)) return void 0;
|
|
4946
|
+
let clockMs = this.#lossyReceiptMs(locator.heldSource(toSsId));
|
|
4947
|
+
if (clockMs === void 0) {
|
|
4948
|
+
for (let ssId = runStart; ssId !== toSsId; ssId = ssId + 1 >>> 0) {
|
|
4949
|
+
const atMs = this.#lossyReceiptMs(locator.heldSource(ssId));
|
|
4950
|
+
if (atMs !== void 0 && (clockMs === void 0 || atMs > clockMs)) clockMs = atMs;
|
|
4951
|
+
}
|
|
4952
|
+
}
|
|
4953
|
+
if (clockMs === void 0) return void 0;
|
|
4954
|
+
return clockMs + Math.max(0, this.#multicastWaitMs(config) - config.interleaveDepthMs);
|
|
4955
|
+
}
|
|
4956
|
+
/**
|
|
4957
|
+
* Receipt time of a held source that came as a datagram of a lossy path
|
|
4958
|
+
* (#lossyDatagramPath), else undefined: a MoQ stream and an ordered relay
|
|
4959
|
+
* deliver in order, so their arrivals clock no reorder allowance and no
|
|
4960
|
+
* FEC deadline. The path is the one the feed stated (IsoHeldSource.source,
|
|
4961
|
+
* and MulticastSymbolDelivery for a multicast source), never a guess.
|
|
4962
|
+
*/
|
|
4963
|
+
#lossyReceiptMs(held) {
|
|
4964
|
+
return held !== void 0 && this.#lossyDatagramPath(held.source) ? held.arrivedAtMs : void 0;
|
|
4965
|
+
}
|
|
4966
|
+
/**
|
|
4967
|
+
* The one path predicate of the loss gates: whether a symbol fed as
|
|
4968
|
+
* `source` reached this manager as a datagram of its own, on a path that
|
|
4969
|
+
* loses and reorders (mmt-02 Section 2, a datagram leg). A multicast
|
|
4970
|
+
* symbol does unless its provider declared an ordered relay. An
|
|
4971
|
+
* "mfu-datagram" object always does (4.3.1): MulticastSymbolDelivery is
|
|
4972
|
+
* the multicast provider's statement and is never read for the leg. A MoQ
|
|
4973
|
+
* stream object never does, a stream copy of the leg included.
|
|
4974
|
+
*/
|
|
4975
|
+
#lossyDatagramPath(source) {
|
|
4976
|
+
return source === "moq-datagram" || source === "multicast" && this.#multicastSymbolDelivery === "datagram";
|
|
4977
|
+
}
|
|
4736
4978
|
/**
|
|
4737
4979
|
* The release gate's wait, from a frame's arrival, for the SS_IDs strictly
|
|
4738
4980
|
* between two released frames' SS_IDs once only a late source can still
|
|
@@ -4740,10 +4982,11 @@ var FECManager = class _FECManager {
|
|
|
4740
4982
|
* arrived nor held) lies in a repair-less span longer than K, which no
|
|
4741
4983
|
* repair can state a block of (#openIsoSpan), or in a stated block its
|
|
4742
4984
|
* own repair group cannot complete every SS_ID of which it misses lies
|
|
4743
|
-
* between them (so the gap's decision covers all it lost), and a
|
|
4744
|
-
*
|
|
4745
|
-
*
|
|
4746
|
-
*
|
|
4985
|
+
* between them (so the gap's decision covers all it lost), and a source of
|
|
4986
|
+
* a lossy leg (multicast, or an "mfu-datagram" leg's datagram) at or past
|
|
4987
|
+
* `toSsId` arrived, so each is lost or reordered behind it (a MoQ source
|
|
4988
|
+
* shows nothing: MoQ streams overtake one another). The span or block
|
|
4989
|
+
* itself keeps its own wait.
|
|
4747
4990
|
*
|
|
4748
4991
|
* The wait is the late-symbol allowance, unless `rapMayHide`: the gap may
|
|
4749
4992
|
* hold a RAP packet an installed keyframe overlay can still rebuild (its
|
|
@@ -4754,14 +4997,56 @@ var FECManager = class _FECManager {
|
|
|
4754
4997
|
* for an overlay that states no span, the span's whole wait (undefined).
|
|
4755
4998
|
* So does `rapNext` (the gap ends at the RAP that opens the next MPU) when
|
|
4756
4999
|
* the gap holds a stated block's loss.
|
|
4757
|
-
|
|
4758
|
-
|
|
5000
|
+
*
|
|
5001
|
+
* A run of SS_IDs no repair has delimited yet, one of which never arrived,
|
|
5002
|
+
* is one block of its own instead (draft-ramadan-moq-fec-multicast-00,
|
|
5003
|
+
* Receiver Repair Policy; on an "mfu-datagram" leg fec-core-00 9.3 and
|
|
5004
|
+
* mmt-02 5.3.3): the frame then waits for that block's FEC deadline,
|
|
5005
|
+
* whatever the flags: ts plus the whole multicast wait (fec-core-00 9.3),
|
|
5006
|
+
* ts the receipt of the lowest held source above the run that came as a
|
|
5007
|
+
* datagram of a lossy path (#lossyDatagramPath), up to the newest
|
|
5008
|
+
* (fec-multicast-00, Deadline Anchoring; under reordering at or after the
|
|
5009
|
+
* draft's first signal, never before). The wait returned counts from
|
|
5010
|
+
* `arrivedAtMs`, the frame's arrival; without it, it is the whole wait.
|
|
5011
|
+
* With no such source held (never arrived, retired, or evicted, or every
|
|
5012
|
+
* one from a MoQ stream or an ordered relay) the frame keeps the hold
|
|
5013
|
+
* ceiling: a stream arrival is no clock for a datagram deadline.
|
|
5014
|
+
*/
|
|
5015
|
+
isoRepairlessWaitMs(packetId, catalogTrackName, fromSsId, toSsId, rapMayHide = false, rapNext = false, arrivedAtMs) {
|
|
4759
5016
|
const config = this.#trackConfigs.get(packetId);
|
|
4760
5017
|
if (config === void 0 || !_FECManager.#hasCatalogTiming(config)) return void 0;
|
|
4761
|
-
const
|
|
4762
|
-
|
|
5018
|
+
const streamKey = this.#streamKey(packetId, catalogTrackName);
|
|
5019
|
+
const locator = this.#isoLocators.get(streamKey);
|
|
5020
|
+
if (locator === void 0) return void 0;
|
|
5021
|
+
const run = locator.undelimitedBetween(fromSsId, toSsId);
|
|
5022
|
+
const readyAtMs = run === null || run.missing !== void 0 ? void 0 : this.#lossFreeRunReadyAtMs(config, locator, run.start, toSsId);
|
|
5023
|
+
if (readyAtMs !== void 0 && this.#receiptNow() < readyAtMs) {
|
|
5024
|
+
return Math.max(0, readyAtMs - (arrivedAtMs ?? this.#receiptNow()));
|
|
5025
|
+
}
|
|
4763
5026
|
const newestSource = locator.newestSource;
|
|
4764
5027
|
if (newestSource === void 0 || serial32Precedes(newestSource, toSsId)) return void 0;
|
|
5028
|
+
if (run?.missing !== void 0) {
|
|
5029
|
+
if (this.isoSpanResolution(packetId, catalogTrackName, fromSsId, run.start) === null) return void 0;
|
|
5030
|
+
const kept = this.#runAnchors.get(streamKey);
|
|
5031
|
+
const anchor = kept?.fromSsId === fromSsId && this.#receiptNow() - kept.tsMs <= 2 * (config.interleaveDepthMs + 2 * this.#blockLifetimeMs(config)) ? kept : void 0;
|
|
5032
|
+
let tsMs = anchor?.tsMs;
|
|
5033
|
+
for (let ssId = run.missing + 1 >>> 0; !serial32Precedes(newestSource, ssId); ssId = ssId + 1 >>> 0) {
|
|
5034
|
+
const atMs = this.#lossyReceiptMs(locator.heldSource(ssId));
|
|
5035
|
+
if (atMs === void 0) continue;
|
|
5036
|
+
if (tsMs === void 0 || atMs < tsMs) tsMs = atMs;
|
|
5037
|
+
break;
|
|
5038
|
+
}
|
|
5039
|
+
if (tsMs === void 0) return void 0;
|
|
5040
|
+
const waitMs2 = this.#multicastWaitMs(config);
|
|
5041
|
+
let counted = anchor?.counted === true;
|
|
5042
|
+
if (!counted && tsMs + waitMs2 <= this.#receiptNow()) {
|
|
5043
|
+
counted = true;
|
|
5044
|
+
this.onUndelimitedRunGap?.(packetId, catalogTrackName);
|
|
5045
|
+
}
|
|
5046
|
+
this.#runAnchors.set(streamKey, { fromSsId, tsMs, counted });
|
|
5047
|
+
return arrivedAtMs === void 0 ? waitMs2 : Math.max(0, tsMs + waitMs2 - arrivedAtMs);
|
|
5048
|
+
}
|
|
5049
|
+
if (!locator.coversBetween(fromSsId, run?.start ?? toSsId)) return void 0;
|
|
4765
5050
|
let repairless = false;
|
|
4766
5051
|
let stated = false;
|
|
4767
5052
|
for (const block of locator.blocksBetween(fromSsId, toSsId)) {
|
|
@@ -4842,11 +5127,31 @@ var FECManager = class _FECManager {
|
|
|
4842
5127
|
* it does not. A stream with no classifier yet has shown nothing against it,
|
|
4843
5128
|
* and neither has a stream without catalog timing until it releases two
|
|
4844
5129
|
* RAPs inside one MPU.
|
|
4845
|
-
|
|
4846
|
-
|
|
5130
|
+
*
|
|
5131
|
+
* With catalog timing and a `gap` inside one MPU, between the authored
|
|
5132
|
+
* timing of the frames on either side, it also takes the catalog keyframe
|
|
5133
|
+
* interval to rule a keyframe out of the gap
|
|
5134
|
+
* (`BlockClassifier.keyframeFreeBetween`, fec-multicast-00 Block
|
|
5135
|
+
* Classification item 3), and no source held between the frames' SS_IDs
|
|
5136
|
+
* may carry the RAP flag or another MPU's number (item 1 read on the held
|
|
5137
|
+
* packets: a RAP the loss cut in two is never released, so the frames
|
|
5138
|
+
* alone cannot show it); anything unknown counts as a keyframe.
|
|
5139
|
+
*/
|
|
5140
|
+
mpuBoundsRapsFor(packetId, catalogTrackName, gap) {
|
|
4847
5141
|
const streamKey = this.#streamKey(packetId, catalogTrackName);
|
|
4848
5142
|
if (!this.#hasCatalogTimingForPacket(packetId)) return this.#noSpanRaps.get(streamKey)?.inside !== true;
|
|
4849
|
-
|
|
5143
|
+
const classifier = this.#classifiers.get(streamKey);
|
|
5144
|
+
if (gap === void 0) return classifier?.mpuBoundsRaps ?? true;
|
|
5145
|
+
const { mpu, from, to, fromSsId, toSsId } = gap;
|
|
5146
|
+
if (fromSsId !== void 0 && toSsId !== void 0) {
|
|
5147
|
+
const run = this.#isoLocators.get(streamKey)?.undelimitedBetween(
|
|
5148
|
+
fromSsId,
|
|
5149
|
+
toSsId,
|
|
5150
|
+
({ evidence }) => evidence.rap || evidence.mpu !== void 0 && evidence.mpu !== mpu
|
|
5151
|
+
);
|
|
5152
|
+
if (run?.flagged) return false;
|
|
5153
|
+
}
|
|
5154
|
+
return classifier !== void 0 && from !== void 0 && to !== void 0 && from.mediaTimescale === to.mediaTimescale && classifier.keyframeFreeBetween(mpu, from.decodeTime, to.decodeTime, from.mediaTimescale);
|
|
4850
5155
|
}
|
|
4851
5156
|
/** A block's class now, or frozen at its resolution. */
|
|
4852
5157
|
blockClassFor(sbn, packetId, catalogTrackName) {
|
|
@@ -4869,9 +5174,11 @@ var FECManager = class _FECManager {
|
|
|
4869
5174
|
}
|
|
4870
5175
|
/**
|
|
4871
5176
|
* Record a RAP frame released in order, for the classifier's RAP-spacing
|
|
4872
|
-
* invariant (consecutive MPUs exactly one keyframe interval apart)
|
|
5177
|
+
* invariant (consecutive MPUs exactly one keyframe interval apart) and,
|
|
5178
|
+
* with its decode time, as the MPU start gap decisions measure the catalog
|
|
5179
|
+
* keyframe interval from (mpuBoundsRapsFor).
|
|
4873
5180
|
*/
|
|
4874
|
-
noteReleasedRap(packetId, catalogTrackName, mpu, presentationTime, mediaTimescale) {
|
|
5181
|
+
noteReleasedRap(packetId, catalogTrackName, mpu, presentationTime, mediaTimescale, decodeTime) {
|
|
4875
5182
|
if (!this.#trackConfigs.has(packetId)) return;
|
|
4876
5183
|
if (!this.#hasCatalogTimingForPacket(packetId)) {
|
|
4877
5184
|
const streamKey = this.#streamKey(packetId, catalogTrackName);
|
|
@@ -4886,7 +5193,8 @@ var FECManager = class _FECManager {
|
|
|
4886
5193
|
this.#classifierFor(packetId, catalogTrackName).noteReleasedRap(
|
|
4887
5194
|
mpu,
|
|
4888
5195
|
presentationTime,
|
|
4889
|
-
mediaTimescale
|
|
5196
|
+
mediaTimescale,
|
|
5197
|
+
decodeTime
|
|
4890
5198
|
)
|
|
4891
5199
|
);
|
|
4892
5200
|
}
|
|
@@ -5589,9 +5897,11 @@ var FECManager = class _FECManager {
|
|
|
5589
5897
|
* its sources in send order, so one that moves the stream's newest source
|
|
5590
5898
|
* position past a block leaves the sources that block still misses
|
|
5591
5899
|
* reordered behind it at best: it shortens the wait of every block it
|
|
5592
|
-
* passed that only a late source can complete. MoQ is left out:
|
|
5593
|
-
* can overtake one another, so a MoQ source shows nothing
|
|
5594
|
-
* sent before it.
|
|
5900
|
+
* passed that only a late source can complete. Reliable MoQ is left out:
|
|
5901
|
+
* its streams can overtake one another, so a MoQ source shows nothing
|
|
5902
|
+
* about the sources sent before it. An "mfu-datagram" leg is in: its
|
|
5903
|
+
* datagrams leave the publisher in send order and reorder only within the
|
|
5904
|
+
* path's tolerance, as multicast does.
|
|
5595
5905
|
*/
|
|
5596
5906
|
#noteMulticastSource(locator, ssId, packetId, catalogTrackName) {
|
|
5597
5907
|
const previous = locator.newestSource;
|
|
@@ -6058,7 +6368,7 @@ var FECManager = class _FECManager {
|
|
|
6058
6368
|
blockDeliveryProvenance(sbn, packetId, catalogTrackName) {
|
|
6059
6369
|
const counts = this.blockPathCount(sbn, packetId, catalogTrackName);
|
|
6060
6370
|
if (!counts) return "unknown";
|
|
6061
|
-
if (counts.moqSymbols > 0) return "mixed";
|
|
6371
|
+
if (counts.moqSymbols > 0 || counts.datagramSymbols > 0) return "mixed";
|
|
6062
6372
|
if (counts.multicastSymbols > 0) return "multicast";
|
|
6063
6373
|
return "unknown";
|
|
6064
6374
|
}
|
|
@@ -6085,7 +6395,7 @@ var FECManager = class _FECManager {
|
|
|
6085
6395
|
this.#activeBlockDeadlinesMs.clear();
|
|
6086
6396
|
this.#blockWaitDeadlinesMs.clear();
|
|
6087
6397
|
this.#repairHoldUntilMs.clear();
|
|
6088
|
-
this.#deliveryGaps.reset();
|
|
6398
|
+
for (const estimator of Object.values(this.#deliveryGaps)) estimator.reset();
|
|
6089
6399
|
this.#pendingWorkerCleanups.clear();
|
|
6090
6400
|
this.#pendingWorkerCleanupClients.clear();
|
|
6091
6401
|
for (const bound of this.#pendingWorkerCleanupBounds.values()) clearTimeout(bound.handle);
|
|
@@ -6136,6 +6446,7 @@ var FECManager = class _FECManager {
|
|
|
6136
6446
|
this.#highestSbn.clear();
|
|
6137
6447
|
this.#sourceFrontiers.clear();
|
|
6138
6448
|
this.#isoLocators.clear();
|
|
6449
|
+
this.#runAnchors.clear();
|
|
6139
6450
|
this.#sourceAnchors.clear();
|
|
6140
6451
|
this.#trackConfigs.clear();
|
|
6141
6452
|
this.#fecDecoders.clear();
|
|
@@ -6416,6 +6727,40 @@ var RUNTIME_FEC_RECEIVER2 = Object.freeze({
|
|
|
6416
6727
|
overlays: true
|
|
6417
6728
|
});
|
|
6418
6729
|
|
|
6730
|
+
// node_modules/@blockcast/mmt-base/dist/mmtp-siblings.js
|
|
6731
|
+
var MMTP_MODES2 = Object.freeze(["mfu", "mfu-datagram"]);
|
|
6732
|
+
var MMTP_SIBLING_HARD_FIELDS2 = Object.freeze([
|
|
6733
|
+
"namespace",
|
|
6734
|
+
"timescale",
|
|
6735
|
+
"presentationAnchorTicks",
|
|
6736
|
+
"groupDuration"
|
|
6737
|
+
]);
|
|
6738
|
+
var MMTP_SIBLING_RENDITION_FIELDS2 = Object.freeze([
|
|
6739
|
+
"codec",
|
|
6740
|
+
"width",
|
|
6741
|
+
"height",
|
|
6742
|
+
"framerate",
|
|
6743
|
+
"bitrate",
|
|
6744
|
+
"samplerate",
|
|
6745
|
+
"channelConfig",
|
|
6746
|
+
"lang"
|
|
6747
|
+
]);
|
|
6748
|
+
var MMTP_SIBLING_SOFT_FIELDS2 = Object.freeze([
|
|
6749
|
+
"initRef",
|
|
6750
|
+
"keyframeIntervalMs",
|
|
6751
|
+
"keyframeIntervalTicks",
|
|
6752
|
+
"isLive",
|
|
6753
|
+
"altGroup"
|
|
6754
|
+
]);
|
|
6755
|
+
|
|
6756
|
+
// node_modules/@blockcast/mmt-base/dist/datagram-leg-size.js
|
|
6757
|
+
var DATAGRAM_LEG_UDP_FLOOR2 = 1200;
|
|
6758
|
+
var DATAGRAM_LEG_QUIC_WT_FRAMING2 = 48;
|
|
6759
|
+
var DATAGRAM_LEG_OBJECT_HEADER2 = 13;
|
|
6760
|
+
var DATAGRAM_LEG_RELAY_ROOM2 = 16;
|
|
6761
|
+
var DATAGRAM_LEG_DATAGRAM_MAX2 = DATAGRAM_LEG_UDP_FLOOR2 - DATAGRAM_LEG_QUIC_WT_FRAMING2;
|
|
6762
|
+
var DATAGRAM_LEG_BODY_MAX2 = DATAGRAM_LEG_DATAGRAM_MAX2 - DATAGRAM_LEG_OBJECT_HEADER2 - DATAGRAM_LEG_RELAY_ROOM2;
|
|
6763
|
+
|
|
6419
6764
|
// node_modules/@blockcast/mmt-transport/dist/multicast-orchestrator.js
|
|
6420
6765
|
var DEFAULT_DWELL_MS = 3e3;
|
|
6421
6766
|
var DEFAULT_JOIN_DEADLINE_MS = 5e3;
|
|
@@ -18918,6 +19263,20 @@ var MmtpRouter = class {
|
|
|
18918
19263
|
/** The flow whose receiver admitted a stream's source datagrams, by packetId then catalog track name: recovered packets answer to it. */
|
|
18919
19264
|
#provenanceStreamFlow = /* @__PURE__ */ new Map();
|
|
18920
19265
|
#unregisteredFlowDrops = 0;
|
|
19266
|
+
/** "mfu-datagram" leg packets of a packet id the ingress does not name (never the signaling flow). */
|
|
19267
|
+
#datagramLegIngressDrops = 0;
|
|
19268
|
+
/** "mfu-datagram" leg packets of the signaling flow (packet id 0): expected, one per group. */
|
|
19269
|
+
#datagramLegSignalingPackets = 0;
|
|
19270
|
+
/**
|
|
19271
|
+
* The streams a live "mfu-datagram" leg has fed, catalog track names by
|
|
19272
|
+
* packet id: their ledgers and release gate take the leg's bounds. A stream
|
|
19273
|
+
* leaves when its leg does: `endDatagramLeg`, `resetTrack`, `dispose`, or
|
|
19274
|
+
* the first multicast packet of its packet id (the ordered switch retires
|
|
19275
|
+
* the leg first). The "mfu" sibling shares the packet id, never the name.
|
|
19276
|
+
*/
|
|
19277
|
+
#datagramLegStreams = /* @__PURE__ */ new Map();
|
|
19278
|
+
/** The leg's presentation budget (setDatagramLegPresentationBudget), or null: no presentation bound. */
|
|
19279
|
+
#datagramLegPresentationBudgetMs = null;
|
|
18921
19280
|
#ambiguousRecoveredDrops = 0;
|
|
18922
19281
|
// Temp state set by #processMMTP before calling parser.feed(),
|
|
18923
19282
|
// read by the parser's onFrame callback for CMAF assembly + dedup.
|
|
@@ -19293,10 +19652,11 @@ var MmtpRouter = class {
|
|
|
19293
19652
|
const blockLifetimeMs = fec.blockLifetimeMsForPacket(packetId);
|
|
19294
19653
|
if (blockSpanMs === void 0 || blockLifetimeMs === void 0) return NO_FEC_GEOMETRY_HORIZON;
|
|
19295
19654
|
if (blockSpanMs === 0) return NO_BLOCK_SPAN_HORIZON;
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
retentionMs
|
|
19299
|
-
}
|
|
19655
|
+
let retentionMs = duplicateRetentionMs({ blockSpanMs, blockLifetimeMs });
|
|
19656
|
+
if (this.#datagramLegStreams.has(packetId)) {
|
|
19657
|
+
retentionMs = Math.max(retentionMs, fec.datagramLegLedgerRetentionMsForPacket?.(packetId) ?? 0);
|
|
19658
|
+
}
|
|
19659
|
+
return { kind: "fec-horizon", retentionMs };
|
|
19300
19660
|
}
|
|
19301
19661
|
/**
|
|
19302
19662
|
* Init segments rejected since construction because their packetId had no
|
|
@@ -19719,7 +20079,7 @@ var MmtpRouter = class {
|
|
|
19719
20079
|
const blockStart = placement.block.start;
|
|
19720
20080
|
if (placement.span !== void 0) this.#replayOverlaySources(inst, placement.span.block.start, placement.span.placed);
|
|
19721
20081
|
this.#replayOverlaySources(inst, blockStart, placement.placed);
|
|
19722
|
-
if (source
|
|
20082
|
+
if (source !== "multicast") this.#noteOverlayMoqBlock(inst, blockStart);
|
|
19723
20083
|
const alreadyCompleted = fec.isBlockCompleted(blockStart, pid, name);
|
|
19724
20084
|
const recovered = fec.feedRepairSymbol(pid, repair.ssStart, repair.ssbLength, repair.rsId, repair.symbolData, name);
|
|
19725
20085
|
if (recovered && !alreadyCompleted) this.#routeOverlayRecovered(inst, blockStart, recovered);
|
|
@@ -19727,7 +20087,7 @@ var MmtpRouter = class {
|
|
|
19727
20087
|
#replayOverlaySources(inst, blockStart, placed) {
|
|
19728
20088
|
const { fec, repairPacketId: pid, streamName: name } = inst;
|
|
19729
20089
|
for (const { ssId, payload } of placed) {
|
|
19730
|
-
if (payload.source
|
|
20090
|
+
if (payload.source !== "multicast") this.#noteOverlayMoqBlock(inst, blockStart);
|
|
19731
20091
|
if (payload.oversized) continue;
|
|
19732
20092
|
const alreadyCompleted = fec.isBlockCompleted(blockStart, pid, name);
|
|
19733
20093
|
const recovered = fec.feedSourceSymbol(pid, ssId, payload.symbolData, name);
|
|
@@ -19780,7 +20140,7 @@ var MmtpRouter = class {
|
|
|
19780
20140
|
});
|
|
19781
20141
|
continue;
|
|
19782
20142
|
}
|
|
19783
|
-
if (source
|
|
20143
|
+
if (source !== "multicast") this.#noteOverlayMoqBlock(inst, coords.sbn);
|
|
19784
20144
|
if (oversized) continue;
|
|
19785
20145
|
const alreadyCompleted = fec.isBlockCompleted(coords.sbn, pid, name);
|
|
19786
20146
|
const recovered = fec.feedSourceSymbol(pid, ssId, symbolData, name);
|
|
@@ -20369,6 +20729,46 @@ var MmtpRouter = class {
|
|
|
20369
20729
|
get unregisteredFlowDropCount() {
|
|
20370
20730
|
return this.#unregisteredFlowDrops;
|
|
20371
20731
|
}
|
|
20732
|
+
/** "mfu-datagram" leg packets dropped because the leg's ingress does not name their packet id (packet id 0 apart). */
|
|
20733
|
+
get datagramLegIngressDropCount() {
|
|
20734
|
+
return this.#datagramLegIngressDrops;
|
|
20735
|
+
}
|
|
20736
|
+
/** "mfu-datagram" leg packets of the MMTP signaling flow (packet id 0), which no track owns. */
|
|
20737
|
+
get datagramLegSignalingPacketCount() {
|
|
20738
|
+
return this.#datagramLegSignalingPackets;
|
|
20739
|
+
}
|
|
20740
|
+
/**
|
|
20741
|
+
* The "mfu-datagram" leg's presentation bound (mmt-02 6.1 step 6): how
|
|
20742
|
+
* long after a frame arrives it must leave the release gate when the gap
|
|
20743
|
+
* before it holds no RAP, FT=0 or FT=1 data (the player's presentation
|
|
20744
|
+
* delay less its decode lead). The gap is then decided at the earlier of
|
|
20745
|
+
* the FEC block deadline and this bound; a gap that may hold a RAP keeps
|
|
20746
|
+
* the block deadline. Null, or a value that is not finite and positive:
|
|
20747
|
+
* the block deadline alone, as on multicast.
|
|
20748
|
+
*/
|
|
20749
|
+
setDatagramLegPresentationBudget(budgetMs) {
|
|
20750
|
+
this.#datagramLegPresentationBudgetMs = budgetMs;
|
|
20751
|
+
}
|
|
20752
|
+
/**
|
|
20753
|
+
* The "mfu-datagram" leg is over (unsubscribed, or switched to another
|
|
20754
|
+
* path): no stream keeps its presentation bound or its ledger retention.
|
|
20755
|
+
* Parser, FEC and ledger state stay, so the packet ids continue on the
|
|
20756
|
+
* next path without an epoch. A later leg datagram starts a leg again.
|
|
20757
|
+
*/
|
|
20758
|
+
endDatagramLeg() {
|
|
20759
|
+
this.#datagramLegStreams.clear();
|
|
20760
|
+
this.#datagramLegPresentationBudgetMs = null;
|
|
20761
|
+
}
|
|
20762
|
+
#datagramLegPresentationWaitMs(packetId, catalogTrackName) {
|
|
20763
|
+
if (this.#datagramLegPresentationBudgetMs === null || this.#datagramLegStreams.get(packetId)?.has(catalogTrackName) !== true) return void 0;
|
|
20764
|
+
let budgetMs;
|
|
20765
|
+
try {
|
|
20766
|
+
budgetMs = this.#datagramLegPresentationBudgetMs(packetId, catalogTrackName);
|
|
20767
|
+
} catch {
|
|
20768
|
+
return void 0;
|
|
20769
|
+
}
|
|
20770
|
+
return Number.isFinite(budgetMs) && budgetMs > 0 ? budgetMs : void 0;
|
|
20771
|
+
}
|
|
20372
20772
|
/** Recovered packets dropped because more than one protected flow could own their stream. */
|
|
20373
20773
|
get ambiguousRecoveredDropCount() {
|
|
20374
20774
|
return this.#ambiguousRecoveredDrops;
|
|
@@ -20386,6 +20786,10 @@ var MmtpRouter = class {
|
|
|
20386
20786
|
* caller that forgot it silently attributed its bytes to a multicast socket
|
|
20387
20787
|
* they may never have crossed — and that attribution is what the physical-
|
|
20388
20788
|
* delivery evidence path is built on. Absence is not multicast; say which.
|
|
20789
|
+
* `"moq-datagram"` is an "mfu-datagram" subscription (MmtpIngestSource):
|
|
20790
|
+
* `ingress.tracks` MUST name the datagram catalog track for its packet id,
|
|
20791
|
+
* and a packet of a packet id it does not name is dropped and counted
|
|
20792
|
+
* (`datagramLegIngressDropCount`; the signaling flow, packet id 0, apart).
|
|
20389
20793
|
*/
|
|
20390
20794
|
feedPacket(packet, source, ingress) {
|
|
20391
20795
|
if (this.#disposed) return;
|
|
@@ -20435,15 +20839,18 @@ var MmtpRouter = class {
|
|
|
20435
20839
|
}
|
|
20436
20840
|
/**
|
|
20437
20841
|
* Feed a repair packet from MoQ (reliable QUIC) — parses MMTP repair
|
|
20438
|
-
* header and delegates to FECManager for FEC recovery.
|
|
20842
|
+
* header and delegates to FECManager for FEC recovery. `source` is
|
|
20843
|
+
* `"moq-datagram"` for a repair object of an "mfu-datagram" track's repair
|
|
20844
|
+
* track, which arrives as a datagram and so counts as an in-band symbol of
|
|
20845
|
+
* the leg; a FETCHed repair stays `"moq"` (RepairVia `quic`).
|
|
20439
20846
|
*/
|
|
20440
|
-
feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName) {
|
|
20847
|
+
feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source = "moq") {
|
|
20441
20848
|
if (this.#disposed) return;
|
|
20442
20849
|
this.#withDeferredFecPokes(() => {
|
|
20443
|
-
this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName);
|
|
20850
|
+
this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source);
|
|
20444
20851
|
});
|
|
20445
20852
|
}
|
|
20446
|
-
#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, admitted = false) {
|
|
20853
|
+
#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source, admitted = false) {
|
|
20447
20854
|
let header;
|
|
20448
20855
|
try {
|
|
20449
20856
|
header = parseMMTPHeader(packet);
|
|
@@ -20453,7 +20860,7 @@ var MmtpRouter = class {
|
|
|
20453
20860
|
const repairPacketId = header.packetId;
|
|
20454
20861
|
const overlay = this.#overlayRepairTarget(repairPacketId, repairTrackName);
|
|
20455
20862
|
if (overlay !== void 0) {
|
|
20456
|
-
this.#routeOverlayRepair(overlay, repairPacketId, packet, header,
|
|
20863
|
+
this.#routeOverlayRepair(overlay, repairPacketId, packet, header, source);
|
|
20457
20864
|
return;
|
|
20458
20865
|
}
|
|
20459
20866
|
const hintedOwner = ownerPacketIdHint != null && this.#classifyPacketId(ownerPacketIdHint) !== null ? ownerPacketIdHint : null;
|
|
@@ -20465,7 +20872,7 @@ var MmtpRouter = class {
|
|
|
20465
20872
|
}
|
|
20466
20873
|
let unlisted = false;
|
|
20467
20874
|
if (ownerPacketId != null && !admitted) {
|
|
20468
|
-
const admit = this.#admitUnicast(repairPacketId, packet, () => this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, true));
|
|
20875
|
+
const admit = this.#admitUnicast(repairPacketId, packet, () => this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source, true));
|
|
20469
20876
|
if (admit === "held" || admit === "dropped") return;
|
|
20470
20877
|
unlisted = admit === "unlisted";
|
|
20471
20878
|
}
|
|
@@ -20486,7 +20893,7 @@ var MmtpRouter = class {
|
|
|
20486
20893
|
this.#noteUnreadableFecPayloadId(ownerPacketId, "repair");
|
|
20487
20894
|
return;
|
|
20488
20895
|
}
|
|
20489
|
-
this.#handleIsoRepair(ownerPacketId, catalogTrackName, parsed,
|
|
20896
|
+
this.#handleIsoRepair(ownerPacketId, catalogTrackName, parsed, source, repairTrackName);
|
|
20490
20897
|
}
|
|
20491
20898
|
}
|
|
20492
20899
|
// ── Packet FEC geometry and block profile ───────────────────────
|
|
@@ -20691,6 +21098,7 @@ var MmtpRouter = class {
|
|
|
20691
21098
|
debugRouter(
|
|
20692
21099
|
`[MmtpRouter] Dropping repair packet pid=${packetId}: physical PID is unregistered`
|
|
20693
21100
|
);
|
|
21101
|
+
this.#fecManager?.countUnresolvedRepairOwner?.("unregistered");
|
|
20694
21102
|
return null;
|
|
20695
21103
|
}
|
|
20696
21104
|
const registeredOwners = this.#repairOwnersByPacketId.get(packetId) ?? /* @__PURE__ */ new Set();
|
|
@@ -20699,6 +21107,7 @@ var MmtpRouter = class {
|
|
|
20699
21107
|
debugRouter(
|
|
20700
21108
|
`[MmtpRouter] Dropping repair packet pid=${packetId}: catalog owner is ${owners.length === 0 ? "absent" : "ambiguous"}`
|
|
20701
21109
|
);
|
|
21110
|
+
this.#fecManager?.countUnresolvedRepairOwner?.(owners.length === 0 ? "ownerAbsent" : "ownerAmbiguous");
|
|
20702
21111
|
return null;
|
|
20703
21112
|
}
|
|
20704
21113
|
/** Route a recovered FEC block through the parser + dedup pipeline.
|
|
@@ -20748,6 +21157,8 @@ var MmtpRouter = class {
|
|
|
20748
21157
|
}
|
|
20749
21158
|
this.#parser.resetTrack(packetId, catalogTrackName);
|
|
20750
21159
|
this.resetKeyframeOverlays(packetId, catalogTrackName);
|
|
21160
|
+
const legNames = this.#datagramLegStreams.get(packetId);
|
|
21161
|
+
if (legNames?.delete(catalogTrackName) && legNames.size === 0) this.#datagramLegStreams.delete(packetId);
|
|
20751
21162
|
this.#restampedStreams.delete(this.#mediaStreamKey(packetId, catalogTrackName));
|
|
20752
21163
|
const assistPrefix = assistKey(packetId, catalogTrackName, 0).slice(0, -1);
|
|
20753
21164
|
for (const key of this.#assistBlocks.keys()) if (key.startsWith(assistPrefix)) this.#assistBlocks.delete(key);
|
|
@@ -21089,6 +21500,7 @@ var MmtpRouter = class {
|
|
|
21089
21500
|
this.#fecWakes.clear();
|
|
21090
21501
|
this.#parser.dispose();
|
|
21091
21502
|
this.#streams.clear();
|
|
21503
|
+
this.endDatagramLeg();
|
|
21092
21504
|
this.#trackPacketCallbacks.clear();
|
|
21093
21505
|
this.#latestVideoSeqByStream.clear();
|
|
21094
21506
|
this.#lastDirectSourceVideoTsByStream.clear();
|
|
@@ -21278,20 +21690,27 @@ var MmtpRouter = class {
|
|
|
21278
21690
|
// an audio gap. A gap that may hold one (rap-lost, rap-unknown, or any
|
|
21279
21691
|
// other rap-next, whose gap may hold a whole MPU and the keyframe the
|
|
21280
21692
|
// overlay protects) waits for that overlay's repair too (BLO-52085
|
|
21281
|
-
// D4).
|
|
21282
|
-
//
|
|
21693
|
+
// D4). A run no repair has delimited instead waits for its FEC
|
|
21694
|
+
// deadline, whatever the decision (FECManager.isoRepairlessWaitMs). The
|
|
21695
|
+
// FEC check comes first: most held gaps are not behind such a span, and
|
|
21696
|
+
// deciding one scans both frames' bitstreams.
|
|
21283
21697
|
unrepairableWaitMs: (before, after, fromSbn, toSbn) => {
|
|
21284
21698
|
const fec = this.#fecManager;
|
|
21285
21699
|
const { packetId, catalogTrackName } = after.meta;
|
|
21286
|
-
const
|
|
21287
|
-
|
|
21700
|
+
const arrivedAtMs = after.arrivedAtMs;
|
|
21701
|
+
const allowanceMs = fec?.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, false, false, arrivedAtMs);
|
|
21702
|
+
const presentationMs = this.#datagramLegPresentationWaitMs(packetId, catalogTrackName);
|
|
21703
|
+
if (!fec || allowanceMs === void 0 && presentationMs === void 0) return void 0;
|
|
21288
21704
|
const decision = this.#decideGap(before, after, [], false);
|
|
21289
21705
|
const mpu = before.meta.mpuSequenceNumber;
|
|
21290
21706
|
const intoNextMpu = decision.reason === "rap-next" && mpu !== void 0 && after.meta.mpuSequenceNumber === mpu + 1 >>> 0 && fec.mpuBoundsRapsFor?.(packetId, catalogTrackName) === true;
|
|
21291
21707
|
if (decision.action === "stall" || decision.reason === "rap-next" && !intoNextMpu) {
|
|
21292
|
-
return fec.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, true);
|
|
21708
|
+
return allowanceMs === void 0 ? void 0 : fec.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, true, false, arrivedAtMs);
|
|
21293
21709
|
}
|
|
21294
|
-
|
|
21710
|
+
const waitMs = allowanceMs === void 0 ? void 0 : decision.reason === "rap-next" ? fec.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, false, true, arrivedAtMs) : allowanceMs;
|
|
21711
|
+
if (decision.reason === "delta-lost" && !((fec.interleaveDepthMsForPacket?.(packetId) ?? 0) > 0)) return waitMs;
|
|
21712
|
+
if (presentationMs === void 0) return waitMs;
|
|
21713
|
+
return waitMs === void 0 ? presentationMs : Math.min(waitMs, presentationMs);
|
|
21295
21714
|
},
|
|
21296
21715
|
decide: (before, after, lostBlocks, discontinuity) => {
|
|
21297
21716
|
const decision = this.#decideGap(before, after, lostBlocks, discontinuity);
|
|
@@ -21333,7 +21752,8 @@ var MmtpRouter = class {
|
|
|
21333
21752
|
meta.catalogTrackName,
|
|
21334
21753
|
meta.mpuSequenceNumber,
|
|
21335
21754
|
timing.presentationTime,
|
|
21336
|
-
timing.mediaTimescale
|
|
21755
|
+
timing.mediaTimescale,
|
|
21756
|
+
timing.decodeTime
|
|
21337
21757
|
);
|
|
21338
21758
|
}
|
|
21339
21759
|
};
|
|
@@ -21352,7 +21772,19 @@ var MmtpRouter = class {
|
|
|
21352
21772
|
const { packetId, catalogTrackName } = after.meta;
|
|
21353
21773
|
const trackKind = this.#classifyPacketId(packetId) === false ? "audio" : "video";
|
|
21354
21774
|
const positionsTrusted = this.#fecManager?.classifierModeFor?.(packetId, catalogTrackName).mode === "classifying" && before.meta.movieFragmentSequenceNumber === after.meta.movieFragmentSequenceNumber;
|
|
21355
|
-
const
|
|
21775
|
+
const mpu = before.meta.mpuSequenceNumber;
|
|
21776
|
+
const sameMpu = trackKind === "video" && mpu !== void 0 && after.meta.mpuSequenceNumber === mpu;
|
|
21777
|
+
const mpuTrusted = this.#fecManager?.mpuBoundsRapsFor?.(
|
|
21778
|
+
packetId,
|
|
21779
|
+
catalogTrackName,
|
|
21780
|
+
sameMpu ? {
|
|
21781
|
+
mpu,
|
|
21782
|
+
from: before.meta.authoredTiming,
|
|
21783
|
+
to: after.meta.authoredTiming,
|
|
21784
|
+
fromSsId: before.meta.fecSbn,
|
|
21785
|
+
toSsId: after.meta.fecSbnFirst ?? after.meta.fecSbn
|
|
21786
|
+
} : void 0
|
|
21787
|
+
) === true;
|
|
21356
21788
|
const evidence = (frame) => {
|
|
21357
21789
|
const timing = frame.meta.authoredTiming;
|
|
21358
21790
|
const sampleNumber = frame.meta.sampleNumber;
|
|
@@ -21468,18 +21900,34 @@ var MmtpRouter = class {
|
|
|
21468
21900
|
if (manifestAdmitted && !info.isRepair && ingress?.admittedBy !== USER_AGENT_VERIFIED) this.#admittedSourceDatagrams++;
|
|
21469
21901
|
if (source === "multicast" && !manifestAdmitted) {
|
|
21470
21902
|
this.#fecManager?.noteMulticastArrival?.(info.packetId, info.sequenceNumber);
|
|
21903
|
+
} else if (source === "moq-datagram" && !manifestAdmitted) {
|
|
21904
|
+
this.#fecManager?.noteArrival?.("moq-datagram", info.packetId, info.sequenceNumber);
|
|
21471
21905
|
}
|
|
21472
|
-
if (source
|
|
21906
|
+
if (source !== "moq" && !ingressHasPacketId(ingress, info.packetId)) {
|
|
21907
|
+
if (source === "moq-datagram") {
|
|
21908
|
+
if (info.packetId === MMTP_SIGNALING_PACKET_ID) this.#datagramLegSignalingPackets++;
|
|
21909
|
+
else this.#datagramLegIngressDrops++;
|
|
21910
|
+
}
|
|
21473
21911
|
debugRouter(
|
|
21474
|
-
`[MmtpRouter] Dropping
|
|
21912
|
+
`[MmtpRouter] Dropping ${source} packet pid=${info.packetId}: absent from ingress tracks`
|
|
21475
21913
|
);
|
|
21476
21914
|
return;
|
|
21477
21915
|
}
|
|
21916
|
+
if (source === "moq-datagram") {
|
|
21917
|
+
if (!info.isRepair) {
|
|
21918
|
+
let names = this.#datagramLegStreams.get(info.packetId);
|
|
21919
|
+
if (!names) this.#datagramLegStreams.set(info.packetId, names = /* @__PURE__ */ new Set());
|
|
21920
|
+
names.add(catalogTrackNameForPacket(ingress, info.packetId));
|
|
21921
|
+
}
|
|
21922
|
+
} else if (source === "multicast") {
|
|
21923
|
+
this.#datagramLegStreams.delete(info.packetId);
|
|
21924
|
+
}
|
|
21478
21925
|
const packetRole = this.#packetIdRoles.get(info.packetId);
|
|
21479
|
-
if (source
|
|
21926
|
+
if (source !== "moq" && this.#classifyPacketId(info.packetId) === null && (!info.isRepair || packetRole !== "repair")) {
|
|
21480
21927
|
debugRouter(
|
|
21481
|
-
`[MmtpRouter] Dropping
|
|
21928
|
+
`[MmtpRouter] Dropping ${source} packet pid=${info.packetId}: physical PID is unregistered`
|
|
21482
21929
|
);
|
|
21930
|
+
if (info.isRepair) this.#fecManager?.countUnresolvedRepairOwner?.("unregistered");
|
|
21483
21931
|
return;
|
|
21484
21932
|
}
|
|
21485
21933
|
if (!info.isRepair && hasAmbiguousCatalogTrackName(ingress, info.packetId)) {
|
|
@@ -21515,7 +21963,7 @@ var MmtpRouter = class {
|
|
|
21515
21963
|
}
|
|
21516
21964
|
return;
|
|
21517
21965
|
}
|
|
21518
|
-
if (source
|
|
21966
|
+
if (source !== "multicast" && !manifestAdmitted) {
|
|
21519
21967
|
const admit = this.#admitUnicast(info.packetId, packet, () => this.#processMMTP(packet, source, true, ingress, overlapCopy, true), overlapCopy);
|
|
21520
21968
|
if (admit !== "unlisted") {
|
|
21521
21969
|
if (admit === "admitted") this.#processMMTP(packet, source, true, ingress, overlapCopy);
|
|
@@ -21544,7 +21992,7 @@ var MmtpRouter = class {
|
|
|
21544
21992
|
);
|
|
21545
21993
|
if (!repair) return;
|
|
21546
21994
|
if (ownerPacketId != null && this.#fecManager) {
|
|
21547
|
-
if ((flowless && this.#userAgentGoverns(ownerPacketId) || source
|
|
21995
|
+
if ((flowless && this.#userAgentGoverns(ownerPacketId) || source !== "multicast" && !manifestAdmitted) && this.#setAsideUnlistedRepair(ownerPacketId, catalogTrackNameForPacket(ingress, ownerPacketId), repair)) return;
|
|
21548
21996
|
this.#repairPidCounts[info.packetId] = (this.#repairPidCounts[info.packetId] || 0) + 1;
|
|
21549
21997
|
const count = this.#repairPidCounts[info.packetId];
|
|
21550
21998
|
if (count <= 2 || count % 500 === 0) {
|
|
@@ -21583,7 +22031,7 @@ var MmtpRouter = class {
|
|
|
21583
22031
|
const fecSource = this.#fecManager !== null && fecPayloadId != null;
|
|
21584
22032
|
const coords = fecSource && fecPayloadId ? this.#locateFecSource(info.packetId, catalogTrackName, fecPayloadId.ssId) ?? void 0 : void 0;
|
|
21585
22033
|
duplicates.advance(coords?.sbn);
|
|
21586
|
-
if (source
|
|
22034
|
+
if (source !== "moq" && !overlapCopy && !releasedFromQuarantine && catalogTrackName !== void 0 && duplicates.predatesHorizon(info.sequenceNumber, fecPayloadId?.ssId)) {
|
|
21587
22035
|
this.#publisherRestarts++;
|
|
21588
22036
|
console.warn(
|
|
21589
22037
|
`[MmtpRouter] publisher restart on pid=${info.packetId} track=${catalogTrackName}: packet_sequence_number=${info.sequenceNumber} predates the stream's FEC horizon; starting a new epoch`
|
|
@@ -21644,6 +22092,7 @@ var MmtpRouter = class {
|
|
|
21644
22092
|
evidence: sourceSymbolEvidence(packet, parsed.header, info.rapFlag, info.sequenceNumber),
|
|
21645
22093
|
oversized: !(this.#fecManager.isoSourceFits?.(info.packetId, rawSymbol.length) ?? false)
|
|
21646
22094
|
}) ?? false;
|
|
22095
|
+
if (held) this.#requestFecPoke(info.packetId, catalogTrackName);
|
|
21647
22096
|
parseSourceSymbol = held && !duplicates.parsedSymbols.has(ssId);
|
|
21648
22097
|
}
|
|
21649
22098
|
} else if (fecUnreadable && info.fecPayloadId) {
|
|
@@ -21771,7 +22220,9 @@ var MmtpRouter = class {
|
|
|
21771
22220
|
const feedOptions = {
|
|
21772
22221
|
skipFecPayloadId: parserOptions?.skipFecPayloadId,
|
|
21773
22222
|
recovered: parserOptions?.recovered,
|
|
21774
|
-
|
|
22223
|
+
// Frame attribution is the transport path: an "mfu-datagram" object
|
|
22224
|
+
// crossed QUIC, so its frames are 'moq' (provenance 'mixed').
|
|
22225
|
+
source: parserOptions?.source === "moq-datagram" ? "moq" : parserOptions?.source,
|
|
21775
22226
|
deliveryProvenance: parserOptions?.deliveryProvenance,
|
|
21776
22227
|
catalogTrackName: parserOptions?.catalogTrackName,
|
|
21777
22228
|
...parserOptions?.fecSbn === void 0 ? {} : { fecSbn: parserOptions.fecSbn },
|
|
@@ -23686,6 +24137,7 @@ function newBlockPolicyStats(packetId, catalogTrackName, epoch) {
|
|
|
23686
24137
|
stalls: 0,
|
|
23687
24138
|
concealedBlocks: 0,
|
|
23688
24139
|
concealedGaps: 0,
|
|
24140
|
+
undelimitedRunGaps: 0,
|
|
23689
24141
|
concealedFrames: 0,
|
|
23690
24142
|
concealedAudioMs: 0,
|
|
23691
24143
|
vanishedBlocks: 0
|
|
@@ -24192,6 +24644,9 @@ var MulticastManager = class {
|
|
|
24192
24644
|
reason
|
|
24193
24645
|
});
|
|
24194
24646
|
};
|
|
24647
|
+
this.#fec.onUndelimitedRunGap = (packetId, catalogTrackName) => {
|
|
24648
|
+
this.#statsFor(packetId, catalogTrackName).undelimitedRunGaps++;
|
|
24649
|
+
};
|
|
24195
24650
|
this.#fec.onBlockVanished = (_sbn, packetId, catalogTrackName) => {
|
|
24196
24651
|
this.#statsFor(packetId, catalogTrackName).vanishedBlocks++;
|
|
24197
24652
|
};
|
|
@@ -24496,6 +24951,7 @@ var MulticastManager = class {
|
|
|
24496
24951
|
assertPositiveGeometry("timescale", config.timescale);
|
|
24497
24952
|
assertPositiveGeometry("keyframeIntervalTicks", config.keyframeIntervalTicks);
|
|
24498
24953
|
assertPositiveGeometry("keyframeIntervalMs", config.keyframeIntervalMs);
|
|
24954
|
+
assertPositiveGeometry("groupDurationMs", config.groupDurationMs);
|
|
24499
24955
|
assertNonNegativeGeometry("fecRepairSymbols", config.fecRepairSymbols);
|
|
24500
24956
|
assertNonNegativeGeometry(
|
|
24501
24957
|
"fecReorderToleranceMs",
|
|
@@ -24528,7 +24984,8 @@ var MulticastManager = class {
|
|
|
24528
24984
|
timeoutMs: deliveryWindowMs,
|
|
24529
24985
|
...trackKind === void 0 ? {} : { trackKind },
|
|
24530
24986
|
...config.codec === void 0 ? {} : { codec: config.codec },
|
|
24531
|
-
...geometry2 === void 0 ? {} : { geometry: geometry2 }
|
|
24987
|
+
...geometry2 === void 0 ? {} : { geometry: geometry2 },
|
|
24988
|
+
...config.groupDurationMs === void 0 ? {} : { groupDurationMs: config.groupDurationMs }
|
|
24532
24989
|
};
|
|
24533
24990
|
this.#fec.configureTrack(packetId, fecConfig, catalogTrackName);
|
|
24534
24991
|
this.#configureTrackMapper(packetId, fecConfig);
|
|
@@ -25229,6 +25686,70 @@ var MulticastManager = class {
|
|
|
25229
25686
|
feedPacket(data, ingress, sourceAddress) {
|
|
25230
25687
|
this.#transport.feedPacket(data, ingress, sourceAddress);
|
|
25231
25688
|
}
|
|
25689
|
+
/**
|
|
25690
|
+
* Start an "mfu-datagram" leg (draft-ramadan-moq-mmt-02 4.3.1): a
|
|
25691
|
+
* subscription whose objects arrive as datagrams, a lossy unicast path.
|
|
25692
|
+
* Arms the join-boundary rules exactly as a multicast join does (the leg
|
|
25693
|
+
* starts at an arbitrary datagram), keeping configured tracks, decoders
|
|
25694
|
+
* and diagnostics. No MulticastTransport is involved: no takeover, no
|
|
25695
|
+
* failback watchdog, no bridge. While the leg is up the player publishes
|
|
25696
|
+
* `datagramLegDiagnostics(...)` in its FEC stats (`DatagramLegDiagnostics`:
|
|
25697
|
+
* `datagramLegJoined`, `datagramLegIngressDrops`,
|
|
25698
|
+
* `datagramLegRepairBeforePacketId`, `datagramUnknownAlias`,
|
|
25699
|
+
* `transport.maxDatagramSize`), the same keys in every player.
|
|
25700
|
+
*/
|
|
25701
|
+
startDatagramLeg(options = {}) {
|
|
25702
|
+
this.#router.setDatagramLegPresentationBudget(options.presentationBudgetMs ?? null);
|
|
25703
|
+
this.#fec.beginLegJoin();
|
|
25704
|
+
}
|
|
25705
|
+
/**
|
|
25706
|
+
* Feed one object of an "mfu-datagram" subscription (one MMTP packet) in
|
|
25707
|
+
* arrival order. `ingress.tracks` names the datagram catalog track for the
|
|
25708
|
+
* packet id; the router restores serial order, holds FEC sources until a
|
|
25709
|
+
* repair states their block, and declares loss at the block deadline
|
|
25710
|
+
* (mmt-02 5.3.3). Bypasses MulticastTransport, unlike `feedPacket`.
|
|
25711
|
+
*/
|
|
25712
|
+
feedDatagramLegPacket(packet, ingress) {
|
|
25713
|
+
this.#router.feedPacket(packet, "moq-datagram", ingress);
|
|
25714
|
+
}
|
|
25715
|
+
/**
|
|
25716
|
+
* Feed one repair object of an "mfu-datagram" track's repair track (sent
|
|
25717
|
+
* as datagrams, mmt-02 4.3.1): the repair track's own packet id names no
|
|
25718
|
+
* owner, so the subscription supplies it, as `router.feedRepairPacket`
|
|
25719
|
+
* does for a MoQ repair; the symbol counts as in-band (`RepairVia`
|
|
25720
|
+
* `inband`), unlike a FETCHed repair.
|
|
25721
|
+
*/
|
|
25722
|
+
feedDatagramLegRepair(packet, ownerPacketId, catalogTrackName, repairTrackName) {
|
|
25723
|
+
this.#router.feedRepairPacket(packet, ownerPacketId, catalogTrackName, repairTrackName, "moq-datagram");
|
|
25724
|
+
}
|
|
25725
|
+
/**
|
|
25726
|
+
* End the "mfu-datagram" leg: call it when the subscription is dropped and
|
|
25727
|
+
* before the first packet of the path that replaces it (the ordered switch
|
|
25728
|
+
* to multicast, a fallback to the "mfu" track). The leg's presentation
|
|
25729
|
+
* bound and ledger retention stop applying; tracks, decoders, FEC state
|
|
25730
|
+
* and diagnostics stay, so the next path continues without a new epoch.
|
|
25731
|
+
*/
|
|
25732
|
+
stopDatagramLeg() {
|
|
25733
|
+
this.#router.endDatagramLeg();
|
|
25734
|
+
}
|
|
25735
|
+
/** "mfu-datagram" leg packets dropped because their packet id is not the leg's (`MmtpRouter.datagramLegIngressDropCount`). */
|
|
25736
|
+
get datagramLegIngressDropCount() {
|
|
25737
|
+
return this.#router.datagramLegIngressDropCount;
|
|
25738
|
+
}
|
|
25739
|
+
/**
|
|
25740
|
+
* The leg's diagnostics as one object with the shared names
|
|
25741
|
+
* (`DatagramLegDiagnostics`): the player supplies what it alone counts and
|
|
25742
|
+
* spreads the result into its published FEC stats while a leg is up.
|
|
25743
|
+
*/
|
|
25744
|
+
datagramLegDiagnostics(player) {
|
|
25745
|
+
return {
|
|
25746
|
+
datagramLegJoined: player.joined,
|
|
25747
|
+
datagramLegIngressDrops: this.#router.datagramLegIngressDropCount,
|
|
25748
|
+
datagramLegRepairBeforePacketId: player.repairBeforePacketId,
|
|
25749
|
+
datagramUnknownAlias: player.unknownAlias,
|
|
25750
|
+
transport: { maxDatagramSize: player.maxDatagramSize ?? null }
|
|
25751
|
+
};
|
|
25752
|
+
}
|
|
25232
25753
|
/**
|
|
25233
25754
|
* Declare how packets given to feedPacket() reach this manager. A consumer
|
|
25234
25755
|
* that owns the multicast socket itself declares its own leg; join()
|