@blockcast/mmt-container 2.2.0-main.cc3fe0684403 → 2.2.0-main.d79fbb738dc0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -2
- package/dist/__tests__/ad-creative-signer.d.ts +11 -0
- package/dist/__tests__/ad-creative-signer.d.ts.map +1 -0
- package/dist/__tests__/test-utils.d.ts +1 -0
- package/dist/__tests__/test-utils.d.ts.map +1 -1
- package/dist/ad-creative-record.d.ts +65 -0
- package/dist/ad-creative-record.d.ts.map +1 -0
- package/dist/ad-creative-record.js +2281 -0
- package/dist/ad-creative-record.js.map +7 -0
- package/dist/ad-creative-timeline.d.ts +102 -0
- package/dist/ad-creative-timeline.d.ts.map +1 -0
- package/dist/ad-creative-timeline.js +2529 -0
- package/dist/ad-creative-timeline.js.map +7 -0
- package/dist/block-policy.d.ts +128 -14
- package/dist/block-policy.d.ts.map +1 -1
- package/dist/block-policy.js +472 -27
- package/dist/block-policy.js.map +2 -2
- package/dist/browser-runtime.js +1040 -120
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +1 -0
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +34 -0
- package/dist/carp-catalog.js.map +4 -4
- package/dist/catalog-fec-params.js.map +1 -1
- 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 +25 -19
- package/dist/catalog-network-source.js.map +3 -3
- package/dist/cmaf-block-assembler.d.ts +10 -2
- package/dist/cmaf-block-assembler.d.ts.map +1 -1
- package/dist/cmaf-block-assembler.js +30 -8
- package/dist/cmaf-block-assembler.js.map +3 -3
- package/dist/codec-utils.d.ts.map +1 -1
- package/dist/codec-utils.js +16 -3
- package/dist/codec-utils.js.map +2 -2
- package/dist/conceal-timeline.d.ts +24 -1
- package/dist/conceal-timeline.d.ts.map +1 -1
- package/dist/conceal-timeline.js +201 -4
- package/dist/conceal-timeline.js.map +3 -3
- package/dist/datagram-leg-deadline.d.ts +26 -2
- package/dist/datagram-leg-deadline.d.ts.map +1 -1
- package/dist/datagram-leg-deadline.js +14 -2
- package/dist/datagram-leg-deadline.js.map +2 -2
- package/dist/event-timeline-mmtp.d.ts +17 -0
- package/dist/event-timeline-mmtp.d.ts.map +1 -0
- package/dist/event-timeline-mmtp.js +3117 -0
- package/dist/event-timeline-mmtp.js.map +7 -0
- package/dist/fec-manager.d.ts +24 -3
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +531 -38
- package/dist/fec-manager.js.map +2 -2
- package/dist/feed-gate.d.ts +114 -0
- package/dist/feed-gate.d.ts.map +1 -0
- package/dist/feed-gate.js +175 -0
- package/dist/feed-gate.js.map +7 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +2 -2
- package/dist/iso-bmff-timing.d.ts +16 -0
- package/dist/iso-bmff-timing.d.ts.map +1 -1
- package/dist/iso-bmff-timing.js +28 -0
- package/dist/iso-bmff-timing.js.map +2 -2
- package/dist/mfu-reassembler.d.ts +2 -0
- package/dist/mfu-reassembler.d.ts.map +1 -1
- package/dist/mfu-reassembler.js +4 -2
- package/dist/mfu-reassembler.js.map +2 -2
- package/dist/mmtp-container-parser.d.ts +12 -0
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +73 -3
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +103 -25
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +73 -3
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-router.d.ts +20 -2
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +150 -23
- package/dist/mmtp-router.js.map +3 -3
- package/dist/multicast-auth-catalog.js.map +1 -1
- package/dist/multicast-input.js.map +1 -1
- package/dist/multicast-manager.d.ts +23 -2
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +737 -86
- package/dist/multicast-manager.js.map +3 -3
- package/dist/multicast-transport.js +44 -22
- package/dist/multicast-transport.js.map +2 -2
- package/dist/no-modules.js +98 -22
- package/dist/no-modules.js.map +4 -4
- package/dist/repair-fetch.d.ts +15 -7
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +34 -7
- package/dist/repair-fetch.js.map +2 -2
- package/dist/wasm-mfu-reassembler.js.map +2 -2
- package/dist/wasm-mmtp-container-parser.js +73 -3
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +17 -5
- package/schemas/catalog.schema.json +7 -2
- package/src/ad-creative-record.ts +276 -0
- package/src/ad-creative-timeline.ts +409 -0
- package/src/block-policy.ts +673 -42
- package/src/carp-catalog.ts +9 -0
- package/src/catalog-network-source.ts +3 -37
- package/src/cmaf-block-assembler.ts +17 -0
- package/src/codec-utils.ts +19 -3
- package/src/conceal-timeline.ts +60 -5
- package/src/datagram-leg-deadline.ts +34 -2
- package/src/event-timeline-mmtp.ts +55 -0
- package/src/fec-manager.ts +84 -12
- package/src/feed-gate.ts +295 -0
- package/src/index.ts +22 -0
- package/src/iso-bmff-timing.ts +33 -0
- package/src/mfu-reassembler.ts +4 -0
- package/src/mmtp-container-parser.ts +51 -5
- package/src/mmtp-router.ts +116 -4
- package/src/multicast-manager.ts +31 -0
- package/src/repair-fetch.ts +70 -19
- package/test-vectors/catalog/README.md +1 -0
- package/test-vectors/catalog/negative/event-timeline-empty-event-type.json +41 -0
- package/test-vectors/catalog/positive/event-timeline-ad-creative.json +41 -0
- package/test-vectors/catalog/positive/event-timeline-wallclock-no-depends.json +38 -0
- package/test-vectors/catalog/positive/multicast-event-timeline.json +81 -0
- package/test-vectors/catalog/section-codes.json +1 -0
- package/test-vectors/catalog-timing.json +184 -1
- package/test-vectors/frame-needs-v1.json +295 -0
- package/test-vectors/repair-policy-v1.json +98 -18
|
@@ -1685,11 +1685,13 @@ function deriveBlockClassifierGeometry(input) {
|
|
|
1685
1685
|
} else if (isPositiveFinite(input.keyframeIntervalMs)) {
|
|
1686
1686
|
keyframeInterval = { ticks: input.keyframeIntervalMs, timescale: 1e3 };
|
|
1687
1687
|
}
|
|
1688
|
+
const groupDuration = isPositiveFinite(input.groupDurationMs) ? { groupDurationMs: input.groupDurationMs } : {};
|
|
1688
1689
|
const protect = (reason) => ({
|
|
1689
1690
|
trackKind: "video",
|
|
1690
1691
|
mode: "all-protected",
|
|
1691
1692
|
reason,
|
|
1692
|
-
...keyframeInterval === void 0 ? {} : { keyframeInterval }
|
|
1693
|
+
...keyframeInterval === void 0 ? {} : { keyframeInterval },
|
|
1694
|
+
...groupDuration
|
|
1693
1695
|
});
|
|
1694
1696
|
if (!isPositiveFinite(input.framerate)) return protect("framerate-absent");
|
|
1695
1697
|
const framerate = input.framerate;
|
|
@@ -1705,9 +1707,24 @@ function deriveBlockClassifierGeometry(input) {
|
|
|
1705
1707
|
frameDurationMs,
|
|
1706
1708
|
interleaveUnits,
|
|
1707
1709
|
gopFrames,
|
|
1708
|
-
keyframeInterval
|
|
1710
|
+
keyframeInterval,
|
|
1711
|
+
...groupDuration
|
|
1709
1712
|
};
|
|
1710
1713
|
}
|
|
1714
|
+
function isPositiveSafeInteger(value) {
|
|
1715
|
+
return Number.isSafeInteger(value) && value > 0;
|
|
1716
|
+
}
|
|
1717
|
+
function mpuRuleCatalogReason(geometry2) {
|
|
1718
|
+
const interval = geometry2.keyframeInterval;
|
|
1719
|
+
if (interval === void 0 || !isPositiveSafeInteger(interval.ticks) || !isPositiveSafeInteger(interval.timescale)) {
|
|
1720
|
+
return "keyframe-interval-absent";
|
|
1721
|
+
}
|
|
1722
|
+
const groupMs = geometry2.groupDurationMs;
|
|
1723
|
+
if (!isPositiveFinite(groupMs)) return "group-duration-absent";
|
|
1724
|
+
const { ticks, timescale } = interval;
|
|
1725
|
+
const equal = Number.isSafeInteger(groupMs) ? BigInt(ticks) * 1000n === BigInt(groupMs) * BigInt(timescale) : Math.abs(ticks / timescale * 1e3 - groupMs) <= 2 * Number.EPSILON * groupMs;
|
|
1726
|
+
return equal ? null : "keyframe-interval-not-group-duration";
|
|
1727
|
+
}
|
|
1711
1728
|
function keyframeIntervalMediaTicks(geometry2, mediaTimescale) {
|
|
1712
1729
|
if (geometry2.trackKind !== "video" || geometry2.keyframeInterval === void 0) return null;
|
|
1713
1730
|
if (!Number.isSafeInteger(mediaTimescale) || mediaTimescale <= 0) return null;
|
|
@@ -1725,6 +1742,25 @@ function keyframeInstantBetween(start, interval, from, to) {
|
|
|
1725
1742
|
function compareDataUnitStarts(a, b) {
|
|
1726
1743
|
return a.movieFragment - b.movieFragment | 0 || a.idx - b.idx || a.offset - b.offset;
|
|
1727
1744
|
}
|
|
1745
|
+
function firstStartAtOrAfter(starts, sbn) {
|
|
1746
|
+
let lo = 0;
|
|
1747
|
+
let hi = starts.length;
|
|
1748
|
+
while (lo < hi) {
|
|
1749
|
+
const mid = lo + hi >>> 1;
|
|
1750
|
+
if (starts[mid].sbn < sbn) lo = mid + 1;
|
|
1751
|
+
else hi = mid;
|
|
1752
|
+
}
|
|
1753
|
+
return lo;
|
|
1754
|
+
}
|
|
1755
|
+
var ARRIVED_START_MAX = 4096;
|
|
1756
|
+
function nextSampleHeader(headers, at) {
|
|
1757
|
+
const of = headers[at];
|
|
1758
|
+
for (let i = at + 1; i < headers.length; i++) {
|
|
1759
|
+
const header = headers[i];
|
|
1760
|
+
if (header.movieFragment !== of.movieFragment || header.idx !== of.idx) return header;
|
|
1761
|
+
}
|
|
1762
|
+
return void 0;
|
|
1763
|
+
}
|
|
1728
1764
|
var LATE_RAP_MAX_MPUS_BACK = 64;
|
|
1729
1765
|
var UNPLACED = { rapNotMpuStart: false };
|
|
1730
1766
|
var BlockClassifier = class {
|
|
@@ -1749,6 +1785,50 @@ var BlockClassifier = class {
|
|
|
1749
1785
|
#mpuSbnSpans = /* @__PURE__ */ new Map();
|
|
1750
1786
|
#dataUnitStarts = /* @__PURE__ */ new Map();
|
|
1751
1787
|
#highestMpu = null;
|
|
1788
|
+
/**
|
|
1789
|
+
* The DU headers held, per MPU in authored order, for the MPU rule. Kept in
|
|
1790
|
+
* every mode (the rule needs no catalog cadence) for the same horizon and
|
|
1791
|
+
* the same continuous SBN sequence as the P1 ledger.
|
|
1792
|
+
*/
|
|
1793
|
+
#headers = /* @__PURE__ */ new Map();
|
|
1794
|
+
/**
|
|
1795
|
+
* The source packets that arrived, per MPU. The MPU rule asks it whether
|
|
1796
|
+
* every packet between two held DU headers arrived, and where. Same
|
|
1797
|
+
* horizon as the headers.
|
|
1798
|
+
*/
|
|
1799
|
+
#arrived = /* @__PURE__ */ new Map();
|
|
1800
|
+
#heldHighestMpu = null;
|
|
1801
|
+
/** Two DU headers of this sequence lay in blocks against their authored order: the MPU rule proves nothing. */
|
|
1802
|
+
#headerOrderRefuted = false;
|
|
1803
|
+
/**
|
|
1804
|
+
* A DU header held carried RAP_flag and was not of its MPU's first sample:
|
|
1805
|
+
* not the first sample of its movie fragment, or in another movie fragment
|
|
1806
|
+
* than the first DU header held of its MPU. This stream puts a RAP inside
|
|
1807
|
+
* an MPU, and neither rule proves anything for the rest of the epoch. It is
|
|
1808
|
+
* the MPU rule's own reading, in every DU-header layout and of rebuilt
|
|
1809
|
+
* headers too. The first case is read on a header of an MPU behind the two
|
|
1810
|
+
* kept as well. `mpuBoundsRaps`, which the stall or conceal decision reads,
|
|
1811
|
+
* is set as before and not from here.
|
|
1812
|
+
*/
|
|
1813
|
+
#rapInsideMpu = false;
|
|
1814
|
+
/** What the catalog lacks for the MPU rule, or null when it states a keyframe interval equal to the group duration. */
|
|
1815
|
+
#mpuRuleCatalog = null;
|
|
1816
|
+
/**
|
|
1817
|
+
* The lowest and highest decode time known in an MPU, for the two MPUs of
|
|
1818
|
+
* the highest numbers: those of the samples that held movie fragment
|
|
1819
|
+
* metadata times (noteDecodeTimes). Valid within one MPU sequence, as the
|
|
1820
|
+
* P1 ledger is; if MPU numbers go back with no source discontinuity, the
|
|
1821
|
+
* new ones are not read until then, as their DU headers are not.
|
|
1822
|
+
*/
|
|
1823
|
+
#decodeSpans = /* @__PURE__ */ new Map();
|
|
1824
|
+
/**
|
|
1825
|
+
* An MPU held a sample one keyframe interval or more after another by
|
|
1826
|
+
* decode time, so it lasts longer than the interval. A track of an earlier
|
|
1827
|
+
* revision whose interval equals its group duration can hold a further RAP
|
|
1828
|
+
* only in such an MPU: neither rule proves anything for the rest of the
|
|
1829
|
+
* epoch.
|
|
1830
|
+
*/
|
|
1831
|
+
#mpuOutlastsInterval = false;
|
|
1752
1832
|
/**
|
|
1753
1833
|
* P3 layout, kept for the MPUs within the classification horizon and valid
|
|
1754
1834
|
* within one continuous SBN sequence (`noteSourceDiscontinuity`).
|
|
@@ -1791,6 +1871,20 @@ var BlockClassifier = class {
|
|
|
1791
1871
|
get mpuBoundsRaps() {
|
|
1792
1872
|
return this.#mpuBoundsRaps;
|
|
1793
1873
|
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Why the MPU rule classes no block on this track now, or null while it
|
|
1876
|
+
* can. A catalog reason is known from the start of the epoch; the others
|
|
1877
|
+
* name what the stream showed. A block the rule would have classed reads
|
|
1878
|
+
* `unknown` under every one of them, and so does one the window rule would
|
|
1879
|
+
* have classed, under every one but `du-headers-out-of-order`.
|
|
1880
|
+
*/
|
|
1881
|
+
get mpuRuleOff() {
|
|
1882
|
+
if (this.#mpuRuleCatalog !== null) return this.#mpuRuleCatalog;
|
|
1883
|
+
if (this.#rapInsideMpu) return "rap-inside-mpu";
|
|
1884
|
+
if (this.#mpuOutlastsInterval) return "mpu-longer-than-keyframe-interval";
|
|
1885
|
+
if (!this.#mpuBoundsRaps) return "mpu-bounds-raps-refuted";
|
|
1886
|
+
return this.#headerOrderRefuted ? "du-headers-out-of-order" : null;
|
|
1887
|
+
}
|
|
1794
1888
|
/** Begin a fresh epoch (catalog change or track reset). */
|
|
1795
1889
|
reset(geometry2 = this.#geometry) {
|
|
1796
1890
|
this.#geometry = geometry2;
|
|
@@ -1799,6 +1893,9 @@ var BlockClassifier = class {
|
|
|
1799
1893
|
this.#clearMpuLayout();
|
|
1800
1894
|
this.#lastRap = null;
|
|
1801
1895
|
this.#mpuBoundsRaps = true;
|
|
1896
|
+
this.#rapInsideMpu = false;
|
|
1897
|
+
this.#mpuOutlastsInterval = false;
|
|
1898
|
+
this.#mpuRuleCatalog = geometry2.trackKind === "video" ? mpuRuleCatalogReason(geometry2) : null;
|
|
1802
1899
|
if (geometry2.trackKind === "video" && geometry2.mode === "all-protected") {
|
|
1803
1900
|
this.#mode = "all-protected";
|
|
1804
1901
|
this.#reason = geometry2.reason;
|
|
@@ -1839,9 +1936,16 @@ var BlockClassifier = class {
|
|
|
1839
1936
|
this.#clearMpuLayout();
|
|
1840
1937
|
this.#lastRap = null;
|
|
1841
1938
|
}
|
|
1842
|
-
/**
|
|
1939
|
+
/**
|
|
1940
|
+
* Register a block that exists without evidence of its own: a vanished
|
|
1941
|
+
* block, or one only repair symbols state. The DU headers already held
|
|
1942
|
+
* around it class it now (the MPU rule); no later header need come between
|
|
1943
|
+
* them to ask again.
|
|
1944
|
+
*/
|
|
1843
1945
|
touch(sbn) {
|
|
1844
|
-
|
|
1946
|
+
const changes = [];
|
|
1947
|
+
this.#reclassify(sbn, this.#blockFor(sbn), changes);
|
|
1948
|
+
return changes;
|
|
1845
1949
|
}
|
|
1846
1950
|
/** Forget a resolved block. */
|
|
1847
1951
|
forget(sbn) {
|
|
@@ -1851,8 +1955,15 @@ var BlockClassifier = class {
|
|
|
1851
1955
|
if (this.#geometry.trackKind === "audio") return "audio";
|
|
1852
1956
|
return this.#blocks.get(sbn)?.cls ?? "unknown";
|
|
1853
1957
|
}
|
|
1854
|
-
/**
|
|
1855
|
-
|
|
1958
|
+
/**
|
|
1959
|
+
* Record one first-arrival source symbol's evidence for block `sbn`.
|
|
1960
|
+
* `ssId` is its FEC source symbol id (the block's SS_Start plus its ESI,
|
|
1961
|
+
* ISO/IEC 23008-1 C.5.2). The publisher numbers the packets of the FEC
|
|
1962
|
+
* flow with it, one each, so the MPU rule reads from it whether every
|
|
1963
|
+
* packet between two DU headers arrived. Without it the rule's two
|
|
1964
|
+
* exceptions prove nothing.
|
|
1965
|
+
*/
|
|
1966
|
+
observe(sbn, evidence, ssId) {
|
|
1856
1967
|
if (this.#geometry.trackKind === "audio") return [];
|
|
1857
1968
|
const changes = [];
|
|
1858
1969
|
const block = this.#blockFor(sbn);
|
|
@@ -1864,22 +1975,137 @@ var BlockClassifier = class {
|
|
|
1864
1975
|
block.positionMin = block.positionMin === void 0 ? position : Math.min(block.positionMin, position);
|
|
1865
1976
|
block.positionMax = block.positionMax === void 0 ? position : Math.max(block.positionMax, position);
|
|
1866
1977
|
}
|
|
1867
|
-
if (placement.rapNotMpuStart) this.#
|
|
1978
|
+
if (placement.rapNotMpuStart) this.#refuteMpuBounds(changes);
|
|
1868
1979
|
const violation = this.#checkInvariants(sbn, block, evidence, placement);
|
|
1869
1980
|
if (violation !== null) changes.push(...this.#disable(violation));
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1981
|
+
this.#noteArrived(sbn, evidence.mpu, ssId);
|
|
1982
|
+
const bounds = this.#noteHeader(sbn, evidence, position, ssId, changes);
|
|
1983
|
+
this.#reclassify(sbn, block, changes);
|
|
1984
|
+
if (bounds) this.#reclassifyOthers(sbn, changes);
|
|
1985
|
+
return changes;
|
|
1986
|
+
}
|
|
1987
|
+
/**
|
|
1988
|
+
* A first-arrival source symbol placed in a repair-less span (IsoBlockLocator:
|
|
1989
|
+
* the SS_IDs between two stated blocks whose every repair was lost). A span
|
|
1990
|
+
* is no block: it can hold several producer blocks, so nothing block-scoped
|
|
1991
|
+
* is read from it (no record, P1, P2 or MPU-rule bound) and its blocks stay
|
|
1992
|
+
* unknown. What its DU header says of its MPU (P3) still counts (BLO-57323).
|
|
1993
|
+
*/
|
|
1994
|
+
observeInSpan(evidence) {
|
|
1995
|
+
if (this.#geometry.trackKind === "audio") return [];
|
|
1996
|
+
const changes = [];
|
|
1997
|
+
const placement = this.#place(evidence);
|
|
1998
|
+
if (placement.rapNotMpuStart) this.#refuteMpuBounds(changes);
|
|
1999
|
+
const geometry2 = this.#geometry;
|
|
2000
|
+
if (this.#mode === "all-protected" || geometry2.mode !== "classifying") return changes;
|
|
2001
|
+
if (placement.rapNotMpuStart) changes.push(...this.#disable("rap-not-mpu-start"));
|
|
2002
|
+
else if (placement.position !== void 0 && placement.position >= geometry2.gopFrames) {
|
|
2003
|
+
changes.push(...this.#disable("mpu-longer-than-gop"));
|
|
2004
|
+
} else if (placement.violation !== void 0) changes.push(...this.#disable(placement.violation));
|
|
2005
|
+
return changes;
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
2008
|
+
* The DU header of a source packet that a decode rebuilt, in block `sbn`.
|
|
2009
|
+
* It bounds the blocks around that block for the MPU rule as a header that
|
|
2010
|
+
* arrived does: the rule reads the DU headers the receiver holds. The
|
|
2011
|
+
* rebuilt block is whole, so it gets no class and no record, and the
|
|
2012
|
+
* packet is no evidence for P1 or P3, which rest on what arrived: it
|
|
2013
|
+
* supports no class by the window rule, and can only end it. It is not
|
|
2014
|
+
* counted as a packet that arrived either (#arrivedBetween).
|
|
2015
|
+
*/
|
|
2016
|
+
observeRecovered(sbn, evidence) {
|
|
2017
|
+
if (this.#geometry.trackKind === "audio") return [];
|
|
2018
|
+
const { mpu, idx, movieFragment } = evidence;
|
|
2019
|
+
if (mpu === void 0 || idx === void 0 || movieFragment === void 0) return [];
|
|
2020
|
+
const changes = [];
|
|
2021
|
+
if (idx !== 0) {
|
|
2022
|
+
this.#multiSampleFragment = true;
|
|
2023
|
+
const geometry2 = this.#geometry;
|
|
2024
|
+
if (this.#fragmentPerFrame && geometry2.trackKind === "video" && geometry2.mode === "classifying") {
|
|
2025
|
+
changes.push(...this.#disable("mpu-multiple-fragments"));
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
if (this.#noteHeader(sbn, evidence, this.#positionHeld(mpu, idx, movieFragment), void 0, changes)) {
|
|
2029
|
+
this.#reclassifyOthers(sbn, changes);
|
|
1880
2030
|
}
|
|
1881
2031
|
return changes;
|
|
1882
2032
|
}
|
|
2033
|
+
/**
|
|
2034
|
+
* Decode times the receiver can determine: `first` and `last` are those of
|
|
2035
|
+
* the first and the last sample that one held movie fragment's metadata
|
|
2036
|
+
* (FT=1) times, of MPU `mpu`, in ticks of `mediaTimescale`; a `trun` lists
|
|
2037
|
+
* samples in decode order, so `first` is not after `last`. They are read
|
|
2038
|
+
* for one thing, and only on a track the MPU rule applies to: an MPU with
|
|
2039
|
+
* two samples a keyframe interval or more apart lasts longer than the
|
|
2040
|
+
* interval, so its first sample need not be its only RAP. The rule then
|
|
2041
|
+
* stops for the rest of the epoch, the window rule with it, and every delta
|
|
2042
|
+
* class goes (fec-multicast-01 Block Classification). No class comes from
|
|
2043
|
+
* a decode time. The MPU's first sample is never later than the earliest
|
|
2044
|
+
* one known, so the known span is no longer than the real one.
|
|
2045
|
+
*/
|
|
2046
|
+
noteDecodeTimes(mpu, first, last, mediaTimescale) {
|
|
2047
|
+
const changes = [];
|
|
2048
|
+
const geometry2 = this.#geometry;
|
|
2049
|
+
if (geometry2.trackKind !== "video" || this.#mpuRuleCatalog !== null || !isPositiveSafeInteger(mediaTimescale)) {
|
|
2050
|
+
return changes;
|
|
2051
|
+
}
|
|
2052
|
+
const held = this.#decodeSpans.get(mpu);
|
|
2053
|
+
const known = held?.mediaTimescale === mediaTimescale ? held : void 0;
|
|
2054
|
+
let late = false;
|
|
2055
|
+
if (held === void 0 && this.#decodeSpans.size >= 2) {
|
|
2056
|
+
const lowest = Math.min(...this.#decodeSpans.keys());
|
|
2057
|
+
late = mpu < lowest;
|
|
2058
|
+
if (!late) this.#decodeSpans.delete(lowest);
|
|
2059
|
+
}
|
|
2060
|
+
const min = known !== void 0 && known.min < first ? known.min : first;
|
|
2061
|
+
const max = known !== void 0 && known.max > last ? known.max : last;
|
|
2062
|
+
if (!late) this.#decodeSpans.set(mpu, { min, max, mediaTimescale });
|
|
2063
|
+
const { ticks, timescale } = geometry2.keyframeInterval;
|
|
2064
|
+
if ((max - min) * BigInt(timescale) >= BigInt(ticks) * BigInt(mediaTimescale)) {
|
|
2065
|
+
this.#mpuOutlastsInterval = true;
|
|
2066
|
+
this.#withdraw(changes);
|
|
2067
|
+
}
|
|
2068
|
+
return changes;
|
|
2069
|
+
}
|
|
2070
|
+
/** Ask again for every block held but `own`: a new DU header can bound any of them. */
|
|
2071
|
+
#reclassifyOthers(own, changes) {
|
|
2072
|
+
for (const [sbn, block] of this.#blocks) {
|
|
2073
|
+
if (sbn !== own) this.#reclassify(sbn, block, changes);
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
/**
|
|
2077
|
+
* Move delta blocks back to unknown: a premise their class stood on is
|
|
2078
|
+
* gone. After DU headers out of block order, what the window rule still
|
|
2079
|
+
* holds for is classed again as its blocks are seen.
|
|
2080
|
+
*/
|
|
2081
|
+
#withdraw(changes) {
|
|
2082
|
+
for (const [sbn, block] of this.#blocks) {
|
|
2083
|
+
if (block.cls !== "delta") continue;
|
|
2084
|
+
block.cls = "unknown";
|
|
2085
|
+
changes.push({ kind: "reclassified", sbn, from: "delta", to: "unknown", evidence: "classifier-disabled" });
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* An MPU boundary stopped bounding this stream's RAPs: neither rule proves
|
|
2090
|
+
* anything from now on, and every delta class goes.
|
|
2091
|
+
*/
|
|
2092
|
+
#refuteMpuBounds(changes) {
|
|
2093
|
+
if (!this.#mpuBoundsRaps) return;
|
|
2094
|
+
this.#mpuBoundsRaps = false;
|
|
2095
|
+
this.#withdraw(changes);
|
|
2096
|
+
}
|
|
2097
|
+
#reclassify(sbn, block, changes) {
|
|
2098
|
+
const next = this.#classify(block, sbn);
|
|
2099
|
+
if (next === block.cls || !this.#allowed(block.cls, next)) return;
|
|
2100
|
+
changes.push({
|
|
2101
|
+
kind: "reclassified",
|
|
2102
|
+
sbn,
|
|
2103
|
+
from: block.cls,
|
|
2104
|
+
to: next,
|
|
2105
|
+
evidence: this.#evidenceFor(block, next)
|
|
2106
|
+
});
|
|
2107
|
+
block.cls = next;
|
|
2108
|
+
}
|
|
1883
2109
|
/**
|
|
1884
2110
|
* Record a RAP frame released in order. Released MPU-start RAPs of MPUs m
|
|
1885
2111
|
* and m+n must be exactly n keyframe intervals apart in the media
|
|
@@ -1907,7 +2133,9 @@ var BlockClassifier = class {
|
|
|
1907
2133
|
if (presentationTime === previous.presentationTime) return [];
|
|
1908
2134
|
const interval2 = keyframeIntervalMediaTicks(this.#geometry, mediaTimescale);
|
|
1909
2135
|
if (interval2 === null || decodeTime === void 0 || previous.decodeTime === void 0 || (decodeTime - previous.decodeTime) % interval2 !== 0n) {
|
|
1910
|
-
|
|
2136
|
+
const changes = [];
|
|
2137
|
+
this.#refuteMpuBounds(changes);
|
|
2138
|
+
return changes;
|
|
1911
2139
|
}
|
|
1912
2140
|
return [];
|
|
1913
2141
|
}
|
|
@@ -2012,6 +2240,18 @@ var BlockClassifier = class {
|
|
|
2012
2240
|
...drift === void 0 || drift === 0 ? {} : { violation: "rap-spacing-mismatch" }
|
|
2013
2241
|
};
|
|
2014
2242
|
}
|
|
2243
|
+
/**
|
|
2244
|
+
* The MPU position #place gives a DU header, read from the layout the
|
|
2245
|
+
* arrived headers built and recording nothing: where a rebuilt header
|
|
2246
|
+
* stands for the catalog interval's check in the MPU rule.
|
|
2247
|
+
*/
|
|
2248
|
+
#positionHeld(mpu, idx, fragment) {
|
|
2249
|
+
if (!this.#fragmentPerFrame || this.#multiSampleFragment) return idx;
|
|
2250
|
+
const anchor = this.#mpus.get(mpu)?.anchor;
|
|
2251
|
+
if (anchor === void 0) return void 0;
|
|
2252
|
+
const offset = fragment - anchor | 0;
|
|
2253
|
+
return offset === 0 || offset > 0 && this.#fragmentsProven ? offset : void 0;
|
|
2254
|
+
}
|
|
2015
2255
|
/**
|
|
2016
2256
|
* How many fragments MPU m's anchor `fragment` lies past the start that
|
|
2017
2257
|
* the anchor received last predicts for MPU m: one frame per fragment and
|
|
@@ -2038,6 +2278,11 @@ var BlockClassifier = class {
|
|
|
2038
2278
|
this.#mpuSbnSpans.clear();
|
|
2039
2279
|
this.#dataUnitStarts.clear();
|
|
2040
2280
|
this.#highestMpu = null;
|
|
2281
|
+
this.#headers.clear();
|
|
2282
|
+
this.#arrived.clear();
|
|
2283
|
+
this.#heldHighestMpu = null;
|
|
2284
|
+
this.#headerOrderRefuted = false;
|
|
2285
|
+
this.#decodeSpans.clear();
|
|
2041
2286
|
}
|
|
2042
2287
|
/**
|
|
2043
2288
|
* P1 check for one source packet of MPU `mpu` in block `sbn`, then record
|
|
@@ -2128,18 +2373,218 @@ var BlockClassifier = class {
|
|
|
2128
2373
|
}
|
|
2129
2374
|
return changes;
|
|
2130
2375
|
}
|
|
2131
|
-
#classify(block) {
|
|
2376
|
+
#classify(block, sbn) {
|
|
2132
2377
|
if (block.rapSeen || block.mpus.size >= 2) return "keyframe";
|
|
2133
|
-
if (
|
|
2378
|
+
if (block.cls === "delta") return "delta";
|
|
2379
|
+
if (this.#windowHolds(block) || this.#mpuRuleHolds(block, sbn)) return "delta";
|
|
2380
|
+
return "unknown";
|
|
2381
|
+
}
|
|
2382
|
+
#windowHolds(block) {
|
|
2383
|
+
const off = this.mpuRuleOff;
|
|
2384
|
+
if (this.#mode === "all-protected" || off !== null && off !== "du-headers-out-of-order") return false;
|
|
2134
2385
|
const geometry2 = this.#geometry;
|
|
2135
|
-
if (geometry2.trackKind !== "video" || geometry2.mode !== "classifying") return
|
|
2136
|
-
if (block.mpus.size
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2386
|
+
if (geometry2.trackKind !== "video" || geometry2.mode !== "classifying") return false;
|
|
2387
|
+
if (block.mpus.size !== 1 || block.positionMin === void 0 || block.positionMax === void 0) {
|
|
2388
|
+
return false;
|
|
2389
|
+
}
|
|
2390
|
+
const span = geometry2.interleaveUnits - 1;
|
|
2391
|
+
return block.positionMax - span >= 1 && block.positionMin + span <= geometry2.gopFrames - 1;
|
|
2392
|
+
}
|
|
2393
|
+
/**
|
|
2394
|
+
* Keep the header and arrival ledgers to the two newest MPUs. False for an
|
|
2395
|
+
* MPU behind them, which is not kept: no block still asked lies there, and
|
|
2396
|
+
* the ledgers stay bounded when MPU numbers go back with no source
|
|
2397
|
+
* discontinuity (a restart nothing signalled, or the 2^32 wrap). The rule
|
|
2398
|
+
* is then silent until the next one.
|
|
2399
|
+
*/
|
|
2400
|
+
#noteHeldMpu(mpu) {
|
|
2401
|
+
const highest = this.#heldHighestMpu;
|
|
2402
|
+
if (highest !== null && mpu <= highest) return mpu + 1 >= highest;
|
|
2403
|
+
this.#heldHighestMpu = mpu;
|
|
2404
|
+
for (const held of [this.#headers, this.#arrived]) {
|
|
2405
|
+
for (const other of [...held.keys()]) {
|
|
2406
|
+
if (other + 1 < mpu) held.delete(other);
|
|
2140
2407
|
}
|
|
2141
2408
|
}
|
|
2142
|
-
return
|
|
2409
|
+
return true;
|
|
2410
|
+
}
|
|
2411
|
+
/** Record a source packet that arrived as source symbol `ssId`, for #arrivedBetween. */
|
|
2412
|
+
#noteArrived(sbn, mpu, ssId) {
|
|
2413
|
+
if (mpu === void 0 || ssId === void 0 || !this.#noteHeldMpu(mpu)) return;
|
|
2414
|
+
const arrived = this.#arrived.get(mpu);
|
|
2415
|
+
if (arrived === void 0) this.#arrived.set(mpu, { start: /* @__PURE__ */ new Map([[ssId, sbn]]), last: ssId });
|
|
2416
|
+
else {
|
|
2417
|
+
if (arrived.start.size < ARRIVED_START_MAX) arrived.start.set(ssId, sbn);
|
|
2418
|
+
if (ssId > arrived.last) arrived.last = ssId;
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
/**
|
|
2422
|
+
* Record a held DU header for the MPU rule; `ssId` is its source symbol id
|
|
2423
|
+
* when it arrived, undefined for one that FEC rebuilt. True when it is new
|
|
2424
|
+
* and in order: the blocks held are then asked again. Blocks follow
|
|
2425
|
+
* authored order (P1), so the first header that lies against it withdraws
|
|
2426
|
+
* every class, and the rule proves nothing for the rest of the sequence.
|
|
2427
|
+
*/
|
|
2428
|
+
#noteHeader(sbn, evidence, position, ssId, changes) {
|
|
2429
|
+
const { mpu, idx, movieFragment } = evidence;
|
|
2430
|
+
if (this.#geometry.trackKind !== "video" || mpu === void 0 || idx === void 0 || movieFragment === void 0) {
|
|
2431
|
+
return false;
|
|
2432
|
+
}
|
|
2433
|
+
if (!this.#noteHeldMpu(mpu)) {
|
|
2434
|
+
if (evidence.rap && idx !== 0 && !this.#rapInsideMpu) {
|
|
2435
|
+
this.#rapInsideMpu = true;
|
|
2436
|
+
this.#withdraw(changes);
|
|
2437
|
+
}
|
|
2438
|
+
return false;
|
|
2439
|
+
}
|
|
2440
|
+
const header = {
|
|
2441
|
+
movieFragment,
|
|
2442
|
+
idx,
|
|
2443
|
+
offset: evidence.offset ?? 0,
|
|
2444
|
+
sbn,
|
|
2445
|
+
rap: evidence.rap,
|
|
2446
|
+
...ssId === void 0 ? {} : { ssId },
|
|
2447
|
+
...position === void 0 ? {} : { position }
|
|
2448
|
+
};
|
|
2449
|
+
let headers = this.#headers.get(mpu);
|
|
2450
|
+
if (headers === void 0) {
|
|
2451
|
+
headers = [];
|
|
2452
|
+
this.#headers.set(mpu, headers);
|
|
2453
|
+
}
|
|
2454
|
+
let at = 0;
|
|
2455
|
+
let end = headers.length;
|
|
2456
|
+
while (at < end) {
|
|
2457
|
+
const mid = at + end >>> 1;
|
|
2458
|
+
if (compareDataUnitStarts(headers[mid], header) < 0) at = mid + 1;
|
|
2459
|
+
else end = mid;
|
|
2460
|
+
}
|
|
2461
|
+
if (at < headers.length && compareDataUnitStarts(headers[at], header) === 0) return false;
|
|
2462
|
+
headers.splice(at, 0, header);
|
|
2463
|
+
const first = headers[0];
|
|
2464
|
+
if (!this.#rapInsideMpu && (header.rap && header.idx !== 0 || (at === 0 ? headers : [header]).some((held) => held.rap && held.movieFragment !== first.movieFragment))) {
|
|
2465
|
+
this.#rapInsideMpu = true;
|
|
2466
|
+
this.#withdraw(changes);
|
|
2467
|
+
}
|
|
2468
|
+
const before = headers[at - 1]?.sbn;
|
|
2469
|
+
const after = headers[at + 1]?.sbn;
|
|
2470
|
+
if (before !== void 0 && before > sbn || after !== void 0 && after < sbn) {
|
|
2471
|
+
if (!this.#headerOrderRefuted) {
|
|
2472
|
+
this.#headerOrderRefuted = true;
|
|
2473
|
+
this.#withdraw(changes);
|
|
2474
|
+
}
|
|
2475
|
+
return false;
|
|
2476
|
+
}
|
|
2477
|
+
return true;
|
|
2478
|
+
}
|
|
2479
|
+
/**
|
|
2480
|
+
* The MPU rule. L is the DU header held last before the block and U the
|
|
2481
|
+
* one held first after it. Every packet carries its MPU number, and an MPU
|
|
2482
|
+
* holds one RAP: its first sample.
|
|
2483
|
+
*
|
|
2484
|
+
* - R1, L and U in one MPU: the block holds no part of a RAP, provided the
|
|
2485
|
+
* MPU's first sample ended before the block (#firstSampleEndedBefore).
|
|
2486
|
+
* - R2, U in the next MPU: the block may hold the start of that MPU,
|
|
2487
|
+
* unless that start arrived whole (#startArrivedWhole). The block is
|
|
2488
|
+
* then the tail of L's MPU, and R1's proviso decides.
|
|
2489
|
+
* - R3, more than one MPU apart: a whole MPU is gone, its RAP with it.
|
|
2490
|
+
* - R4, no U held yet (or no L): not known. The next DU header asks again.
|
|
2491
|
+
*
|
|
2492
|
+
* It rests on the publisher keeping one RAP to an MPU, which no packet
|
|
2493
|
+
* says. So it classes nothing unless the catalog states a keyframe interval
|
|
2494
|
+
* equal to the group duration, and nothing once the stream showed
|
|
2495
|
+
* otherwise: a RAP inside an MPU (mpuBoundsRaps, or a RAP-flagged DU header
|
|
2496
|
+
* held that is not of its MPU's first sample: #noteHeader), an MPU longer than the
|
|
2497
|
+
* keyframe interval by the decode times known (noteDecodeTimes), or DU
|
|
2498
|
+
* headers against the block order. `mpuRuleOff` names which. `dep_counter`
|
|
2499
|
+
* is not read.
|
|
2500
|
+
*/
|
|
2501
|
+
#mpuRuleHolds(block, sbn) {
|
|
2502
|
+
if (this.mpuRuleOff !== null) return false;
|
|
2503
|
+
let lower;
|
|
2504
|
+
let upper;
|
|
2505
|
+
let lowerMpu = 0;
|
|
2506
|
+
let upperMpu = 0;
|
|
2507
|
+
let lowerAt = 0;
|
|
2508
|
+
let upperAt = 0;
|
|
2509
|
+
for (const [mpu, headers] of this.#headers) {
|
|
2510
|
+
const before = firstStartAtOrAfter(headers, sbn) - 1;
|
|
2511
|
+
const after = firstStartAtOrAfter(headers, sbn + 1);
|
|
2512
|
+
const below = headers[before];
|
|
2513
|
+
const above = headers[after];
|
|
2514
|
+
if (below !== void 0 && (lower === void 0 || below.sbn > lower.sbn || below.sbn === lower.sbn && mpu > lowerMpu)) {
|
|
2515
|
+
lower = below;
|
|
2516
|
+
lowerMpu = mpu;
|
|
2517
|
+
lowerAt = before;
|
|
2518
|
+
}
|
|
2519
|
+
if (above !== void 0 && (upper === void 0 || above.sbn < upper.sbn || above.sbn === upper.sbn && mpu < upperMpu)) {
|
|
2520
|
+
upper = above;
|
|
2521
|
+
upperMpu = mpu;
|
|
2522
|
+
upperAt = after;
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
if (lower === void 0 || upper === void 0) return false;
|
|
2526
|
+
if (block.mpus.size === 1 && !block.mpus.has(lowerMpu)) return false;
|
|
2527
|
+
if (upperMpu === lowerMpu) {
|
|
2528
|
+
if (upper.rap) return false;
|
|
2529
|
+
const geometry2 = this.#geometry;
|
|
2530
|
+
if (geometry2.trackKind === "video" && geometry2.mode === "classifying" && lower.position !== void 0 && upper.position !== void 0 && Math.floor(upper.position / geometry2.gopFrames) > Math.floor(lower.position / geometry2.gopFrames)) {
|
|
2531
|
+
return false;
|
|
2532
|
+
}
|
|
2533
|
+
} else if (upperMpu !== lowerMpu + 1 || !this.#startArrivedWhole(upperMpu, upperAt)) {
|
|
2534
|
+
return false;
|
|
2535
|
+
}
|
|
2536
|
+
return this.#firstSampleEndedBefore(sbn, lowerMpu, lowerAt);
|
|
2537
|
+
}
|
|
2538
|
+
/**
|
|
2539
|
+
* R1's proviso for block `sbn`, where header `at` of MPU `mpu` is the one
|
|
2540
|
+
* held last before it: no part of the MPU's first sample lies in the
|
|
2541
|
+
* block. A sample start without RAP_flag is not the first sample. Any
|
|
2542
|
+
* other header may be of it (a later data unit of a sample need not repeat
|
|
2543
|
+
* the flag). That sample ended before the block only if every packet from
|
|
2544
|
+
* the header to the next sample's DU header arrived, in earlier blocks.
|
|
2545
|
+
*/
|
|
2546
|
+
#firstSampleEndedBefore(sbn, mpu, at) {
|
|
2547
|
+
const headers = this.#headers.get(mpu);
|
|
2548
|
+
const lower = headers[at];
|
|
2549
|
+
if (lower.offset === 0 && !lower.rap) return true;
|
|
2550
|
+
const next = nextSampleHeader(headers, at);
|
|
2551
|
+
return next !== void 0 && this.#arrivedBetween(mpu, lower, next, sbn);
|
|
2552
|
+
}
|
|
2553
|
+
/**
|
|
2554
|
+
* R2's exception: the start of MPU `mpu` arrived whole. Its header `at`,
|
|
2555
|
+
* the DU header held first after the block, is of the MPU's RAP. Every
|
|
2556
|
+
* packet before it arrived, back to the last packet of the MPU before: so
|
|
2557
|
+
* did the MPU and movie fragment metadata sent before the sample. And
|
|
2558
|
+
* every packet after it arrived, up to the next sample's DU header.
|
|
2559
|
+
*/
|
|
2560
|
+
#startArrivedWhole(mpu, at) {
|
|
2561
|
+
const headers = this.#headers.get(mpu);
|
|
2562
|
+
const first = headers[at];
|
|
2563
|
+
const arrived = this.#arrived.get(mpu);
|
|
2564
|
+
const previous = this.#arrived.get(mpu - 1);
|
|
2565
|
+
if (!first.rap || first.ssId === void 0 || arrived === void 0 || previous === void 0) return false;
|
|
2566
|
+
let ssId = first.ssId - 1;
|
|
2567
|
+
while (arrived.start.has(ssId)) ssId--;
|
|
2568
|
+
if (ssId !== previous.last) return false;
|
|
2569
|
+
const next = nextSampleHeader(headers, at);
|
|
2570
|
+
return next !== void 0 && this.#arrivedBetween(mpu, first, next);
|
|
2571
|
+
}
|
|
2572
|
+
/**
|
|
2573
|
+
* Whether every packet sent after DU header `from` and before DU header
|
|
2574
|
+
* `to`, both of MPU `mpu`, arrived as a packet of that MPU, each in a block
|
|
2575
|
+
* before `before` when one is given. The source symbol id counts every
|
|
2576
|
+
* packet of the FEC flow, so no id may be missing between the two. Ids are
|
|
2577
|
+
* read as plain numbers, as block starts are: past the 2^32 wrap of the id
|
|
2578
|
+
* nothing is proved.
|
|
2579
|
+
*/
|
|
2580
|
+
#arrivedBetween(mpu, from, to, before) {
|
|
2581
|
+
const arrived = this.#arrived.get(mpu);
|
|
2582
|
+
if (arrived === void 0 || from.ssId === void 0 || to.ssId === void 0) return false;
|
|
2583
|
+
for (let ssId = from.ssId + 1; ssId !== to.ssId; ssId++) {
|
|
2584
|
+
const sbn = arrived.start.get(ssId);
|
|
2585
|
+
if (sbn === void 0 || before !== void 0 && sbn >= before) return false;
|
|
2586
|
+
}
|
|
2587
|
+
return true;
|
|
2143
2588
|
}
|
|
2144
2589
|
#allowed(from, to) {
|
|
2145
2590
|
if (from === "keyframe") return false;
|
|
@@ -2148,7 +2593,7 @@ var BlockClassifier = class {
|
|
|
2148
2593
|
return false;
|
|
2149
2594
|
}
|
|
2150
2595
|
#evidenceFor(block, to) {
|
|
2151
|
-
if (to === "delta") return "window";
|
|
2596
|
+
if (to === "delta") return this.#windowHolds(block) ? "window" : "mpu-rule";
|
|
2152
2597
|
return block.rapSeen ? "rap" : "mpu-span";
|
|
2153
2598
|
}
|
|
2154
2599
|
};
|
|
@@ -3359,6 +3804,33 @@ var FECManager = class _FECManager {
|
|
|
3359
3804
|
}
|
|
3360
3805
|
}
|
|
3361
3806
|
}
|
|
3807
|
+
/**
|
|
3808
|
+
* The DU header of a source packet that a decode rebuilt in block `sbn`.
|
|
3809
|
+
* It can class the blocks around that block (the MPU rule reads the DU
|
|
3810
|
+
* headers the receiver holds); the rebuilt block itself is resolved.
|
|
3811
|
+
*/
|
|
3812
|
+
noteRecoveredSource(sbn, packetId, catalogTrackName, evidence) {
|
|
3813
|
+
const trackConfig = this.#trackConfigs.get(packetId);
|
|
3814
|
+
if (trackConfig === void 0 || !_FECManager.#hasCatalogTiming(trackConfig)) return;
|
|
3815
|
+
this.#applyClassifierChanges(
|
|
3816
|
+
packetId,
|
|
3817
|
+
catalogTrackName,
|
|
3818
|
+
this.#classifierFor(packetId, catalogTrackName).observeRecovered(sbn, evidence)
|
|
3819
|
+
);
|
|
3820
|
+
}
|
|
3821
|
+
/**
|
|
3822
|
+
* Tell the classifier of a block no source symbol of which is held, so the
|
|
3823
|
+
* DU headers around it can class it (the MPU rule reads the headers held
|
|
3824
|
+
* before and after a block's missing symbols; here every one is missing).
|
|
3825
|
+
* A block the classifier has no record of is never classed.
|
|
3826
|
+
*/
|
|
3827
|
+
#registerSourcelessBlock(sbn, packetId, catalogTrackName) {
|
|
3828
|
+
this.#applyClassifierChanges(
|
|
3829
|
+
packetId,
|
|
3830
|
+
catalogTrackName,
|
|
3831
|
+
this.#classifierFor(packetId, catalogTrackName).touch(sbn)
|
|
3832
|
+
);
|
|
3833
|
+
}
|
|
3362
3834
|
/**
|
|
3363
3835
|
* Freeze a block's class at resolution and drop its classifier state. The
|
|
3364
3836
|
* frozen class answers every later query (a recovery counted after the
|
|
@@ -3526,7 +3998,7 @@ var FECManager = class _FECManager {
|
|
|
3526
3998
|
if (this.#blockResolutionFor(key) !== "untracked") return;
|
|
3527
3999
|
this.#materializedBlocks.add(key);
|
|
3528
4000
|
if (this.#hasCatalogTimingForPacket(packetId)) {
|
|
3529
|
-
this.#
|
|
4001
|
+
this.#registerSourcelessBlock(sbn, packetId, catalogTrackName);
|
|
3530
4002
|
}
|
|
3531
4003
|
this.onBlockVanished?.(sbn, packetId, catalogTrackName);
|
|
3532
4004
|
if (repairable) {
|
|
@@ -5121,6 +5593,16 @@ var FECManager = class _FECManager {
|
|
|
5121
5593
|
const classifier = this.#classifierFor(packetId, catalogTrackName);
|
|
5122
5594
|
return { mode: classifier.mode, reason: classifier.reason };
|
|
5123
5595
|
}
|
|
5596
|
+
/**
|
|
5597
|
+
* Why the MPU rule classes no block on a video stream now
|
|
5598
|
+
* (`BlockClassifier.mpuRuleOff`): what its catalog does not state, or what
|
|
5599
|
+
* the stream showed. Null while the rule can class a block. Undefined for a
|
|
5600
|
+
* stream with no classifier: one not heard yet, or without catalog timing.
|
|
5601
|
+
*/
|
|
5602
|
+
mpuRuleOffFor(packetId, catalogTrackName) {
|
|
5603
|
+
const classifier = this.#classifiers.get(this.#streamKey(packetId, catalogTrackName));
|
|
5604
|
+
return classifier?.geometry.trackKind === "video" ? classifier.mpuRuleOff : void 0;
|
|
5605
|
+
}
|
|
5124
5606
|
/**
|
|
5125
5607
|
* Whether an MPU boundary still bounds this stream's RAPs (see
|
|
5126
5608
|
* `BlockClassifier.mpuBoundsRaps`). Gap decisions drop MPU evidence once
|
|
@@ -5198,6 +5680,20 @@ var FECManager = class _FECManager {
|
|
|
5198
5680
|
)
|
|
5199
5681
|
);
|
|
5200
5682
|
}
|
|
5683
|
+
/**
|
|
5684
|
+
* Decode times of the first and last sample that one held movie fragment's
|
|
5685
|
+
* metadata times, in MPU `mpu`. On a video stream the classifier looks
|
|
5686
|
+
* among them for an MPU longer than the catalog keyframe interval, where
|
|
5687
|
+
* the MPU rule stops (`BlockClassifier.noteDecodeTimes`).
|
|
5688
|
+
*/
|
|
5689
|
+
noteSampleDecodeTimes(packetId, catalogTrackName, mpu, first, last, mediaTimescale) {
|
|
5690
|
+
if (!this.#hasCatalogTimingForPacket(packetId)) return;
|
|
5691
|
+
this.#applyClassifierChanges(
|
|
5692
|
+
packetId,
|
|
5693
|
+
catalogTrackName,
|
|
5694
|
+
this.#classifierFor(packetId, catalogTrackName).noteDecodeTimes(mpu, first, last, mediaTimescale)
|
|
5695
|
+
);
|
|
5696
|
+
}
|
|
5201
5697
|
// -----------------------------------------------------------------------
|
|
5202
5698
|
// Configuration
|
|
5203
5699
|
// -----------------------------------------------------------------------
|
|
@@ -5869,6 +6365,9 @@ var FECManager = class _FECManager {
|
|
|
5869
6365
|
if (!repairIds) {
|
|
5870
6366
|
repairIds = /* @__PURE__ */ new Set();
|
|
5871
6367
|
this.#blockRepairRsIds.set(blockKey, repairIds);
|
|
6368
|
+
if (!this.#blockSourceCounts.has(blockKey) && this.#hasCatalogTimingForPacket(packetId)) {
|
|
6369
|
+
this.#registerSourcelessBlock(sbn, packetId, catalogTrackName);
|
|
6370
|
+
}
|
|
5872
6371
|
}
|
|
5873
6372
|
repairIds.add(rsId);
|
|
5874
6373
|
if (this.#repairRequestedBlocks.has(blockKey)) {
|
|
@@ -6098,12 +6597,13 @@ var FECManager = class _FECManager {
|
|
|
6098
6597
|
* classification evidence, and marks the block clean when all of its
|
|
6099
6598
|
* authored source symbols arrived: the SSB_length a repair symbol declared,
|
|
6100
6599
|
* otherwise K. `held` marks a source held unplaced since it arrived and
|
|
6101
|
-
* placed only now (see #noteSbnSeen)
|
|
6600
|
+
* placed only now (see #noteSbnSeen); `inSpan` one placed in a repair-less
|
|
6601
|
+
* span, which the classifier reads as no block (BLO-57323).
|
|
6102
6602
|
*
|
|
6103
6603
|
* Throws for a packetId that was never configured, so a classified block
|
|
6104
6604
|
* never reads the manager-global K or timeout.
|
|
6105
6605
|
*/
|
|
6106
|
-
trackBlock(sbn, packetId, catalogTrackName, esi, evidence, held = false) {
|
|
6606
|
+
trackBlock(sbn, packetId, catalogTrackName, esi, evidence, held = false, inSpan = false) {
|
|
6107
6607
|
const trackConfig = this.#trackConfigs.get(packetId);
|
|
6108
6608
|
if (trackConfig === void 0) {
|
|
6109
6609
|
throw new Error(
|
|
@@ -6113,15 +6613,8 @@ var FECManager = class _FECManager {
|
|
|
6113
6613
|
const key = this.#blockKey(sbn, packetId, catalogTrackName);
|
|
6114
6614
|
const k = trackConfig.k;
|
|
6115
6615
|
if (this.#completedBlocks.has(key)) return;
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
packetId,
|
|
6119
|
-
catalogTrackName,
|
|
6120
|
-
"source",
|
|
6121
|
-
evidence.packetSequenceNumber,
|
|
6122
|
-
Number.isInteger(esi) ? sbn + esi >>> 0 : sbn,
|
|
6123
|
-
held
|
|
6124
|
-
);
|
|
6616
|
+
const ssId = Number.isInteger(esi) ? sbn + esi >>> 0 : void 0;
|
|
6617
|
+
this.#noteSbnSeen(sbn, packetId, catalogTrackName, "source", evidence.packetSequenceNumber, ssId, held);
|
|
6125
6618
|
const authoredLength = this.#blockAuthoredLengths.get(key) ?? k;
|
|
6126
6619
|
if (Number.isInteger(esi) && esi >= authoredLength) {
|
|
6127
6620
|
this.#failBlock(sbn, packetId, catalogTrackName);
|
|
@@ -6131,7 +6624,7 @@ var FECManager = class _FECManager {
|
|
|
6131
6624
|
this.#applyClassifierChanges(
|
|
6132
6625
|
packetId,
|
|
6133
6626
|
catalogTrackName,
|
|
6134
|
-
this.#classifierFor(packetId, catalogTrackName).observe(sbn, evidence)
|
|
6627
|
+
inSpan ? this.#classifierFor(packetId, catalogTrackName).observeInSpan(evidence) : this.#classifierFor(packetId, catalogTrackName).observe(sbn, evidence, ssId)
|
|
6135
6628
|
);
|
|
6136
6629
|
}
|
|
6137
6630
|
const count = (this.#blockSourceCounts.get(key) ?? 0) + 1;
|
|
@@ -7713,12 +8206,16 @@ var transportManager = new TransportManager();
|
|
|
7713
8206
|
var REGISTRY = /* @__PURE__ */ Symbol.for("@blockcast/mmt-transport/native-provider-registry/v1");
|
|
7714
8207
|
var USER_AGENT_VERIFIED = /* @__PURE__ */ Symbol.for("@blockcast/mmt-transport/user-agent-verified/v1");
|
|
7715
8208
|
var INTEGRITY_SCHEME = "manifest-ed25519-2";
|
|
8209
|
+
var RECEIVER_OPEN_TIMEOUT_MS = 1e4;
|
|
7716
8210
|
var MulticastError = class extends Error {
|
|
7717
8211
|
code;
|
|
7718
|
-
|
|
8212
|
+
failure;
|
|
8213
|
+
constructor(code, message, cause, failure) {
|
|
7719
8214
|
super(message, cause === void 0 ? void 0 : { cause });
|
|
7720
8215
|
this.name = "MulticastError";
|
|
7721
8216
|
this.code = code;
|
|
8217
|
+
if (failure !== void 0)
|
|
8218
|
+
this.failure = failure;
|
|
7722
8219
|
}
|
|
7723
8220
|
};
|
|
7724
8221
|
function datagramsOf(chunk) {
|
|
@@ -7812,20 +8309,37 @@ function createProvider(scope) {
|
|
|
7812
8309
|
} catch (error) {
|
|
7813
8310
|
throw unsupported("MulticastReceiver refused the request", error);
|
|
7814
8311
|
}
|
|
7815
|
-
const opened = rx
|
|
8312
|
+
const opened = boundedOpen(rx);
|
|
7816
8313
|
if (gate === null)
|
|
7817
8314
|
gate = opened.then(() => void 0, () => void 0);
|
|
7818
8315
|
return openSubscription(rx, opened, options, c.packetIds);
|
|
7819
8316
|
}
|
|
7820
8317
|
};
|
|
7821
8318
|
}
|
|
8319
|
+
function boundedOpen(rx) {
|
|
8320
|
+
return new Promise((resolve, reject) => {
|
|
8321
|
+
const timer = setTimeout(() => {
|
|
8322
|
+
reject(new MulticastError("subscription-failed", "MulticastReceiver did not open in time", void 0, "open-timeout"));
|
|
8323
|
+
void Promise.resolve().then(() => rx.close()).catch(() => void 0);
|
|
8324
|
+
}, RECEIVER_OPEN_TIMEOUT_MS);
|
|
8325
|
+
rx.opened.then((info) => {
|
|
8326
|
+
clearTimeout(timer);
|
|
8327
|
+
resolve(info);
|
|
8328
|
+
}, (error) => {
|
|
8329
|
+
clearTimeout(timer);
|
|
8330
|
+
reject(new MulticastError("subscription-failed", "MulticastReceiver did not open", error, "open-rejected"));
|
|
8331
|
+
});
|
|
8332
|
+
rx.closed.then((value) => {
|
|
8333
|
+
clearTimeout(timer);
|
|
8334
|
+
reject(new MulticastError("subscription-failed", "MulticastReceiver closed before opening", reasonOf(value), "closed-before-data"));
|
|
8335
|
+
}, (error) => {
|
|
8336
|
+
clearTimeout(timer);
|
|
8337
|
+
reject(new MulticastError("subscription-failed", "MulticastReceiver closed before opening", error, "closed-before-data"));
|
|
8338
|
+
});
|
|
8339
|
+
});
|
|
8340
|
+
}
|
|
7822
8341
|
async function openSubscription(rx, openedPromise, options, packetIds) {
|
|
7823
|
-
|
|
7824
|
-
try {
|
|
7825
|
-
opened = await openedPromise;
|
|
7826
|
-
} catch (error) {
|
|
7827
|
-
throw new MulticastError("subscription-failed", "MulticastReceiver did not open", error);
|
|
7828
|
-
}
|
|
8342
|
+
const opened = await openedPromise;
|
|
7829
8343
|
if (opened.integrityScheme !== INTEGRITY_SCHEME) {
|
|
7830
8344
|
await rx.close();
|
|
7831
8345
|
throw unsupported(`integrity scheme ${String(opened.integrityScheme)} is not ${INTEGRITY_SCHEME}`);
|
|
@@ -7834,6 +8348,7 @@ async function openSubscription(rx, openedPromise, options, packetIds) {
|
|
|
7834
8348
|
let state = "connected";
|
|
7835
8349
|
let filter = packetIds?.length ? new Set(packetIds) : null;
|
|
7836
8350
|
let closing = false;
|
|
8351
|
+
let delivered = false;
|
|
7837
8352
|
const setState = (next) => {
|
|
7838
8353
|
if (state === next)
|
|
7839
8354
|
return;
|
|
@@ -7868,6 +8383,7 @@ async function openSubscription(rx, openedPromise, options, packetIds) {
|
|
|
7868
8383
|
break;
|
|
7869
8384
|
const packets = [];
|
|
7870
8385
|
for (const data of datagramsOf(value)) {
|
|
8386
|
+
delivered = true;
|
|
7871
8387
|
if (filter !== null) {
|
|
7872
8388
|
const id = readMMTPPacketId2(data);
|
|
7873
8389
|
if (id === null || !filter.has(id))
|
|
@@ -7883,26 +8399,25 @@ async function openSubscription(rx, openedPromise, options, packetIds) {
|
|
|
7883
8399
|
} catch {
|
|
7884
8400
|
}
|
|
7885
8401
|
})();
|
|
8402
|
+
const fail = (code, message, cause) => {
|
|
8403
|
+
events.dispatchEvent(new CustomEvent("error", {
|
|
8404
|
+
detail: new MulticastError(code, message, cause, delivered ? void 0 : "closed-before-data")
|
|
8405
|
+
}));
|
|
8406
|
+
};
|
|
7886
8407
|
void rx.closed.then((value) => {
|
|
7887
8408
|
const reason = reasonOf(value);
|
|
7888
8409
|
if (!closing) {
|
|
7889
|
-
if (reason === "consent-withdrawn")
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
})
|
|
7893
|
-
} else if (
|
|
7894
|
-
|
|
7895
|
-
detail: new MulticastError("subscription-failed", `MulticastReceiver closed: ${reason}`)
|
|
7896
|
-
}));
|
|
7897
|
-
}
|
|
8410
|
+
if (reason === "consent-withdrawn")
|
|
8411
|
+
fail("origin-not-trusted", "multicast consent withdrawn");
|
|
8412
|
+
else if (reason === "oversubscribed" || reason === "network") {
|
|
8413
|
+
fail("subscription-failed", `MulticastReceiver closed: ${reason}`);
|
|
8414
|
+
} else if (!delivered)
|
|
8415
|
+
fail("subscription-failed", "MulticastReceiver closed before any datagram", reason);
|
|
7898
8416
|
}
|
|
7899
8417
|
setState("closed");
|
|
7900
8418
|
}, (error) => {
|
|
7901
|
-
if (!closing)
|
|
7902
|
-
|
|
7903
|
-
detail: new MulticastError("subscription-failed", "MulticastReceiver failed", error)
|
|
7904
|
-
}));
|
|
7905
|
-
}
|
|
8419
|
+
if (!closing)
|
|
8420
|
+
fail("subscription-failed", "MulticastReceiver failed", error);
|
|
7906
8421
|
setState("closed");
|
|
7907
8422
|
});
|
|
7908
8423
|
return subscription;
|
|
@@ -8373,7 +8888,8 @@ var MFUReassembler = class {
|
|
|
8373
8888
|
sampleOffset: fragment.sampleOffset,
|
|
8374
8889
|
source: fragment.source,
|
|
8375
8890
|
deliveryProvenance: deliveryProvenanceOf([fragment]),
|
|
8376
|
-
catalogTrackName: fragment.catalogTrackName
|
|
8891
|
+
catalogTrackName: fragment.catalogTrackName,
|
|
8892
|
+
itemId: fragment.itemId
|
|
8377
8893
|
};
|
|
8378
8894
|
}
|
|
8379
8895
|
const sequence = fragment.packetSequenceNumber;
|
|
@@ -8749,7 +9265,8 @@ var MFUReassembler = class {
|
|
|
8749
9265
|
sampleOffset: fragments[0].sampleOffset,
|
|
8750
9266
|
source: fragments[0].source,
|
|
8751
9267
|
deliveryProvenance: deliveryProvenanceOf(fragments),
|
|
8752
|
-
catalogTrackName: fragments[0].catalogTrackName
|
|
9268
|
+
catalogTrackName: fragments[0].catalogTrackName,
|
|
9269
|
+
itemId: fragments[0].itemId
|
|
8753
9270
|
};
|
|
8754
9271
|
}
|
|
8755
9272
|
#setTimeout(bufferKey, startedAt = Date.now()) {
|
|
@@ -11729,6 +12246,19 @@ if (void 0) {
|
|
|
11729
12246
|
const vclOnly = lp(idr);
|
|
11730
12247
|
expect(hevcVclOnly(vclOnly)).toBe(vclOnly);
|
|
11731
12248
|
});
|
|
12249
|
+
test("a first NAL of 256 to 511 bytes is length-prefixed, not an Annex-B start code", () => {
|
|
12250
|
+
for (const nalLength of [255, 256, 511, 512]) {
|
|
12251
|
+
const sei = new Uint8Array(nalLength).fill(255);
|
|
12252
|
+
sei.set([39 << 1, 1]);
|
|
12253
|
+
const keyframe = lp(sei, vps, sps, pps, idr);
|
|
12254
|
+
expect(extractHevcParameterSets(keyframe), `${nalLength}`).toEqual({ vps, sps, pps });
|
|
12255
|
+
expect(hevcVclOnly(keyframe), `${nalLength}`).toEqual(lp(idr));
|
|
12256
|
+
const slice = new Uint8Array(nalLength).fill(255);
|
|
12257
|
+
slice.set([1 << 1, 1]);
|
|
12258
|
+
const vclOnly = lp(slice);
|
|
12259
|
+
expect(hevcVclOnly(vclOnly), `${nalLength}`).toBe(vclOnly);
|
|
12260
|
+
}
|
|
12261
|
+
});
|
|
11732
12262
|
});
|
|
11733
12263
|
});
|
|
11734
12264
|
}
|
|
@@ -12194,6 +12724,10 @@ function buildAudioInitSegment(sampleRate, channels, asc, timescale, trackId = 1
|
|
|
12194
12724
|
return result;
|
|
12195
12725
|
}
|
|
12196
12726
|
|
|
12727
|
+
// src/feed-gate.ts
|
|
12728
|
+
var NOTHING_STATED = Object.freeze({ map: false, distance: 0, mayBeNeeded: true });
|
|
12729
|
+
var MAP_KEYFRAME = Object.freeze({ map: true, distance: 0, mayBeNeeded: true });
|
|
12730
|
+
|
|
12197
12731
|
// src/conceal-timeline.ts
|
|
12198
12732
|
var AudioGapConcealer = class {
|
|
12199
12733
|
#last = null;
|
|
@@ -12479,7 +13013,7 @@ var CmafBlockAssembler = class {
|
|
|
12479
13013
|
if (reference < 0) return timestamp;
|
|
12480
13014
|
return timestamp + Math.round((reference - timestamp) / wrapPeriod) * wrapPeriod;
|
|
12481
13015
|
}
|
|
12482
|
-
#emitSample(data, timestamp, duration, keyframe, advancesHorizon, catalogTrackName, mpuSequenceNumber, packetSequenceNumber, packetSequenceNumbers, repairedPacketSequenceNumbers, authoredTiming, deliveryProvenance, mmtpTimestamp, movieFragmentSequenceNumber, sampleNumber, synthetic, gapBefore) {
|
|
13016
|
+
#emitSample(data, timestamp, duration, keyframe, advancesHorizon, catalogTrackName, mpuSequenceNumber, packetSequenceNumber, packetSequenceNumbers, repairedPacketSequenceNumbers, authoredTiming, deliveryProvenance, mmtpTimestamp, movieFragmentSequenceNumber, sampleNumber, synthetic, gapBefore, needs) {
|
|
12483
13017
|
if (authoredTiming !== void 0 && !this.#config.admitAuthoredTiming) {
|
|
12484
13018
|
this.#sampleOrderStats.unadmittedAuthoredSamples++;
|
|
12485
13019
|
return;
|
|
@@ -12523,7 +13057,8 @@ var CmafBlockAssembler = class {
|
|
|
12523
13057
|
...catalogTrackName === void 0 ? {} : { catalogTrackName },
|
|
12524
13058
|
...deliveryProvenance === void 0 ? {} : { deliveryProvenance },
|
|
12525
13059
|
...synthetic === void 0 ? {} : { synthetic },
|
|
12526
|
-
...gapBefore === void 0 ? {} : { gapBefore }
|
|
13060
|
+
...gapBefore === void 0 ? {} : { gapBefore },
|
|
13061
|
+
...needs === void 0 ? {} : { needs }
|
|
12527
13062
|
});
|
|
12528
13063
|
if (sample === null) return;
|
|
12529
13064
|
if (advancesHorizon && unwrappedTimestamp > this.#lastSourceTs) {
|
|
@@ -12749,7 +13284,8 @@ var CmafBlockAssembler = class {
|
|
|
12749
13284
|
f.movieFragmentSequenceNumber,
|
|
12750
13285
|
f.sampleNumber,
|
|
12751
13286
|
f.synthetic,
|
|
12752
|
-
f.gapBefore
|
|
13287
|
+
f.gapBefore,
|
|
13288
|
+
f.needs
|
|
12753
13289
|
);
|
|
12754
13290
|
}
|
|
12755
13291
|
}
|
|
@@ -12786,7 +13322,7 @@ var CmafBlockAssembler = class {
|
|
|
12786
13322
|
* is guarded by the per-frame `lastEmittedTs` check (also enforced in
|
|
12787
13323
|
* `#emitPerSample`). The `sbn`/`esi` parameters are kept for the call-site
|
|
12788
13324
|
* signature but no longer affect routing. */
|
|
12789
|
-
addFrame(sbn, esi, data, timestamp, keyframe, catalogTrackName, mpuSequenceNumber, packetSequenceNumber, packetSequenceNumbers, repairedPacketSequenceNumbers, authoredTiming, deliveryProvenance, mmtpTimestamp, movieFragmentSequenceNumber, sampleNumber, gapBefore) {
|
|
13325
|
+
addFrame(sbn, esi, data, timestamp, keyframe, catalogTrackName, mpuSequenceNumber, packetSequenceNumber, packetSequenceNumbers, repairedPacketSequenceNumbers, authoredTiming, deliveryProvenance, mmtpTimestamp, movieFragmentSequenceNumber, sampleNumber, gapBefore, needs) {
|
|
12790
13326
|
void sbn;
|
|
12791
13327
|
void esi;
|
|
12792
13328
|
this.#emitStats.addedFrames++;
|
|
@@ -12808,7 +13344,8 @@ var CmafBlockAssembler = class {
|
|
|
12808
13344
|
movieFragmentSequenceNumber,
|
|
12809
13345
|
sampleNumber,
|
|
12810
13346
|
void 0,
|
|
12811
|
-
gapBefore
|
|
13347
|
+
gapBefore,
|
|
13348
|
+
needs
|
|
12812
13349
|
);
|
|
12813
13350
|
this.#countEmit([{ keyframe }]);
|
|
12814
13351
|
}
|
|
@@ -12849,7 +13386,7 @@ var CmafBlockAssembler = class {
|
|
|
12849
13386
|
}
|
|
12850
13387
|
}
|
|
12851
13388
|
/** Emit a single frame immediately as a one-sample segment (for oversized packets bypassing FEC). */
|
|
12852
|
-
addBypassFrame(data, timestamp, keyframe, catalogTrackName, mpuSequenceNumber, packetSequenceNumber, packetSequenceNumbers, repairedPacketSequenceNumbers, authoredTiming, deliveryProvenance, mmtpTimestamp, movieFragmentSequenceNumber, sampleNumber, gapBefore) {
|
|
13389
|
+
addBypassFrame(data, timestamp, keyframe, catalogTrackName, mpuSequenceNumber, packetSequenceNumber, packetSequenceNumbers, repairedPacketSequenceNumbers, authoredTiming, deliveryProvenance, mmtpTimestamp, movieFragmentSequenceNumber, sampleNumber, gapBefore, needs) {
|
|
12853
13390
|
if (!this.#ordersSamples()) this.#drainRecoveredUpTo(timestamp);
|
|
12854
13391
|
this.#emitSample(
|
|
12855
13392
|
data,
|
|
@@ -12868,7 +13405,8 @@ var CmafBlockAssembler = class {
|
|
|
12868
13405
|
movieFragmentSequenceNumber,
|
|
12869
13406
|
sampleNumber,
|
|
12870
13407
|
void 0,
|
|
12871
|
-
gapBefore
|
|
13408
|
+
gapBefore,
|
|
13409
|
+
needs
|
|
12872
13410
|
);
|
|
12873
13411
|
}
|
|
12874
13412
|
/** Build and emit init segment from catalog config. */
|
|
@@ -12980,7 +13518,8 @@ var CmafBlockAssembler = class {
|
|
|
12980
13518
|
frame.movieFragmentSequenceNumber,
|
|
12981
13519
|
frame.sampleNumber,
|
|
12982
13520
|
frame.synthetic,
|
|
12983
|
-
frame.gapBefore
|
|
13521
|
+
frame.gapBefore,
|
|
13522
|
+
frame.needs
|
|
12984
13523
|
);
|
|
12985
13524
|
this.#countEmit([frame]);
|
|
12986
13525
|
}
|
|
@@ -14116,6 +14655,7 @@ var IsoBmffTimingResolver = class {
|
|
|
14116
14655
|
#pendingSamples = 0;
|
|
14117
14656
|
#evictedSamples = 0;
|
|
14118
14657
|
#lastMovieFragmentRejection = null;
|
|
14658
|
+
#lastMovieFragmentDecodeSpan = null;
|
|
14119
14659
|
/** True once an FT=0 has bound the track that FT=1 timing is read against. */
|
|
14120
14660
|
get initialized() {
|
|
14121
14661
|
return this.#track !== null;
|
|
@@ -14136,6 +14676,15 @@ var IsoBmffTimingResolver = class {
|
|
|
14136
14676
|
get lastMovieFragmentRejection() {
|
|
14137
14677
|
return this.#lastMovieFragmentRejection;
|
|
14138
14678
|
}
|
|
14679
|
+
/**
|
|
14680
|
+
* Decode times of the first and the last sample of the movie fragment that
|
|
14681
|
+
* the most recent `addMovieFragment` parsed, or null when it parsed none. A
|
|
14682
|
+
* `trun` lists samples in decode order, so these bound the fragment. It is
|
|
14683
|
+
* set whether or not the fragment was then admitted: the caller knows that.
|
|
14684
|
+
*/
|
|
14685
|
+
get lastMovieFragmentDecodeSpan() {
|
|
14686
|
+
return this.#lastMovieFragmentDecodeSpan;
|
|
14687
|
+
}
|
|
14139
14688
|
addInitialization(data) {
|
|
14140
14689
|
const timing = parseIsoBmffInitializationTiming(data);
|
|
14141
14690
|
if (!timing) return false;
|
|
@@ -14152,6 +14701,7 @@ var IsoBmffTimingResolver = class {
|
|
|
14152
14701
|
*/
|
|
14153
14702
|
addMovieFragment(mpuSequenceNumber, data, additionalSampleLimit = this.maxPendingSamples, recovered = false) {
|
|
14154
14703
|
this.#lastMovieFragmentRejection = null;
|
|
14704
|
+
this.#lastMovieFragmentDecodeSpan = null;
|
|
14155
14705
|
if (!Number.isInteger(additionalSampleLimit) || additionalSampleLimit < 0) {
|
|
14156
14706
|
this.#lastMovieFragmentRejection = "invalid";
|
|
14157
14707
|
return false;
|
|
@@ -14169,6 +14719,15 @@ var IsoBmffTimingResolver = class {
|
|
|
14169
14719
|
this.#lastMovieFragmentRejection = "invalid";
|
|
14170
14720
|
return false;
|
|
14171
14721
|
}
|
|
14722
|
+
const firstSample = parsed.samples[0];
|
|
14723
|
+
const lastSample = parsed.samples[parsed.samples.length - 1];
|
|
14724
|
+
if (firstSample && lastSample) {
|
|
14725
|
+
this.#lastMovieFragmentDecodeSpan = {
|
|
14726
|
+
first: firstSample.decodeTime,
|
|
14727
|
+
last: lastSample.decodeTime,
|
|
14728
|
+
timescale: firstSample.timescale
|
|
14729
|
+
};
|
|
14730
|
+
}
|
|
14172
14731
|
const key = fragmentKey(mpuSequenceNumber, parsed.movieFragmentSequenceNumber);
|
|
14173
14732
|
const existing = this.#fragments.get(key);
|
|
14174
14733
|
if (existing) {
|
|
@@ -14204,6 +14763,14 @@ var IsoBmffTimingResolver = class {
|
|
|
14204
14763
|
);
|
|
14205
14764
|
return samples?.[sampleNumber - 1] ?? null;
|
|
14206
14765
|
}
|
|
14766
|
+
/**
|
|
14767
|
+
* True when FT=1 declared exactly one sample for this movie fragment,
|
|
14768
|
+
* pending or delivered. False once the fragment is forgotten.
|
|
14769
|
+
*/
|
|
14770
|
+
movieFragmentHoldsOneSample(mpuSequenceNumber, movieFragmentSequenceNumber) {
|
|
14771
|
+
const key = fragmentKey(mpuSequenceNumber, movieFragmentSequenceNumber);
|
|
14772
|
+
return (this.#fragments.get(key)?.length ?? this.#delivered.get(key)?.sampleCount) === 1;
|
|
14773
|
+
}
|
|
14207
14774
|
consumeSample(mpuSequenceNumber, movieFragmentSequenceNumber, sampleNumber, expected) {
|
|
14208
14775
|
const samples = this.#fragments.get(
|
|
14209
14776
|
fragmentKey(mpuSequenceNumber, movieFragmentSequenceNumber)
|
|
@@ -14881,6 +15448,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
14881
15448
|
this.#reassemblyPolicy = null;
|
|
14882
15449
|
this.#frameCb = null;
|
|
14883
15450
|
this.#initCb = null;
|
|
15451
|
+
this.#movieFragmentTimingCb = null;
|
|
14884
15452
|
this.#sourceSymbolCb = null;
|
|
14885
15453
|
this.#trackFrameCbs = /* @__PURE__ */ new Map();
|
|
14886
15454
|
this.#reorderStats = {
|
|
@@ -14990,6 +15558,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
14990
15558
|
#reassemblyPolicy;
|
|
14991
15559
|
#frameCb;
|
|
14992
15560
|
#initCb;
|
|
15561
|
+
#movieFragmentTimingCb;
|
|
14993
15562
|
#sourceSymbolCb;
|
|
14994
15563
|
#trackFrameCbs;
|
|
14995
15564
|
#reorderStats;
|
|
@@ -15199,6 +15768,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
15199
15768
|
identity.sampleNumber = extraction.mfuDuHeader.sampleNumber;
|
|
15200
15769
|
identity.movieFragmentSequenceNumber = extraction.mfuDuHeader.movieFragmentSequenceNumber;
|
|
15201
15770
|
identity.offset = extraction.mfuDuHeader.offset;
|
|
15771
|
+
identity.dependencyCounter = extraction.mfuDuHeader.dependencyCounter;
|
|
15202
15772
|
}
|
|
15203
15773
|
return identity;
|
|
15204
15774
|
} catch {
|
|
@@ -15429,6 +15999,17 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
15429
15999
|
}
|
|
15430
16000
|
return this.#drop("fragment-timing-refused");
|
|
15431
16001
|
}
|
|
16002
|
+
const span = resolver2.lastMovieFragmentDecodeSpan;
|
|
16003
|
+
if (span) {
|
|
16004
|
+
this.#movieFragmentTimingCb?.(
|
|
16005
|
+
info.packetId,
|
|
16006
|
+
options?.catalogTrackName,
|
|
16007
|
+
mpu.mpuSequenceNumber,
|
|
16008
|
+
span.first,
|
|
16009
|
+
span.last,
|
|
16010
|
+
span.timescale
|
|
16011
|
+
);
|
|
16012
|
+
}
|
|
15432
16013
|
this.#replayAwaitingTiming(streamKey, resolver2);
|
|
15433
16014
|
return {
|
|
15434
16015
|
kind: "fragment",
|
|
@@ -15644,6 +16225,14 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
15644
16225
|
onInit(cb) {
|
|
15645
16226
|
this.#initCb = cb;
|
|
15646
16227
|
}
|
|
16228
|
+
/**
|
|
16229
|
+
* Register a callback for the decode times of each movie fragment (FT=1)
|
|
16230
|
+
* the parser admits, arrived or FEC-recovered: what the receiver can
|
|
16231
|
+
* determine of its samples' decode times, whether or not they arrive.
|
|
16232
|
+
*/
|
|
16233
|
+
onMovieFragmentTiming(cb) {
|
|
16234
|
+
this.#movieFragmentTimingCb = cb;
|
|
16235
|
+
}
|
|
15647
16236
|
onFrame(cb) {
|
|
15648
16237
|
this.#frameCb = cb;
|
|
15649
16238
|
}
|
|
@@ -15792,6 +16381,10 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
15792
16381
|
hasAuthoredTimingFor(packetId, mpuSequenceNumber, movieFragmentSequenceNumber, sampleNumber, catalogTrackName) {
|
|
15793
16382
|
return this.#timingResolver(this.#streamKey(packetId, catalogTrackName), packetId, false)?.sampleTiming(mpuSequenceNumber, movieFragmentSequenceNumber, sampleNumber) != null;
|
|
15794
16383
|
}
|
|
16384
|
+
/** Whether FT=1 declared exactly one sample for this movie fragment. False when that is not known. */
|
|
16385
|
+
movieFragmentHoldsOneSample(packetId, mpuSequenceNumber, movieFragmentSequenceNumber, catalogTrackName) {
|
|
16386
|
+
return this.#timingResolver(this.#streamKey(packetId, catalogTrackName), packetId, false)?.movieFragmentHoldsOneSample(mpuSequenceNumber, movieFragmentSequenceNumber) === true;
|
|
16387
|
+
}
|
|
15795
16388
|
/**
|
|
15796
16389
|
* Claim and return the authored timing for a recovered sample. Recovery does
|
|
15797
16390
|
* not pass through the ordinary `feed()` completion path, so it must retire
|
|
@@ -15862,6 +16455,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
15862
16455
|
this.#reassembler.reset();
|
|
15863
16456
|
this.#frameCb = null;
|
|
15864
16457
|
this.#initCb = null;
|
|
16458
|
+
this.#movieFragmentTimingCb = null;
|
|
15865
16459
|
this.#trackFrameCbs.clear();
|
|
15866
16460
|
}
|
|
15867
16461
|
// ── Private ─────────────────────────────────────────────────────
|
|
@@ -16026,7 +16620,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
16026
16620
|
const isHevc = c.startsWith("hev1") || c.startsWith("hvc1");
|
|
16027
16621
|
if (isHevc) {
|
|
16028
16622
|
if (data.length < 5) return void 0;
|
|
16029
|
-
if (startsWithAnnexB(data)) {
|
|
16623
|
+
if (startsWithAnnexB(data) && !isCompleteAvccSample(data)) {
|
|
16030
16624
|
return _MmtpContainerParser.#scanAnnexBForKeyframe(data, true);
|
|
16031
16625
|
}
|
|
16032
16626
|
return _MmtpContainerParser.#scanLengthPrefixedHevcForKeyframe(data);
|
|
@@ -19231,7 +19825,22 @@ function sourceSymbolEvidence(packet, header, rapFlag, packetSequenceNumber) {
|
|
|
19231
19825
|
...identity === null ? {} : { mpu: identity.mpuSequenceNumber },
|
|
19232
19826
|
...identity?.sampleNumber !== void 0 && identity.sampleNumber >= 1 ? { idx: identity.sampleNumber - 1 } : {},
|
|
19233
19827
|
...identity?.movieFragmentSequenceNumber !== void 0 ? { movieFragment: identity.movieFragmentSequenceNumber } : {},
|
|
19234
|
-
...identity?.offset !== void 0 ? { offset: identity.offset } : {}
|
|
19828
|
+
...identity?.offset !== void 0 ? { offset: identity.offset } : {},
|
|
19829
|
+
...identity?.dependencyCounter ? { depCounter: identity.dependencyCounter } : {}
|
|
19830
|
+
};
|
|
19831
|
+
}
|
|
19832
|
+
function recoveredHeaderEvidence(sym) {
|
|
19833
|
+
const { fragment } = sym;
|
|
19834
|
+
if (sym.fragmentType !== 2 || fragment.sampleNumber === void 0 || fragment.sampleNumber < 1 || fragment.movieFragmentSequenceNumber === void 0) {
|
|
19835
|
+
return null;
|
|
19836
|
+
}
|
|
19837
|
+
return {
|
|
19838
|
+
rap: fragment.rapFlag,
|
|
19839
|
+
mpu: fragment.mpuSequenceNumber,
|
|
19840
|
+
idx: fragment.sampleNumber - 1,
|
|
19841
|
+
movieFragment: fragment.movieFragmentSequenceNumber,
|
|
19842
|
+
...fragment.sampleOffset === void 0 ? {} : { offset: fragment.sampleOffset },
|
|
19843
|
+
...fragment.dependencyCounter ? { depCounter: fragment.dependencyCounter } : {}
|
|
19235
19844
|
};
|
|
19236
19845
|
}
|
|
19237
19846
|
var MmtpRouter = class {
|
|
@@ -19468,9 +20077,23 @@ var MmtpRouter = class {
|
|
|
19468
20077
|
this.#diagFor(packetId, catalogTrackName).initSegments++;
|
|
19469
20078
|
this.#deliverInit(packetId, data, catalogTrackName);
|
|
19470
20079
|
});
|
|
20080
|
+
this.#parser.onMovieFragmentTiming((packetId, catalogTrackName, mpu, first, last, mediaTimescale) => {
|
|
20081
|
+
this.#fecManager?.noteSampleDecodeTimes?.(packetId, catalogTrackName, mpu, first, last, mediaTimescale);
|
|
20082
|
+
});
|
|
19471
20083
|
this.#parser.onFrame((data, meta) => this.#routeParsedFrame(data, meta));
|
|
19472
20084
|
this.#wireFecLifecycle(config?.onBlockFailed);
|
|
19473
20085
|
}
|
|
20086
|
+
/**
|
|
20087
|
+
* The `needs` field of a video frame whose DU header places it, or nothing.
|
|
20088
|
+
* Fragment numbers count frames in decode order only where each movie
|
|
20089
|
+
* fragment holds one sample, so a frame gets one only when FT=1 said so.
|
|
20090
|
+
*/
|
|
20091
|
+
#frameNeeds(isVideo, packetId, catalogTrackName, frame) {
|
|
20092
|
+
const { mpuSequenceNumber: mpu, movieFragmentSequenceNumber: position, priority: code } = frame;
|
|
20093
|
+
if (!isVideo || mpu === void 0 || position === void 0 || code === void 0) return {};
|
|
20094
|
+
if (!this.#parser.movieFragmentHoldsOneSample(packetId, mpu, position, catalogTrackName)) return {};
|
|
20095
|
+
return { needs: { mpu, position, code } };
|
|
20096
|
+
}
|
|
19474
20097
|
/**
|
|
19475
20098
|
* Deliver one parser frame: MSE assembly, sync gating, and callback
|
|
19476
20099
|
* routing. Reads #currentFecInfo, the FEC coordinates of the packet the
|
|
@@ -19494,7 +20117,8 @@ var MmtpRouter = class {
|
|
|
19494
20117
|
...meta.mpuSequenceNumber === void 0 ? {} : { mpuSequenceNumber: meta.mpuSequenceNumber },
|
|
19495
20118
|
...meta.movieFragmentSequenceNumber === void 0 ? {} : { movieFragmentSequenceNumber: meta.movieFragmentSequenceNumber },
|
|
19496
20119
|
...meta.sampleNumber === void 0 ? {} : { sampleNumber: meta.sampleNumber },
|
|
19497
|
-
...meta.catalogTrackName === void 0 ? {} : { catalogTrackName: meta.catalogTrackName }
|
|
20120
|
+
...meta.catalogTrackName === void 0 ? {} : { catalogTrackName: meta.catalogTrackName },
|
|
20121
|
+
...this.#frameNeeds(isVideo, packetId, meta.catalogTrackName, meta)
|
|
19498
20122
|
};
|
|
19499
20123
|
if (meta.source) frameMeta.source = meta.source;
|
|
19500
20124
|
if (isVideo && frameMeta.keyframe) {
|
|
@@ -19528,7 +20152,8 @@ var MmtpRouter = class {
|
|
|
19528
20152
|
...frameMeta.sampleNumber === void 0 ? {} : { sampleNumber: frameMeta.sampleNumber },
|
|
19529
20153
|
...frameMeta.catalogTrackName === void 0 ? {} : { catalogTrackName: frameMeta.catalogTrackName },
|
|
19530
20154
|
...frameMeta.deliveryProvenance === void 0 ? {} : { deliveryProvenance: frameMeta.deliveryProvenance },
|
|
19531
|
-
...frameMeta.gapBefore === void 0 ? {} : { gapBefore: frameMeta.gapBefore }
|
|
20155
|
+
...frameMeta.gapBefore === void 0 ? {} : { gapBefore: frameMeta.gapBefore },
|
|
20156
|
+
...frameMeta.needs === void 0 ? {} : { needs: frameMeta.needs }
|
|
19532
20157
|
}]);
|
|
19533
20158
|
} else if (assembler) {
|
|
19534
20159
|
const fecInfo = this.#currentFecInfo;
|
|
@@ -19549,7 +20174,8 @@ var MmtpRouter = class {
|
|
|
19549
20174
|
frameMeta.mmtpTimestamp,
|
|
19550
20175
|
frameMeta.movieFragmentSequenceNumber,
|
|
19551
20176
|
frameMeta.sampleNumber,
|
|
19552
|
-
frameMeta.gapBefore
|
|
20177
|
+
frameMeta.gapBefore,
|
|
20178
|
+
frameMeta.needs
|
|
19553
20179
|
);
|
|
19554
20180
|
} else {
|
|
19555
20181
|
assembler.addBypassFrame(
|
|
@@ -19566,7 +20192,8 @@ var MmtpRouter = class {
|
|
|
19566
20192
|
frameMeta.mmtpTimestamp,
|
|
19567
20193
|
frameMeta.movieFragmentSequenceNumber,
|
|
19568
20194
|
frameMeta.sampleNumber,
|
|
19569
|
-
frameMeta.gapBefore
|
|
20195
|
+
frameMeta.gapBefore,
|
|
20196
|
+
frameMeta.needs
|
|
19570
20197
|
);
|
|
19571
20198
|
}
|
|
19572
20199
|
}
|
|
@@ -21011,7 +21638,7 @@ var MmtpRouter = class {
|
|
|
21011
21638
|
const blockStart = placement.block.start;
|
|
21012
21639
|
this.#openAssistBlock(ownerPacketId, catalogTrackName, blockStart, repair.ssbLength);
|
|
21013
21640
|
if (placement.span !== void 0) {
|
|
21014
|
-
this.#replayIsoSources(ownerPacketId, catalogTrackName, placement.span.block.start, placement.span.placed);
|
|
21641
|
+
this.#replayIsoSources(ownerPacketId, catalogTrackName, placement.span.block.start, placement.span.placed, true);
|
|
21015
21642
|
}
|
|
21016
21643
|
this.#replayIsoSources(ownerPacketId, catalogTrackName, blockStart, placement.placed);
|
|
21017
21644
|
if (this.#classifyPacketId(ownerPacketId) === null) return;
|
|
@@ -21054,7 +21681,7 @@ var MmtpRouter = class {
|
|
|
21054
21681
|
closeIsoHoles(ownerPacketId, catalogTrackName, start, length) {
|
|
21055
21682
|
const spans = this.#fecManager?.closeIsoHoles?.(ownerPacketId, catalogTrackName, start, length) ?? [];
|
|
21056
21683
|
for (const span of spans) {
|
|
21057
|
-
this.#replayIsoSources(ownerPacketId, catalogTrackName, span.block.start, span.placed);
|
|
21684
|
+
this.#replayIsoSources(ownerPacketId, catalogTrackName, span.block.start, span.placed, true);
|
|
21058
21685
|
}
|
|
21059
21686
|
}
|
|
21060
21687
|
/**
|
|
@@ -21063,7 +21690,7 @@ var MmtpRouter = class {
|
|
|
21063
21690
|
* accounting, block tracking with its own classification evidence, then the
|
|
21064
21691
|
* decoder. Their media was routed when they arrived.
|
|
21065
21692
|
*/
|
|
21066
|
-
#replayIsoSources(ownerPacketId, catalogTrackName, blockStart, placed) {
|
|
21693
|
+
#replayIsoSources(ownerPacketId, catalogTrackName, blockStart, placed, inSpan = false) {
|
|
21067
21694
|
const fec = this.#fecManager;
|
|
21068
21695
|
if (!fec) return;
|
|
21069
21696
|
for (const { ssId, esi, payload } of placed) {
|
|
@@ -21077,7 +21704,7 @@ var MmtpRouter = class {
|
|
|
21077
21704
|
catalogTrackName
|
|
21078
21705
|
)) continue;
|
|
21079
21706
|
if (fec.isTrackConfigured?.(ownerPacketId) !== false) {
|
|
21080
|
-
fec.trackBlock(blockStart, ownerPacketId, catalogTrackName, esi, payload.evidence, true);
|
|
21707
|
+
fec.trackBlock(blockStart, ownerPacketId, catalogTrackName, esi, payload.evidence, true, inSpan);
|
|
21081
21708
|
this.#requestFecPoke(ownerPacketId, catalogTrackName);
|
|
21082
21709
|
}
|
|
21083
21710
|
if (payload.oversized) continue;
|
|
@@ -22744,6 +23371,14 @@ var MmtpRouter = class {
|
|
|
22744
23371
|
}
|
|
22745
23372
|
);
|
|
22746
23373
|
}
|
|
23374
|
+
if (!overlay && this.#fecManager?.noteRecoveredSource) {
|
|
23375
|
+
for (const sym of result.symbols) {
|
|
23376
|
+
const evidence = recoveredHeaderEvidence(sym);
|
|
23377
|
+
if (evidence !== null) {
|
|
23378
|
+
this.#fecManager.noteRecoveredSource(blockId, ownerPacketId, catalogTrackName, evidence);
|
|
23379
|
+
}
|
|
23380
|
+
}
|
|
23381
|
+
}
|
|
22747
23382
|
const untimedHead = (sym) => sym.fragmentType === 2 && sym.fragment.fragmentationIndicator === 1 && sym.fragment.movieFragmentSequenceNumber !== void 0 && sym.fragment.sampleNumber !== void 0 && !this.#parser.hasAuthoredTimingFor(
|
|
22748
23383
|
ownerPacketId,
|
|
22749
23384
|
sym.fragment.mpuSequenceNumber,
|
|
@@ -22815,6 +23450,7 @@ var MmtpRouter = class {
|
|
|
22815
23450
|
...sym.fragment.movieFragmentSequenceNumber === void 0 ? {} : { movieFragmentSequenceNumber: sym.fragment.movieFragmentSequenceNumber },
|
|
22816
23451
|
...sym.fragment.sampleNumber === void 0 ? {} : { sampleNumber: sym.fragment.sampleNumber },
|
|
22817
23452
|
rapFlag: sym.fragment.rapFlag,
|
|
23453
|
+
...sym.fragment.priority === void 0 ? {} : { priority: sym.fragment.priority },
|
|
22818
23454
|
recovered: true,
|
|
22819
23455
|
deliveryProvenance,
|
|
22820
23456
|
...fecSbnOf(sym.index),
|
|
@@ -22859,7 +23495,8 @@ var MmtpRouter = class {
|
|
|
22859
23495
|
// never touches the reassembler, so it must carry the block-level
|
|
22860
23496
|
// verdict directly or the sample reaches MSE unattributed.
|
|
22861
23497
|
deliveryProvenance,
|
|
22862
|
-
...sourceDiscontinuity ? { sourceDiscontinuity: true } : {}
|
|
23498
|
+
...sourceDiscontinuity ? { sourceDiscontinuity: true } : {},
|
|
23499
|
+
...this.#frameNeeds(isVideoTrack, ownerPacketId, catalogTrackName, sym.fragment)
|
|
22863
23500
|
});
|
|
22864
23501
|
this.#noteEmittedKeyframe(ownerPacketId, keyframe);
|
|
22865
23502
|
} else {
|
|
@@ -22927,6 +23564,7 @@ var MmtpRouter = class {
|
|
|
22927
23564
|
...assembled.movieFragmentSequenceNumber === void 0 ? {} : { movieFragmentSequenceNumber: assembled.movieFragmentSequenceNumber },
|
|
22928
23565
|
...assembled.sampleNumber === void 0 ? {} : { sampleNumber: assembled.sampleNumber },
|
|
22929
23566
|
rapFlag: assembled.rapFlag,
|
|
23567
|
+
...assembled.priority === void 0 ? {} : { priority: assembled.priority },
|
|
22930
23568
|
recovered: true,
|
|
22931
23569
|
...assembled.deliveryProvenance === void 0 ? {} : { deliveryProvenance: assembled.deliveryProvenance },
|
|
22932
23570
|
...fecSbnOf(sym.index),
|
|
@@ -22974,7 +23612,8 @@ var MmtpRouter = class {
|
|
|
22974
23612
|
...assembled.sampleNumber === void 0 ? {} : { sampleNumber: assembled.sampleNumber },
|
|
22975
23613
|
...assembled.catalogTrackName === void 0 ? {} : { catalogTrackName: assembled.catalogTrackName },
|
|
22976
23614
|
deliveryProvenance: assembled.deliveryProvenance,
|
|
22977
|
-
...sourceDiscontinuity ? { sourceDiscontinuity: true } : {}
|
|
23615
|
+
...sourceDiscontinuity ? { sourceDiscontinuity: true } : {},
|
|
23616
|
+
...this.#frameNeeds(isVideoTrack, ownerPacketId, recoveredCatalogTrackName, assembled)
|
|
22978
23617
|
});
|
|
22979
23618
|
this.#noteEmittedKeyframe(ownerPacketId, keyframe);
|
|
22980
23619
|
}
|
|
@@ -22999,7 +23638,8 @@ var MmtpRouter = class {
|
|
|
22999
23638
|
...frame.catalogTrackName === void 0 ? {} : { catalogTrackName: frame.catalogTrackName },
|
|
23000
23639
|
recovered: true,
|
|
23001
23640
|
deliveryProvenance: frame.deliveryProvenance,
|
|
23002
|
-
...frame.sourceDiscontinuity ? { sourceDiscontinuity: true } : {}
|
|
23641
|
+
...frame.sourceDiscontinuity ? { sourceDiscontinuity: true } : {},
|
|
23642
|
+
...frame.needs === void 0 ? {} : { needs: frame.needs }
|
|
23003
23643
|
});
|
|
23004
23644
|
}
|
|
23005
23645
|
debugRouter(
|
|
@@ -23064,6 +23704,7 @@ var MmtpRouter = class {
|
|
|
23064
23704
|
...sym.fragment.movieFragmentSequenceNumber === void 0 ? {} : { movieFragmentSequenceNumber: sym.fragment.movieFragmentSequenceNumber },
|
|
23065
23705
|
...sym.fragment.sampleNumber === void 0 ? {} : { sampleNumber: sym.fragment.sampleNumber },
|
|
23066
23706
|
rapFlag: sym.fragment.rapFlag,
|
|
23707
|
+
...sym.fragment.priority === void 0 ? {} : { priority: sym.fragment.priority },
|
|
23067
23708
|
recovered: true,
|
|
23068
23709
|
deliveryProvenance,
|
|
23069
23710
|
...fecSbnOf(sym.index),
|
|
@@ -23143,6 +23784,7 @@ var MmtpRouter = class {
|
|
|
23143
23784
|
...assembled.movieFragmentSequenceNumber === void 0 ? {} : { movieFragmentSequenceNumber: assembled.movieFragmentSequenceNumber },
|
|
23144
23785
|
...assembled.sampleNumber === void 0 ? {} : { sampleNumber: assembled.sampleNumber },
|
|
23145
23786
|
rapFlag: assembled.rapFlag,
|
|
23787
|
+
...assembled.priority === void 0 ? {} : { priority: assembled.priority },
|
|
23146
23788
|
recovered: true,
|
|
23147
23789
|
deliveryProvenance,
|
|
23148
23790
|
...fecSbnOf(sym.index),
|
|
@@ -24184,6 +24826,9 @@ var RECLASSIFICATION_EVIDENCE = /* @__PURE__ */ new Set([
|
|
|
24184
24826
|
"rap",
|
|
24185
24827
|
"mpu-span",
|
|
24186
24828
|
"window",
|
|
24829
|
+
"mpu-rule",
|
|
24830
|
+
// Never emitted now (block-policy.ts); an event recorded earlier still validates.
|
|
24831
|
+
"dependent-run",
|
|
24187
24832
|
"classifier-disabled"
|
|
24188
24833
|
]);
|
|
24189
24834
|
var CLASSIFIER_MODES = /* @__PURE__ */ new Set(["classifying", "all-protected"]);
|
|
@@ -24973,7 +25618,9 @@ var MulticastManager = class {
|
|
|
24973
25618
|
interleaveDepthMs,
|
|
24974
25619
|
timescale: config.timescale,
|
|
24975
25620
|
keyframeIntervalTicks: config.keyframeIntervalTicks,
|
|
24976
|
-
keyframeIntervalMs: config.keyframeIntervalMs
|
|
25621
|
+
keyframeIntervalMs: config.keyframeIntervalMs,
|
|
25622
|
+
// The MPU rule classes a block only where this equals the keyframe interval.
|
|
25623
|
+
groupDurationMs: config.groupDurationMs
|
|
24977
25624
|
});
|
|
24978
25625
|
const fecConfig = {
|
|
24979
25626
|
blockProfile,
|
|
@@ -25247,6 +25894,7 @@ var MulticastManager = class {
|
|
|
25247
25894
|
// worse behaviour.
|
|
25248
25895
|
amtRelayPort: config.amtRelayPort ?? config.relayPort ?? (amtRelay?.trim() ? DEFAULT_AMT_RELAY_PORT : void 0),
|
|
25249
25896
|
amtDiscovery: config.amtDiscovery,
|
|
25897
|
+
atsc3: config.atsc3,
|
|
25250
25898
|
packetIds: config.packetIds,
|
|
25251
25899
|
tracks: catalogTracks?.map(({ name, packetId }) => ({ name, packetId })),
|
|
25252
25900
|
...provenance === void 0 ? {} : { protected: true }
|
|
@@ -25400,6 +26048,7 @@ var MulticastManager = class {
|
|
|
25400
26048
|
amtRelay: endpoint.amtRelay,
|
|
25401
26049
|
amtRelayPort: endpoint.amtRelayPort ?? (endpoint.amtRelay?.trim() ? DEFAULT_AMT_RELAY_PORT : void 0),
|
|
25402
26050
|
amtDiscovery: endpoint.amtDiscovery,
|
|
26051
|
+
atsc3: endpoint.atsc3,
|
|
25403
26052
|
packetIds: endpoint.packetIds,
|
|
25404
26053
|
tracks: endpoint.tracks.map(({ name, packetId }) => ({ name, packetId })),
|
|
25405
26054
|
// A protected repair group's records ride in band on its port (7.2.3).
|
|
@@ -26204,8 +26853,10 @@ var MulticastManager = class {
|
|
|
26204
26853
|
const out = {};
|
|
26205
26854
|
for (const [key, stats] of this.#blockPolicyStats) {
|
|
26206
26855
|
if (stats.epoch !== this.#fec.epochFor(stats.packetId)) continue;
|
|
26856
|
+
const mpuRuleOff = this.#fec.mpuRuleOffFor(stats.packetId, stats.catalogTrackName ?? void 0);
|
|
26207
26857
|
out[key] = {
|
|
26208
26858
|
...stats,
|
|
26859
|
+
...mpuRuleOff === void 0 ? {} : { mpuRuleOff },
|
|
26209
26860
|
repairStops: { ...stats.repairStops },
|
|
26210
26861
|
lastRepairSkip: stats.lastRepairSkip === null ? null : { ...stats.lastRepairSkip }
|
|
26211
26862
|
};
|