@blockcast/mmt-container 0.1.0-main.dd5ce397d768 → 0.1.0-main.dd5d220269e4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-runtime.js +524 -277
- package/dist/browser-runtime.js.map +3 -3
- package/dist/catalog-fec-params.d.ts +15 -0
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +11 -0
- package/dist/catalog-fec-params.js.map +2 -2
- package/dist/cmaf-block-assembler.js.map +1 -1
- package/dist/cmaf-group-batcher.js.map +1 -1
- package/dist/cmcd-producer.d.ts.map +1 -1
- package/dist/cmcd-producer.js.map +2 -2
- package/dist/fec-manager.d.ts +1 -5
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +5 -18
- package/dist/fec-manager.js.map +2 -2
- package/dist/fec-worker-setup.d.ts +8 -0
- package/dist/fec-worker-setup.d.ts.map +1 -1
- package/dist/fec-worker-setup.js +5 -3
- package/dist/fec-worker-setup.js.map +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +2 -2
- package/dist/iso-bmff-timing.d.ts +12 -6
- package/dist/iso-bmff-timing.d.ts.map +1 -1
- package/dist/iso-bmff-timing.js +40 -8
- package/dist/iso-bmff-timing.js.map +2 -2
- package/dist/manifest-auth-plan.js +29 -11
- package/dist/manifest-auth-plan.js.map +2 -2
- package/dist/media-router.js.map +2 -2
- package/dist/mfu-reassembler.js +56 -0
- package/dist/mfu-reassembler.js.map +2 -2
- package/dist/mmtp-container-parser.d.ts +101 -0
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +388 -199
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +432 -214
- package/dist/mmtp-container-parser.no-modules.js.map +2 -2
- package/dist/mmtp-decode-pipeline.js +407 -218
- package/dist/mmtp-decode-pipeline.js.map +3 -3
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +404 -208
- package/dist/mmtp-router.js.map +2 -2
- package/dist/mmtp-to-cmaf.d.ts +11 -2
- package/dist/mmtp-to-cmaf.d.ts.map +1 -1
- package/dist/mmtp-to-cmaf.js +15 -4
- package/dist/mmtp-to-cmaf.js.map +2 -2
- package/dist/multicast-manager.d.ts +12 -0
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +474 -251
- package/dist/multicast-manager.js.map +2 -2
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +22 -7
- package/dist/multicast-transport.js.map +2 -2
- package/dist/multicast-unwrap.js.map +2 -2
- package/dist/no-modules.js +432 -214
- package/dist/no-modules.js.map +2 -2
- package/dist/signaling.js.map +2 -2
- package/dist/source-auth.js +29 -11
- package/dist/source-auth.js.map +2 -2
- package/dist/timestamp-codec.js.map +1 -1
- package/dist/track-session.d.ts +17 -1
- package/dist/track-session.d.ts.map +1 -1
- package/dist/track-session.js.map +2 -2
- package/dist/wasm-mfu-reassembler.js +56 -0
- package/dist/wasm-mfu-reassembler.js.map +2 -2
- package/dist/wasm-mmtp-container-parser.js +388 -199
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/node_modules/@blockcast/fec-worker/README.md +1 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.d.ts +2 -2
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.js +2 -2
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.d.ts +4 -4
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.d.ts.map +1 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker.js +3 -3
- package/node_modules/@blockcast/fec-worker/dist/fec-worker.js.map +2 -2
- package/node_modules/@blockcast/fec-worker/src/fec-worker-client.ts +2 -2
- package/node_modules/@blockcast/fec-worker/src/fec-worker-types.ts +4 -4
- package/node_modules/@blockcast/fec-worker/src/fec-worker.ts +6 -6
- package/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts +6 -5
- package/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts.map +1 -1
- package/node_modules/@blockcast/mmt-base/dist/mmtp.js +5 -4
- package/node_modules/@blockcast/mmt-base/dist/mmtp.js.map +1 -1
- package/node_modules/@blockcast/mmt-base/src/mmtp.ts +6 -5
- package/node_modules/@blockcast/mmt-fec/dist/block-manager.d.ts +3 -1
- package/node_modules/@blockcast/mmt-fec/dist/block-manager.d.ts.map +1 -1
- package/node_modules/@blockcast/mmt-fec/dist/block-manager.js +3 -1
- package/node_modules/@blockcast/mmt-fec/dist/block-manager.js.map +1 -1
- package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.d.ts +2 -2
- package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.js +2 -2
- package/node_modules/@blockcast/mmt-fec/dist/oti.d.ts +5 -7
- package/node_modules/@blockcast/mmt-fec/dist/oti.d.ts.map +1 -1
- package/node_modules/@blockcast/mmt-fec/dist/oti.js +4 -6
- package/node_modules/@blockcast/mmt-fec/dist/oti.js.map +1 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts +6 -5
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts.map +1 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.js +5 -4
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.js.map +1 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/src/mmtp.ts +6 -5
- package/node_modules/@blockcast/mmt-fec/src/block-manager.ts +3 -1
- package/node_modules/@blockcast/mmt-fec/src/fec-block-mapper.ts +2 -2
- package/node_modules/@blockcast/mmt-fec/src/oti.ts +5 -7
- package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.d.ts +10 -1
- package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.d.ts.map +1 -1
- package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.js +40 -10
- package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.js.map +1 -1
- package/node_modules/@blockcast/mmt-manifest-verify/src/verifier.ts +41 -8
- package/package.json +6 -6
- package/src/catalog-fec-params.ts +28 -0
- package/src/cmcd-producer.ts +5 -0
- package/src/fec-manager.ts +10 -23
- package/src/fec-worker-setup.ts +11 -1
- package/src/index.ts +4 -0
- package/src/iso-bmff-timing.ts +62 -7
- package/src/mfu-reassembler.ts +95 -0
- package/src/mmtp-container-parser.ts +284 -48
- package/src/mmtp-router.ts +18 -20
- package/src/mmtp-to-cmaf.ts +24 -2
- package/src/multicast-manager.ts +102 -29
- package/src/multicast-transport.ts +19 -4
- package/src/track-session.ts +17 -1
- package/test-vectors/source-contiguity-v1.json +131 -0
package/dist/browser-runtime.js
CHANGED
|
@@ -143,8 +143,8 @@ var init_fec_worker_client = __esm({
|
|
|
143
143
|
* Caller must not access data after this call — it is detached.
|
|
144
144
|
*
|
|
145
145
|
* Carries the wire-level Repair FEC Payload ID fields (ISO 23008-1 §C.5.3):
|
|
146
|
-
* - ssStart: SS_ID of first source symbol in the block (= SBN *
|
|
147
|
-
* - ssbLength:
|
|
146
|
+
* - ssStart: SS_ID of first source symbol in the block (= SBN * configured K)
|
|
147
|
+
* - ssbLength: authored source-symbol count (1..configured K)
|
|
148
148
|
* - rsId: repair symbol index within the block
|
|
149
149
|
*/
|
|
150
150
|
feedRepair(ssStart, ssbLength, rsId, data, ts) {
|
|
@@ -1936,6 +1936,62 @@ if (void 0) {
|
|
|
1936
1936
|
expect(out?.data).toEqual(new Uint8Array([161, 162]));
|
|
1937
1937
|
expect(out?.sampleOffset).toBe(4);
|
|
1938
1938
|
});
|
|
1939
|
+
test("a mid-data-unit packet sequence gap strands the data unit", () => {
|
|
1940
|
+
const reassembler = new MFUReassembler({ timeoutMs: null, maxBuffered: 10 });
|
|
1941
|
+
expect(
|
|
1942
|
+
reassembler.addFragment({
|
|
1943
|
+
fragmentationIndicator: 1,
|
|
1944
|
+
mpuSequenceNumber: 7,
|
|
1945
|
+
fragmentCounter: 2,
|
|
1946
|
+
movieFragmentSequenceNumber: 9,
|
|
1947
|
+
sampleNumber: 17,
|
|
1948
|
+
sampleOffset: 0,
|
|
1949
|
+
packetSequenceNumber: 100,
|
|
1950
|
+
data: new Uint8Array([161]),
|
|
1951
|
+
timestamp: 1100n,
|
|
1952
|
+
rapFlag: true
|
|
1953
|
+
})
|
|
1954
|
+
).toBeNull();
|
|
1955
|
+
const interleaved = reassembler.addFragment({
|
|
1956
|
+
fragmentationIndicator: 0,
|
|
1957
|
+
mpuSequenceNumber: 7,
|
|
1958
|
+
fragmentCounter: 0,
|
|
1959
|
+
movieFragmentSequenceNumber: 9,
|
|
1960
|
+
sampleNumber: 18,
|
|
1961
|
+
sampleOffset: 0,
|
|
1962
|
+
packetSequenceNumber: 101,
|
|
1963
|
+
data: new Uint8Array([255]),
|
|
1964
|
+
timestamp: 1101n,
|
|
1965
|
+
rapFlag: true
|
|
1966
|
+
});
|
|
1967
|
+
expect(interleaved?.data).toEqual(new Uint8Array([255]));
|
|
1968
|
+
expect(
|
|
1969
|
+
reassembler.addFragment({
|
|
1970
|
+
fragmentationIndicator: 2,
|
|
1971
|
+
mpuSequenceNumber: 7,
|
|
1972
|
+
fragmentCounter: 1,
|
|
1973
|
+
packetSequenceNumber: 102,
|
|
1974
|
+
data: new Uint8Array([162]),
|
|
1975
|
+
timestamp: 1102n,
|
|
1976
|
+
rapFlag: false
|
|
1977
|
+
})
|
|
1978
|
+
).toBeNull();
|
|
1979
|
+
const output = reassembler.addFragment({
|
|
1980
|
+
fragmentationIndicator: 3,
|
|
1981
|
+
mpuSequenceNumber: 7,
|
|
1982
|
+
fragmentCounter: 0,
|
|
1983
|
+
packetSequenceNumber: 103,
|
|
1984
|
+
data: new Uint8Array([163]),
|
|
1985
|
+
timestamp: 1103n,
|
|
1986
|
+
rapFlag: false
|
|
1987
|
+
});
|
|
1988
|
+
expect(output).toBeNull();
|
|
1989
|
+
expect(reassembler.stats.reassembledMFUs).toBe(1);
|
|
1990
|
+
expect(reassembler.stats.rejectedFragments).toBe(0);
|
|
1991
|
+
expect(reassembler.stats.evictedMemoryLimit).toBe(0);
|
|
1992
|
+
expect(reassembler.getStatus().bufferedMFUs).toBe(2);
|
|
1993
|
+
expect(reassembler.getStatus().pendingFragments).toBe(3);
|
|
1994
|
+
});
|
|
1939
1995
|
test("sibling subsample DUs of one sample reassemble independently by offset", () => {
|
|
1940
1996
|
const reassembler = new MFUReassembler({ timeoutMs: 1e3 });
|
|
1941
1997
|
expect(
|
|
@@ -7719,16 +7775,26 @@ var MmtpToCmaf = class {
|
|
|
7719
7775
|
return __privateGet(this, _audioInitSegment);
|
|
7720
7776
|
}
|
|
7721
7777
|
/** Convert a raw video sample to an fMP4 moof+mdat segment. */
|
|
7722
|
-
wrapVideoSample(data, timestamp, keyframe, duration) {
|
|
7723
|
-
return this.wrapVideoSampleWithTiming(data, timestamp, keyframe, duration).segment;
|
|
7778
|
+
wrapVideoSample(data, timestamp, keyframe, duration, compositionTimeOffset) {
|
|
7779
|
+
return this.wrapVideoSampleWithTiming(data, timestamp, keyframe, duration, compositionTimeOffset).segment;
|
|
7724
7780
|
}
|
|
7725
7781
|
/**
|
|
7726
7782
|
* Convert a raw video sample and return the exact browser media interval
|
|
7727
7783
|
* encoded into tfdt/trun. Consumers that correlate SourceBuffer appends with
|
|
7728
7784
|
* requestVideoFrameCallback must use this rebased timestamp, not the wire or
|
|
7729
7785
|
* caller-owned timestamp passed above.
|
|
7786
|
+
*
|
|
7787
|
+
* `compositionTimeOffset` is the signed authored PTS-DTS delta, in the same
|
|
7788
|
+
* #videoTimescale units as `timestamp` and `duration` — unlike wrapAudioSample,
|
|
7789
|
+
* which takes microseconds and rescales, because every other quantity on this
|
|
7790
|
+
* path is already denominated in #videoTimescale (see setVideoTrackParams).
|
|
7791
|
+
* Passing it therefore needs no conversion here; rescaling would double-convert.
|
|
7792
|
+
* Absent leaves the trun at version 0 with no offset field; a declared 0 is an
|
|
7793
|
+
* authored value and still promotes to version 1. Never reconstruct it from
|
|
7794
|
+
* arrival time.
|
|
7730
7795
|
*/
|
|
7731
|
-
wrapVideoSampleWithTiming(data, timestamp, keyframe, duration) {
|
|
7796
|
+
wrapVideoSampleWithTiming(data, timestamp, keyframe, duration, compositionTimeOffset) {
|
|
7797
|
+
assertCompositionTimeOffsets([{ compositionTimeOffset }]);
|
|
7732
7798
|
if (duration !== void 0 && Number.isFinite(duration) && duration > 0) {
|
|
7733
7799
|
__privateSet(this, _frameDuration, Math.round(duration));
|
|
7734
7800
|
} else if (__privateGet(this, _lastVideoTimestamp) > 0 && timestamp > __privateGet(this, _lastVideoTimestamp)) {
|
|
@@ -7746,7 +7812,8 @@ var MmtpToCmaf = class {
|
|
|
7746
7812
|
frameDuration,
|
|
7747
7813
|
keyframe,
|
|
7748
7814
|
__privateWrapper(this, _videoSeq)._++,
|
|
7749
|
-
__privateGet(this, _videoTrackId)
|
|
7815
|
+
__privateGet(this, _videoTrackId),
|
|
7816
|
+
compositionTimeOffset
|
|
7750
7817
|
),
|
|
7751
7818
|
mediaTimestamp: relTs,
|
|
7752
7819
|
duration: frameDuration
|
|
@@ -10017,7 +10084,7 @@ var FECManager = class {
|
|
|
10017
10084
|
symbolSizeForPacket(packetId) {
|
|
10018
10085
|
return __privateMethod(this, _FECManager_instances, resolveTrackConfig_fn).call(this, packetId).symbolSize;
|
|
10019
10086
|
}
|
|
10020
|
-
/** FEC
|
|
10087
|
+
/** FEC block span in milliseconds (0 = no interleaving). */
|
|
10021
10088
|
get interleaveDepthMs() {
|
|
10022
10089
|
return __privateGet(this, _fecInterleaveDepthMs);
|
|
10023
10090
|
}
|
|
@@ -10339,14 +10406,10 @@ var FECManager = class {
|
|
|
10339
10406
|
return null;
|
|
10340
10407
|
}
|
|
10341
10408
|
const fecData = repairData;
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
catalogTrackName
|
|
10347
|
-
);
|
|
10348
|
-
}
|
|
10349
|
-
const sbn = ssbLength > 0 ? Math.floor(ssStart / ssbLength) : 0;
|
|
10409
|
+
const k = this.kForPacket(packetId);
|
|
10410
|
+
if (ssbLength <= 0 || ssbLength > k || ssStart % k !== 0) return null;
|
|
10411
|
+
const sbn = Math.floor(ssStart / k);
|
|
10412
|
+
this.noteBlockActivity(sbn, packetId, catalogTrackName);
|
|
10350
10413
|
const blockKey = __privateMethod(this, _FECManager_instances, blockKey_fn).call(this, sbn, packetId, catalogTrackName);
|
|
10351
10414
|
if (__privateGet(this, _completedBlocks).has(blockKey)) return null;
|
|
10352
10415
|
const syncBlockOwner = __privateGet(this, _syncDecoderBlockOwners).get(blockKey);
|
|
@@ -10382,15 +10445,6 @@ var FECManager = class {
|
|
|
10382
10445
|
if (recovered) __privateGet(this, _syncDecoderBlockOwners).delete(blockKey);
|
|
10383
10446
|
return recovered;
|
|
10384
10447
|
}
|
|
10385
|
-
/**
|
|
10386
|
-
* Unified symbol feeder. Dispatches to feedSourceSymbol or feedRepairSymbol.
|
|
10387
|
-
*/
|
|
10388
|
-
feedSymbol(packetId, symbolId, data, isRepair) {
|
|
10389
|
-
if (isRepair) {
|
|
10390
|
-
return this.feedRepairSymbol(packetId, symbolId, 1, symbolId, data);
|
|
10391
|
-
}
|
|
10392
|
-
return this.feedSourceSymbol(packetId, symbolId, data);
|
|
10393
|
-
}
|
|
10394
10448
|
// -----------------------------------------------------------------------
|
|
10395
10449
|
// Block lifecycle
|
|
10396
10450
|
// -----------------------------------------------------------------------
|
|
@@ -11577,7 +11631,7 @@ function sameTrack(a, b) {
|
|
|
11577
11631
|
function sameSample(a, b) {
|
|
11578
11632
|
return a.decodeTime === b.decodeTime && a.presentationTime === b.presentationTime && a.duration === b.duration && a.timescale === b.timescale && a.size === b.size && a.bytePosition === b.bytePosition;
|
|
11579
11633
|
}
|
|
11580
|
-
var _track, _fragments, _pendingSamples, _lastMovieFragmentRejection, _IsoBmffTimingResolver_instances, clearSlot_fn;
|
|
11634
|
+
var _track, _fragments, _pendingSamples, _evictedSamples, _lastMovieFragmentRejection, _IsoBmffTimingResolver_instances, evictOldestFragment_fn, clearSlot_fn;
|
|
11581
11635
|
var IsoBmffTimingResolver = class {
|
|
11582
11636
|
constructor(maxPendingSamples) {
|
|
11583
11637
|
this.maxPendingSamples = maxPendingSamples;
|
|
@@ -11585,6 +11639,7 @@ var IsoBmffTimingResolver = class {
|
|
|
11585
11639
|
__privateAdd(this, _track, null);
|
|
11586
11640
|
__privateAdd(this, _fragments, /* @__PURE__ */ new Map());
|
|
11587
11641
|
__privateAdd(this, _pendingSamples, 0);
|
|
11642
|
+
__privateAdd(this, _evictedSamples, 0);
|
|
11588
11643
|
__privateAdd(this, _lastMovieFragmentRejection, null);
|
|
11589
11644
|
if (!Number.isInteger(maxPendingSamples) || maxPendingSamples <= 0) {
|
|
11590
11645
|
throw new Error("[IsoBmffTimingResolver] maxPendingSamples must be a positive integer");
|
|
@@ -11593,6 +11648,15 @@ var IsoBmffTimingResolver = class {
|
|
|
11593
11648
|
get pendingSampleCount() {
|
|
11594
11649
|
return __privateGet(this, _pendingSamples);
|
|
11595
11650
|
}
|
|
11651
|
+
/**
|
|
11652
|
+
* Slots reclaimed by window displacement rather than by delivery or
|
|
11653
|
+
* abandonment. Deliberately separate from the combiner's own release count:
|
|
11654
|
+
* "nobody ever saw this sample" and "the combiner gave up on it" are
|
|
11655
|
+
* different failures with different owners, and one number cannot say which.
|
|
11656
|
+
*/
|
|
11657
|
+
get evictedSampleCount() {
|
|
11658
|
+
return __privateGet(this, _evictedSamples);
|
|
11659
|
+
}
|
|
11596
11660
|
/** Typed reason for the most recent rejected movie fragment. */
|
|
11597
11661
|
get lastMovieFragmentRejection() {
|
|
11598
11662
|
return __privateGet(this, _lastMovieFragmentRejection);
|
|
@@ -11630,7 +11694,11 @@ var IsoBmffTimingResolver = class {
|
|
|
11630
11694
|
(sample, index) => sample !== null && sameSample(sample, parsed.samples[index])
|
|
11631
11695
|
);
|
|
11632
11696
|
}
|
|
11633
|
-
|
|
11697
|
+
let freed = 0;
|
|
11698
|
+
while (__privateGet(this, _fragments).size > 0 && (__privateGet(this, _pendingSamples) + parsed.samples.length > this.maxPendingSamples || parsed.samples.length - freed > additionalSampleLimit)) {
|
|
11699
|
+
freed += __privateMethod(this, _IsoBmffTimingResolver_instances, evictOldestFragment_fn).call(this);
|
|
11700
|
+
}
|
|
11701
|
+
if (parsed.samples.length - freed > additionalSampleLimit) {
|
|
11634
11702
|
__privateSet(this, _lastMovieFragmentRejection, "budget");
|
|
11635
11703
|
return false;
|
|
11636
11704
|
}
|
|
@@ -11663,12 +11731,11 @@ var IsoBmffTimingResolver = class {
|
|
|
11663
11731
|
* Free the budget slot of a sample that will never be delivered.
|
|
11664
11732
|
*
|
|
11665
11733
|
* `consumeSample` is the delivery path and is the only decrement on a
|
|
11666
|
-
* healthy stream.
|
|
11667
|
-
* delivered
|
|
11668
|
-
*
|
|
11669
|
-
*
|
|
11670
|
-
*
|
|
11671
|
-
* a full track reset clears it.
|
|
11734
|
+
* healthy stream. A sample whose data units never complete is never
|
|
11735
|
+
* delivered; window displacement in `addMovieFragment` eventually reclaims
|
|
11736
|
+
* it, but only after it has aged out of the whole window. This path frees
|
|
11737
|
+
* the slot as soon as the combiner knows the sample is gone, so the budget
|
|
11738
|
+
* tracks what is actually in flight rather than what has merely aged.
|
|
11672
11739
|
*
|
|
11673
11740
|
* The caller is whoever abandoned the sample, so the release is driven by
|
|
11674
11741
|
* the abandonment itself rather than by a timer, an LRU, or an age bound --
|
|
@@ -11692,8 +11759,27 @@ var IsoBmffTimingResolver = class {
|
|
|
11692
11759
|
_track = new WeakMap();
|
|
11693
11760
|
_fragments = new WeakMap();
|
|
11694
11761
|
_pendingSamples = new WeakMap();
|
|
11762
|
+
_evictedSamples = new WeakMap();
|
|
11695
11763
|
_lastMovieFragmentRejection = new WeakMap();
|
|
11696
11764
|
_IsoBmffTimingResolver_instances = new WeakSet();
|
|
11765
|
+
/**
|
|
11766
|
+
* Drop the oldest pending fragment whole and return the slots it held.
|
|
11767
|
+
*
|
|
11768
|
+
* Oldest is insertion order, which for a moof stream is arrival order, so
|
|
11769
|
+
* this is the least-recently-declared timing -- the entries least likely to
|
|
11770
|
+
* still have data units in flight.
|
|
11771
|
+
*/
|
|
11772
|
+
evictOldestFragment_fn = function() {
|
|
11773
|
+
const oldest = __privateGet(this, _fragments).keys().next().value;
|
|
11774
|
+
if (oldest === void 0) return 0;
|
|
11775
|
+
const samples = __privateGet(this, _fragments).get(oldest);
|
|
11776
|
+
let live = 0;
|
|
11777
|
+
for (const sample of samples) if (sample !== null) live++;
|
|
11778
|
+
__privateGet(this, _fragments).delete(oldest);
|
|
11779
|
+
__privateSet(this, _pendingSamples, __privateGet(this, _pendingSamples) - live);
|
|
11780
|
+
__privateSet(this, _evictedSamples, __privateGet(this, _evictedSamples) + live);
|
|
11781
|
+
return live;
|
|
11782
|
+
};
|
|
11697
11783
|
/** Null one slot, decrement the budget, and drop the fragment when empty. */
|
|
11698
11784
|
clearSlot_fn = function(mpuSequenceNumber, movieFragmentSequenceNumber, sampleNumber) {
|
|
11699
11785
|
if (!isU322(mpuSequenceNumber) || !isU322(movieFragmentSequenceNumber) || movieFragmentSequenceNumber === 0 || !isU322(sampleNumber) || sampleNumber === 0) {
|
|
@@ -11872,7 +11958,7 @@ function isFmp4Box(data) {
|
|
|
11872
11958
|
const type = String.fromCharCode(data[4], data[5], data[6], data[7]);
|
|
11873
11959
|
return FMPU_BOX_TYPES.has(type);
|
|
11874
11960
|
}
|
|
11875
|
-
var _tracks, _defaultTrack, _reassembler, _sampleCombiners, _sampleCombinerOptions, _retiredSampleCombinerStats, _timingStreams, _maxPendingTimingSamples, _pendingTimingSamples, _reclaimedTimingSamples, _rejectedMovieFragments, _sequencers, _reorderWindow, _reassemblyPolicy, _frameCb, _initCb, _sourceSymbolCb, _trackFrameCbs, _reorderStats, _reliableMoqStartupGate, _disposed2, _MmtpContainerParser_instances, streamKey_fn2, sampleCombinerFor_fn, releaseTimingSlot_fn, dropSampleCombiner_fn, emitCombinedSample_fn, passReliableMoqStartupGate_fn, timingResolver_fn, dropTimingStream_fn, validateReassemblyPolicy_fn, buildFrameMeta_fn, sequencerFor_fn, flushSequencers_fn, emitFrame_fn2, _MmtpContainerParser_static, scanForKeyframe_fn, scanLengthPrefixedHevcForKeyframe_fn, scanAnnexBForKeyframe_fn;
|
|
11961
|
+
var _tracks, _defaultTrack, _reassembler, _sampleCombiners, _sampleCombinerOptions, _retiredSampleCombinerStats, _timingStreams, _maxPendingTimingSamples, _pendingTimingSamples, _reclaimedTimingSamples, _evictedTimingSamples, _rejectedMovieFragments, _sequencers, _reorderWindow, _reassemblyPolicy, _frameCb, _initCb, _sourceSymbolCb, _trackFrameCbs, _reorderStats, _reliableMoqStartupGate, _disposed2, _fedObjects, _feedOutcomes, _deferredFeedOutcomes, _lastOutcome, _lastOutcomeCount, _MmtpContainerParser_instances, streamKey_fn2, sampleCombinerFor_fn, releaseTimingSlot_fn, dropSampleCombiner_fn, countOutcome_fn, countDeferredOutcome_fn, drop_fn, feed_fn, emitCombinedSample_fn, passReliableMoqStartupGate_fn, timingResolver_fn, dropTimingStream_fn, validateReassemblyPolicy_fn, buildFrameMeta_fn, sequencerFor_fn, flushSequencers_fn, emitFrame_fn2, _MmtpContainerParser_static, scanForKeyframe_fn, scanLengthPrefixedHevcForKeyframe_fn, scanAnnexBForKeyframe_fn;
|
|
11876
11962
|
var _MmtpContainerParser = class _MmtpContainerParser {
|
|
11877
11963
|
constructor(config) {
|
|
11878
11964
|
__privateAdd(this, _MmtpContainerParser_instances);
|
|
@@ -11906,6 +11992,7 @@ var _MmtpContainerParser = class _MmtpContainerParser {
|
|
|
11906
11992
|
__privateAdd(this, _maxPendingTimingSamples);
|
|
11907
11993
|
__privateAdd(this, _pendingTimingSamples, 0);
|
|
11908
11994
|
__privateAdd(this, _reclaimedTimingSamples, 0);
|
|
11995
|
+
__privateAdd(this, _evictedTimingSamples, 0);
|
|
11909
11996
|
__privateAdd(this, _rejectedMovieFragments, 0);
|
|
11910
11997
|
__privateAdd(this, _sequencers, /* @__PURE__ */ new Map());
|
|
11911
11998
|
__privateAdd(this, _reorderWindow, 0);
|
|
@@ -11932,6 +12019,11 @@ var _MmtpContainerParser = class _MmtpContainerParser {
|
|
|
11932
12019
|
* reordering into the parser. */
|
|
11933
12020
|
__privateAdd(this, _reliableMoqStartupGate, /* @__PURE__ */ new Map());
|
|
11934
12021
|
__privateAdd(this, _disposed2, false);
|
|
12022
|
+
__privateAdd(this, _fedObjects, 0);
|
|
12023
|
+
__privateAdd(this, _feedOutcomes, /* @__PURE__ */ new Map());
|
|
12024
|
+
__privateAdd(this, _deferredFeedOutcomes, /* @__PURE__ */ new Map());
|
|
12025
|
+
__privateAdd(this, _lastOutcome, null);
|
|
12026
|
+
__privateAdd(this, _lastOutcomeCount, 0);
|
|
11935
12027
|
/** Authored presentation timestamp of the last emitted frame, in microseconds. */
|
|
11936
12028
|
this.lastFrameTimestamp = void 0;
|
|
11937
12029
|
if (config?.reassemblyPolicy && config.mfuTimeoutMs !== void 0) {
|
|
@@ -12034,6 +12126,7 @@ var _MmtpContainerParser = class _MmtpContainerParser {
|
|
|
12034
12126
|
pending: __privateGet(this, _pendingTimingSamples),
|
|
12035
12127
|
capacity: __privateGet(this, _maxPendingTimingSamples),
|
|
12036
12128
|
reclaimed: __privateGet(this, _reclaimedTimingSamples),
|
|
12129
|
+
evicted: __privateGet(this, _evictedTimingSamples),
|
|
12037
12130
|
rejectedMovieFragments: __privateGet(this, _rejectedMovieFragments)
|
|
12038
12131
|
};
|
|
12039
12132
|
}
|
|
@@ -12042,6 +12135,36 @@ var _MmtpContainerParser = class _MmtpContainerParser {
|
|
|
12042
12135
|
for (const { sequencer } of __privateGet(this, _sequencers).values()) bufferedFrames += sequencer.buffered;
|
|
12043
12136
|
return { ...__privateGet(this, _reorderStats), bufferedFrames };
|
|
12044
12137
|
}
|
|
12138
|
+
/**
|
|
12139
|
+
* Feed tallies for this parser. A fresh snapshot per call, not a live view,
|
|
12140
|
+
* so a caller can hold one and compare it against a later read.
|
|
12141
|
+
*
|
|
12142
|
+
* Survives dispose() — the counters are the parser's own state and are not
|
|
12143
|
+
* cleared by teardown, because a wedged receive path is usually read after
|
|
12144
|
+
* the fact.
|
|
12145
|
+
*/
|
|
12146
|
+
get feedStats() {
|
|
12147
|
+
return {
|
|
12148
|
+
fedObjects: __privateGet(this, _fedObjects),
|
|
12149
|
+
outcomes: Object.fromEntries(__privateGet(this, _feedOutcomes)),
|
|
12150
|
+
deferredOutcomes: Object.fromEntries(__privateGet(this, _deferredFeedOutcomes))
|
|
12151
|
+
};
|
|
12152
|
+
}
|
|
12153
|
+
/**
|
|
12154
|
+
* Outcome token of the most recent feed(), or null before the first call.
|
|
12155
|
+
*
|
|
12156
|
+
* Exposed alongside `lastFeedOutcomeCount` as two scalars rather than one
|
|
12157
|
+
* object because a wrapper reads them on every packet, and feedStats()
|
|
12158
|
+
* allocates a fresh snapshot per call.
|
|
12159
|
+
*/
|
|
12160
|
+
get lastFeedOutcome() {
|
|
12161
|
+
return __privateGet(this, _lastOutcome);
|
|
12162
|
+
}
|
|
12163
|
+
/** How many times `lastFeedOutcome` has now been seen. 1 on its first
|
|
12164
|
+
* occurrence, which is what a caller logging once per novel outcome needs. */
|
|
12165
|
+
get lastFeedOutcomeCount() {
|
|
12166
|
+
return __privateGet(this, _lastOutcomeCount);
|
|
12167
|
+
}
|
|
12045
12168
|
get reorderDiagnostics() {
|
|
12046
12169
|
const streams = [];
|
|
12047
12170
|
for (const { packetId, sequencer } of __privateGet(this, _sequencers).values()) {
|
|
@@ -12091,181 +12214,16 @@ var _MmtpContainerParser = class _MmtpContainerParser {
|
|
|
12091
12214
|
}
|
|
12092
12215
|
/** Feed a complete MMTP packet. For two-phase use, call parseHeader() first. */
|
|
12093
12216
|
feed(packet, options) {
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
this.cleanupTimeouts();
|
|
12097
|
-
const info = this.parseHeader(packet, options);
|
|
12098
|
-
if (!info) return null;
|
|
12099
|
-
if (info.packetType !== PACKET_TYPE_MPU2) {
|
|
12100
|
-
return {
|
|
12101
|
-
kind: info.isRepair ? "repair" : "non-media",
|
|
12102
|
-
packet: info,
|
|
12103
|
-
byteLength: packet.byteLength
|
|
12104
|
-
};
|
|
12105
|
-
}
|
|
12106
|
-
if (info.fecPayloadId !== null && __privateGet(this, _sourceSymbolCb)) {
|
|
12107
|
-
const rawSymbol = packet.subarray(0, packet.length - 4);
|
|
12108
|
-
const altaTrailer = extractAltaTrailer2(packet);
|
|
12109
|
-
const alta = altaTrailer ? { auth: altaTrailer.auth, payloadEnd: altaTrailer.signedEnd } : void 0;
|
|
12110
|
-
try {
|
|
12111
|
-
__privateGet(this, _sourceSymbolCb).call(this, info.packetId, info.fecPayloadId.ssId, rawSymbol, alta);
|
|
12112
|
-
} catch {
|
|
12113
|
-
}
|
|
12114
|
-
}
|
|
12115
|
-
const extraction = extractMFUPayload(packet, {
|
|
12116
|
-
skipFecId: options?.skipFecPayloadId
|
|
12117
|
-
});
|
|
12118
|
-
if (!extraction) return null;
|
|
12119
|
-
const { mpu, fragmentType, data, mfuDuHeader } = extraction;
|
|
12120
|
-
if (mpu.timedFlag !== 1) return null;
|
|
12121
|
-
const streamKey = __privateMethod(this, _MmtpContainerParser_instances, streamKey_fn2).call(this, info.packetId, options?.catalogTrackName);
|
|
12122
|
-
if (fragmentType === 0) {
|
|
12123
|
-
if (mpu.fragmentationIndicator !== 0 || mpu.fragmentCounter !== 0) return null;
|
|
12124
|
-
const normalizedInit = normalizeMmtpInitSegment(data);
|
|
12125
|
-
if (!normalizedInit) return null;
|
|
12126
|
-
const resolver2 = __privateMethod(this, _MmtpContainerParser_instances, timingResolver_fn).call(this, streamKey, info.packetId, true);
|
|
12127
|
-
if (!resolver2?.addInitialization(normalizedInit)) return null;
|
|
12128
|
-
(_a = __privateGet(this, _initCb)) == null ? void 0 : _a.call(this, normalizedInit, info.packetId, options?.catalogTrackName);
|
|
12129
|
-
return {
|
|
12130
|
-
kind: "init",
|
|
12131
|
-
packet: info,
|
|
12132
|
-
data: normalizedInit,
|
|
12133
|
-
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12134
|
-
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12135
|
-
fragmentCounter: mpu.fragmentCounter
|
|
12136
|
-
};
|
|
12137
|
-
}
|
|
12138
|
-
if (fragmentType === 1) {
|
|
12139
|
-
if (mpu.fragmentationIndicator !== 0 || mpu.fragmentCounter !== 0) return null;
|
|
12140
|
-
const resolver2 = __privateMethod(this, _MmtpContainerParser_instances, timingResolver_fn).call(this, streamKey, info.packetId, false);
|
|
12141
|
-
if (!resolver2) return null;
|
|
12142
|
-
const pendingBefore = resolver2.pendingSampleCount;
|
|
12143
|
-
const remaining = __privateGet(this, _maxPendingTimingSamples) - __privateGet(this, _pendingTimingSamples);
|
|
12144
|
-
if (!resolver2.addMovieFragment(mpu.mpuSequenceNumber, data, remaining)) {
|
|
12145
|
-
if (resolver2.lastMovieFragmentRejection === "budget") {
|
|
12146
|
-
__privateWrapper(this, _rejectedMovieFragments)._++;
|
|
12147
|
-
}
|
|
12148
|
-
return null;
|
|
12149
|
-
}
|
|
12150
|
-
__privateSet(this, _pendingTimingSamples, __privateGet(this, _pendingTimingSamples) + (resolver2.pendingSampleCount - pendingBefore));
|
|
12151
|
-
return {
|
|
12152
|
-
kind: "fragment",
|
|
12153
|
-
packet: info,
|
|
12154
|
-
data,
|
|
12155
|
-
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12156
|
-
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12157
|
-
fragmentCounter: mpu.fragmentCounter
|
|
12158
|
-
};
|
|
12159
|
-
}
|
|
12160
|
-
if (fragmentType !== 2) return null;
|
|
12161
|
-
const resolver = __privateMethod(this, _MmtpContainerParser_instances, timingResolver_fn).call(this, streamKey, info.packetId, false);
|
|
12162
|
-
if (!resolver) return null;
|
|
12163
|
-
if (!Number.isSafeInteger(data.byteLength) || data.byteLength <= 0) return null;
|
|
12164
|
-
if (mpu.fragmentationIndicator === 0 || mpu.fragmentationIndicator === 1) {
|
|
12165
|
-
if (!mfuDuHeader || mfuDuHeader.movieFragmentSequenceNumber === 0 || mfuDuHeader.sampleNumber === 0) {
|
|
12166
|
-
return null;
|
|
12167
|
-
}
|
|
12168
|
-
const headTiming = resolver.sampleTiming(
|
|
12169
|
-
mpu.mpuSequenceNumber,
|
|
12170
|
-
mfuDuHeader.movieFragmentSequenceNumber,
|
|
12171
|
-
mfuDuHeader.sampleNumber
|
|
12172
|
-
);
|
|
12173
|
-
if (!headTiming) return null;
|
|
12174
|
-
const offset = mfuDuHeader.offset;
|
|
12175
|
-
if (!Number.isSafeInteger(offset) || offset < 0 || offset >= headTiming.size) return null;
|
|
12176
|
-
const remaining = headTiming.size - offset;
|
|
12177
|
-
if (mpu.fragmentationIndicator === 0 && data.byteLength !== remaining) return null;
|
|
12178
|
-
if (mpu.fragmentationIndicator === 1 && data.byteLength >= remaining) return null;
|
|
12179
|
-
const readyOnRegister = __privateMethod(this, _MmtpContainerParser_instances, sampleCombinerFor_fn).call(this, streamKey).registerAuthoredSize(
|
|
12180
|
-
options?.catalogTrackName,
|
|
12181
|
-
mpu.mpuSequenceNumber,
|
|
12182
|
-
mfuDuHeader.movieFragmentSequenceNumber,
|
|
12183
|
-
mfuDuHeader.sampleNumber,
|
|
12184
|
-
headTiming.size
|
|
12185
|
-
);
|
|
12186
|
-
if (readyOnRegister) {
|
|
12187
|
-
__privateMethod(this, _MmtpContainerParser_instances, emitCombinedSample_fn).call(this, readyOnRegister, info, resolver, options?.recovered === true);
|
|
12188
|
-
}
|
|
12189
|
-
}
|
|
12190
|
-
let assembled;
|
|
12191
|
-
try {
|
|
12192
|
-
assembled = __privateGet(this, _reassembler).addFragment({
|
|
12193
|
-
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12194
|
-
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12195
|
-
fragmentCounter: mpu.fragmentCounter,
|
|
12196
|
-
data,
|
|
12197
|
-
timestamp: info.timestamp,
|
|
12198
|
-
rapFlag: info.rapFlag,
|
|
12199
|
-
priority: mfuDuHeader?.priority,
|
|
12200
|
-
sampleNumber: mfuDuHeader?.sampleNumber,
|
|
12201
|
-
movieFragmentSequenceNumber: mfuDuHeader?.movieFragmentSequenceNumber,
|
|
12202
|
-
sampleOffset: mfuDuHeader?.offset,
|
|
12203
|
-
packetSequenceNumber: info.sequenceNumber,
|
|
12204
|
-
recovered: options?.recovered === true,
|
|
12205
|
-
source: options?.source,
|
|
12206
|
-
deliveryProvenance: options?.deliveryProvenance,
|
|
12207
|
-
catalogTrackName: options?.catalogTrackName,
|
|
12208
|
-
packetId: info.packetId
|
|
12209
|
-
});
|
|
12210
|
-
} catch (error) {
|
|
12211
|
-
if (!isMfuReassemblyError(error)) throw error;
|
|
12212
|
-
console.warn(
|
|
12213
|
-
`[MmtpContainerParser] rejected MFU fragment: code=${error.code} mpu=${mpu.mpuSequenceNumber} fi=${mpu.fragmentationIndicator} counter=${mpu.fragmentCounter}`
|
|
12214
|
-
);
|
|
12215
|
-
return {
|
|
12216
|
-
kind: "rejected",
|
|
12217
|
-
packet: info,
|
|
12218
|
-
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12219
|
-
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12220
|
-
fragmentCounter: mpu.fragmentCounter,
|
|
12221
|
-
error: { code: error.code, message: error.message }
|
|
12222
|
-
};
|
|
12223
|
-
}
|
|
12224
|
-
if (!assembled) {
|
|
12225
|
-
return {
|
|
12226
|
-
kind: "pending",
|
|
12227
|
-
packet: info,
|
|
12228
|
-
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12229
|
-
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12230
|
-
fragmentCounter: mpu.fragmentCounter
|
|
12231
|
-
};
|
|
12232
|
-
}
|
|
12233
|
-
const movieFragmentSequenceNumber = assembled.movieFragmentSequenceNumber;
|
|
12234
|
-
const sampleNumber = assembled.sampleNumber;
|
|
12235
|
-
if (movieFragmentSequenceNumber === void 0 || sampleNumber === void 0) return null;
|
|
12236
|
-
if (!resolver.sampleTiming(
|
|
12237
|
-
assembled.mpuSequenceNumber,
|
|
12238
|
-
movieFragmentSequenceNumber,
|
|
12239
|
-
sampleNumber
|
|
12240
|
-
)) return null;
|
|
12241
|
-
if (assembled.mpuSequenceNumber !== mpu.mpuSequenceNumber) return null;
|
|
12242
|
-
let combined;
|
|
12217
|
+
__privateSet(this, _fedObjects, __privateGet(this, _fedObjects) + 1);
|
|
12218
|
+
let record;
|
|
12243
12219
|
try {
|
|
12244
|
-
|
|
12220
|
+
record = __privateMethod(this, _MmtpContainerParser_instances, feed_fn).call(this, packet, options);
|
|
12245
12221
|
} catch (error) {
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
`[MmtpContainerParser] rejected subsample data unit: code=${error.code} mpu=${assembled.mpuSequenceNumber} sample=${sampleNumber} offset=${assembled.sampleOffset ?? 0}`
|
|
12249
|
-
);
|
|
12250
|
-
return {
|
|
12251
|
-
kind: "rejected",
|
|
12252
|
-
packet: info,
|
|
12253
|
-
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12254
|
-
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12255
|
-
fragmentCounter: mpu.fragmentCounter,
|
|
12256
|
-
error: { code: error.code, message: error.message }
|
|
12257
|
-
};
|
|
12258
|
-
}
|
|
12259
|
-
if (!combined) {
|
|
12260
|
-
return {
|
|
12261
|
-
kind: "pending",
|
|
12262
|
-
packet: info,
|
|
12263
|
-
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12264
|
-
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12265
|
-
fragmentCounter: mpu.fragmentCounter
|
|
12266
|
-
};
|
|
12222
|
+
__privateMethod(this, _MmtpContainerParser_instances, countOutcome_fn).call(this, "drop:threw");
|
|
12223
|
+
throw error;
|
|
12267
12224
|
}
|
|
12268
|
-
|
|
12225
|
+
if (record) __privateMethod(this, _MmtpContainerParser_instances, countOutcome_fn).call(this, record.kind);
|
|
12226
|
+
return record;
|
|
12269
12227
|
}
|
|
12270
12228
|
onInit(cb) {
|
|
12271
12229
|
__privateSet(this, _initCb, cb);
|
|
@@ -12433,6 +12391,7 @@ _timingStreams = new WeakMap();
|
|
|
12433
12391
|
_maxPendingTimingSamples = new WeakMap();
|
|
12434
12392
|
_pendingTimingSamples = new WeakMap();
|
|
12435
12393
|
_reclaimedTimingSamples = new WeakMap();
|
|
12394
|
+
_evictedTimingSamples = new WeakMap();
|
|
12436
12395
|
_rejectedMovieFragments = new WeakMap();
|
|
12437
12396
|
_sequencers = new WeakMap();
|
|
12438
12397
|
_reorderWindow = new WeakMap();
|
|
@@ -12444,6 +12403,11 @@ _trackFrameCbs = new WeakMap();
|
|
|
12444
12403
|
_reorderStats = new WeakMap();
|
|
12445
12404
|
_reliableMoqStartupGate = new WeakMap();
|
|
12446
12405
|
_disposed2 = new WeakMap();
|
|
12406
|
+
_fedObjects = new WeakMap();
|
|
12407
|
+
_feedOutcomes = new WeakMap();
|
|
12408
|
+
_deferredFeedOutcomes = new WeakMap();
|
|
12409
|
+
_lastOutcome = new WeakMap();
|
|
12410
|
+
_lastOutcomeCount = new WeakMap();
|
|
12447
12411
|
_MmtpContainerParser_instances = new WeakSet();
|
|
12448
12412
|
streamKey_fn2 = function(packetId, catalogTrackName) {
|
|
12449
12413
|
return JSON.stringify([packetId, catalogTrackName ?? null]);
|
|
@@ -12462,12 +12426,12 @@ sampleCombinerFor_fn = function(streamKey) {
|
|
|
12462
12426
|
/**
|
|
12463
12427
|
* Return the timing budget slot of a sample the combiner abandoned.
|
|
12464
12428
|
*
|
|
12465
|
-
* Without this, `#pendingTimingSamples` is
|
|
12466
|
-
*
|
|
12467
|
-
*
|
|
12468
|
-
*
|
|
12469
|
-
*
|
|
12470
|
-
*
|
|
12429
|
+
* Without this, `#pendingTimingSamples` is charged for every sample a moof
|
|
12430
|
+
* declares but credited only when that sample is delivered, so each sample
|
|
12431
|
+
* lost to eviction or timeout burns a slot until the window displaces it.
|
|
12432
|
+
* Window displacement bounds that leak but only reclaims the OLDEST entries;
|
|
12433
|
+
* this path returns a slot the moment the combiner knows the sample is gone,
|
|
12434
|
+
* which keeps the live window as wide as the stream actually needs.
|
|
12471
12435
|
*
|
|
12472
12436
|
* The parser total is decremented only when the resolver reports it
|
|
12473
12437
|
* actually freed a slot, so a resolver already dropped by a track reset, or
|
|
@@ -12499,11 +12463,232 @@ dropSampleCombiner_fn = function(streamKey) {
|
|
|
12499
12463
|
__privateGet(this, _retiredSampleCombinerStats).evictedSamples += stats.evictedSamples;
|
|
12500
12464
|
__privateGet(this, _sampleCombiners).delete(streamKey);
|
|
12501
12465
|
};
|
|
12466
|
+
countOutcome_fn = function(token) {
|
|
12467
|
+
const count = (__privateGet(this, _feedOutcomes).get(token) ?? 0) + 1;
|
|
12468
|
+
__privateGet(this, _feedOutcomes).set(token, count);
|
|
12469
|
+
__privateSet(this, _lastOutcome, token);
|
|
12470
|
+
__privateSet(this, _lastOutcomeCount, count);
|
|
12471
|
+
};
|
|
12472
|
+
countDeferredOutcome_fn = function(reason) {
|
|
12473
|
+
__privateGet(this, _deferredFeedOutcomes).set(
|
|
12474
|
+
reason,
|
|
12475
|
+
(__privateGet(this, _deferredFeedOutcomes).get(reason) ?? 0) + 1
|
|
12476
|
+
);
|
|
12477
|
+
};
|
|
12478
|
+
/**
|
|
12479
|
+
* Count a feed() drop and return null in one expression, so every early
|
|
12480
|
+
* return inside feed() states the reason it took instead of collapsing into
|
|
12481
|
+
* a single failure bucket. Returns null so call sites stay `return this.#drop(...)`.
|
|
12482
|
+
*/
|
|
12483
|
+
drop_fn = function(reason) {
|
|
12484
|
+
__privateMethod(this, _MmtpContainerParser_instances, countOutcome_fn).call(this, `drop:${reason}`);
|
|
12485
|
+
return null;
|
|
12486
|
+
};
|
|
12487
|
+
feed_fn = function(packet, options) {
|
|
12488
|
+
var _a;
|
|
12489
|
+
if (__privateGet(this, _disposed2)) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "disposed");
|
|
12490
|
+
this.cleanupTimeouts();
|
|
12491
|
+
const info = this.parseHeader(packet, options);
|
|
12492
|
+
if (!info) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "header-parse-failed");
|
|
12493
|
+
if (info.packetType !== PACKET_TYPE_MPU2) {
|
|
12494
|
+
return {
|
|
12495
|
+
kind: info.isRepair ? "repair" : "non-media",
|
|
12496
|
+
packet: info,
|
|
12497
|
+
byteLength: packet.byteLength
|
|
12498
|
+
};
|
|
12499
|
+
}
|
|
12500
|
+
if (info.fecPayloadId !== null && __privateGet(this, _sourceSymbolCb)) {
|
|
12501
|
+
const rawSymbol = packet.subarray(0, packet.length - 4);
|
|
12502
|
+
const altaTrailer = extractAltaTrailer2(packet);
|
|
12503
|
+
const alta = altaTrailer ? { auth: altaTrailer.auth, payloadEnd: altaTrailer.signedEnd } : void 0;
|
|
12504
|
+
try {
|
|
12505
|
+
__privateGet(this, _sourceSymbolCb).call(this, info.packetId, info.fecPayloadId.ssId, rawSymbol, alta);
|
|
12506
|
+
} catch {
|
|
12507
|
+
}
|
|
12508
|
+
}
|
|
12509
|
+
const extraction = extractMFUPayload(packet, {
|
|
12510
|
+
skipFecId: options?.skipFecPayloadId
|
|
12511
|
+
});
|
|
12512
|
+
if (!extraction) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "mfu-extract-failed");
|
|
12513
|
+
const { mpu, fragmentType, data, mfuDuHeader } = extraction;
|
|
12514
|
+
if (mpu.timedFlag !== 1) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "untimed-mpu");
|
|
12515
|
+
const streamKey = __privateMethod(this, _MmtpContainerParser_instances, streamKey_fn2).call(this, info.packetId, options?.catalogTrackName);
|
|
12516
|
+
if (fragmentType === 0) {
|
|
12517
|
+
if (mpu.fragmentationIndicator !== 0 || mpu.fragmentCounter !== 0)
|
|
12518
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "init-unexpected-fragmentation");
|
|
12519
|
+
const normalizedInit = normalizeMmtpInitSegment(data);
|
|
12520
|
+
if (!normalizedInit) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "init-normalize-failed");
|
|
12521
|
+
const resolver2 = __privateMethod(this, _MmtpContainerParser_instances, timingResolver_fn).call(this, streamKey, info.packetId, true);
|
|
12522
|
+
if (!resolver2?.addInitialization(normalizedInit)) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "init-timing-refused");
|
|
12523
|
+
(_a = __privateGet(this, _initCb)) == null ? void 0 : _a.call(this, normalizedInit, info.packetId, options?.catalogTrackName);
|
|
12524
|
+
return {
|
|
12525
|
+
kind: "init",
|
|
12526
|
+
packet: info,
|
|
12527
|
+
data: normalizedInit,
|
|
12528
|
+
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12529
|
+
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12530
|
+
fragmentCounter: mpu.fragmentCounter
|
|
12531
|
+
};
|
|
12532
|
+
}
|
|
12533
|
+
if (fragmentType === 1) {
|
|
12534
|
+
if (mpu.fragmentationIndicator !== 0 || mpu.fragmentCounter !== 0)
|
|
12535
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "fragment-unexpected-fragmentation");
|
|
12536
|
+
const resolver2 = __privateMethod(this, _MmtpContainerParser_instances, timingResolver_fn).call(this, streamKey, info.packetId, false);
|
|
12537
|
+
if (!resolver2) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "fragment-no-resolver");
|
|
12538
|
+
const pendingBefore = resolver2.pendingSampleCount;
|
|
12539
|
+
const evictedBefore = resolver2.evictedSampleCount;
|
|
12540
|
+
const remaining = __privateGet(this, _maxPendingTimingSamples) - __privateGet(this, _pendingTimingSamples);
|
|
12541
|
+
const admitted = resolver2.addMovieFragment(mpu.mpuSequenceNumber, data, remaining);
|
|
12542
|
+
__privateSet(this, _pendingTimingSamples, __privateGet(this, _pendingTimingSamples) + (resolver2.pendingSampleCount - pendingBefore));
|
|
12543
|
+
__privateSet(this, _evictedTimingSamples, __privateGet(this, _evictedTimingSamples) + (resolver2.evictedSampleCount - evictedBefore));
|
|
12544
|
+
if (!admitted) {
|
|
12545
|
+
if (resolver2.lastMovieFragmentRejection === "budget") {
|
|
12546
|
+
__privateWrapper(this, _rejectedMovieFragments)._++;
|
|
12547
|
+
}
|
|
12548
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "fragment-timing-refused");
|
|
12549
|
+
}
|
|
12550
|
+
return {
|
|
12551
|
+
kind: "fragment",
|
|
12552
|
+
packet: info,
|
|
12553
|
+
data,
|
|
12554
|
+
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12555
|
+
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12556
|
+
fragmentCounter: mpu.fragmentCounter
|
|
12557
|
+
};
|
|
12558
|
+
}
|
|
12559
|
+
if (fragmentType !== 2) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "unknown-fragment-type");
|
|
12560
|
+
const resolver = __privateMethod(this, _MmtpContainerParser_instances, timingResolver_fn).call(this, streamKey, info.packetId, false);
|
|
12561
|
+
if (!resolver) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "mfu-no-resolver");
|
|
12562
|
+
if (!Number.isSafeInteger(data.byteLength) || data.byteLength <= 0)
|
|
12563
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "mfu-empty-payload");
|
|
12564
|
+
if (mpu.fragmentationIndicator === 0 || mpu.fragmentationIndicator === 1) {
|
|
12565
|
+
if (!mfuDuHeader || mfuDuHeader.movieFragmentSequenceNumber === 0 || mfuDuHeader.sampleNumber === 0) {
|
|
12566
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "mfu-du-header-missing");
|
|
12567
|
+
}
|
|
12568
|
+
const headTiming = resolver.sampleTiming(
|
|
12569
|
+
mpu.mpuSequenceNumber,
|
|
12570
|
+
mfuDuHeader.movieFragmentSequenceNumber,
|
|
12571
|
+
mfuDuHeader.sampleNumber
|
|
12572
|
+
);
|
|
12573
|
+
if (!headTiming) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "mfu-sample-timing-missing");
|
|
12574
|
+
const offset = mfuDuHeader.offset;
|
|
12575
|
+
if (!Number.isSafeInteger(offset) || offset < 0 || offset >= headTiming.size)
|
|
12576
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "mfu-offset-out-of-range");
|
|
12577
|
+
const remaining = headTiming.size - offset;
|
|
12578
|
+
if (mpu.fragmentationIndicator === 0 && data.byteLength !== remaining)
|
|
12579
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "mfu-size-mismatch");
|
|
12580
|
+
if (mpu.fragmentationIndicator === 1 && data.byteLength >= remaining)
|
|
12581
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "mfu-size-mismatch");
|
|
12582
|
+
const readyOnRegister = __privateMethod(this, _MmtpContainerParser_instances, sampleCombinerFor_fn).call(this, streamKey).registerAuthoredSize(
|
|
12583
|
+
options?.catalogTrackName,
|
|
12584
|
+
mpu.mpuSequenceNumber,
|
|
12585
|
+
mfuDuHeader.movieFragmentSequenceNumber,
|
|
12586
|
+
mfuDuHeader.sampleNumber,
|
|
12587
|
+
headTiming.size
|
|
12588
|
+
);
|
|
12589
|
+
if (readyOnRegister) {
|
|
12590
|
+
const deferred = __privateMethod(this, _MmtpContainerParser_instances, emitCombinedSample_fn).call(this, readyOnRegister, info, resolver, options?.recovered === true);
|
|
12591
|
+
if (deferred.record === void 0) __privateMethod(this, _MmtpContainerParser_instances, countDeferredOutcome_fn).call(this, deferred.reason);
|
|
12592
|
+
}
|
|
12593
|
+
}
|
|
12594
|
+
let assembled;
|
|
12595
|
+
try {
|
|
12596
|
+
assembled = __privateGet(this, _reassembler).addFragment({
|
|
12597
|
+
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12598
|
+
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12599
|
+
fragmentCounter: mpu.fragmentCounter,
|
|
12600
|
+
data,
|
|
12601
|
+
timestamp: info.timestamp,
|
|
12602
|
+
rapFlag: info.rapFlag,
|
|
12603
|
+
priority: mfuDuHeader?.priority,
|
|
12604
|
+
sampleNumber: mfuDuHeader?.sampleNumber,
|
|
12605
|
+
movieFragmentSequenceNumber: mfuDuHeader?.movieFragmentSequenceNumber,
|
|
12606
|
+
sampleOffset: mfuDuHeader?.offset,
|
|
12607
|
+
packetSequenceNumber: info.sequenceNumber,
|
|
12608
|
+
recovered: options?.recovered === true,
|
|
12609
|
+
source: options?.source,
|
|
12610
|
+
deliveryProvenance: options?.deliveryProvenance,
|
|
12611
|
+
catalogTrackName: options?.catalogTrackName,
|
|
12612
|
+
packetId: info.packetId
|
|
12613
|
+
});
|
|
12614
|
+
} catch (error) {
|
|
12615
|
+
if (!isMfuReassemblyError(error)) throw error;
|
|
12616
|
+
console.warn(
|
|
12617
|
+
`[MmtpContainerParser] rejected MFU fragment: code=${error.code} mpu=${mpu.mpuSequenceNumber} fi=${mpu.fragmentationIndicator} counter=${mpu.fragmentCounter}`
|
|
12618
|
+
);
|
|
12619
|
+
return {
|
|
12620
|
+
kind: "rejected",
|
|
12621
|
+
packet: info,
|
|
12622
|
+
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12623
|
+
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12624
|
+
fragmentCounter: mpu.fragmentCounter,
|
|
12625
|
+
error: { code: error.code, message: error.message }
|
|
12626
|
+
};
|
|
12627
|
+
}
|
|
12628
|
+
if (!assembled) {
|
|
12629
|
+
return {
|
|
12630
|
+
kind: "pending",
|
|
12631
|
+
packet: info,
|
|
12632
|
+
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12633
|
+
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12634
|
+
fragmentCounter: mpu.fragmentCounter
|
|
12635
|
+
};
|
|
12636
|
+
}
|
|
12637
|
+
const movieFragmentSequenceNumber = assembled.movieFragmentSequenceNumber;
|
|
12638
|
+
const sampleNumber = assembled.sampleNumber;
|
|
12639
|
+
if (movieFragmentSequenceNumber === void 0 || sampleNumber === void 0)
|
|
12640
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "assembled-identity-missing");
|
|
12641
|
+
if (!resolver.sampleTiming(
|
|
12642
|
+
assembled.mpuSequenceNumber,
|
|
12643
|
+
movieFragmentSequenceNumber,
|
|
12644
|
+
sampleNumber
|
|
12645
|
+
)) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "assembled-timing-missing");
|
|
12646
|
+
if (assembled.mpuSequenceNumber !== mpu.mpuSequenceNumber)
|
|
12647
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "assembled-mpu-mismatch");
|
|
12648
|
+
let combined;
|
|
12649
|
+
try {
|
|
12650
|
+
combined = __privateMethod(this, _MmtpContainerParser_instances, sampleCombinerFor_fn).call(this, streamKey).addMfu(assembled);
|
|
12651
|
+
} catch (error) {
|
|
12652
|
+
if (!(error instanceof SampleCombineError)) throw error;
|
|
12653
|
+
console.warn(
|
|
12654
|
+
`[MmtpContainerParser] rejected subsample data unit: code=${error.code} mpu=${assembled.mpuSequenceNumber} sample=${sampleNumber} offset=${assembled.sampleOffset ?? 0}`
|
|
12655
|
+
);
|
|
12656
|
+
return {
|
|
12657
|
+
kind: "rejected",
|
|
12658
|
+
packet: info,
|
|
12659
|
+
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12660
|
+
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12661
|
+
fragmentCounter: mpu.fragmentCounter,
|
|
12662
|
+
error: { code: error.code, message: error.message }
|
|
12663
|
+
};
|
|
12664
|
+
}
|
|
12665
|
+
if (!combined) {
|
|
12666
|
+
return {
|
|
12667
|
+
kind: "pending",
|
|
12668
|
+
packet: info,
|
|
12669
|
+
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
12670
|
+
fragmentationIndicator: mpu.fragmentationIndicator,
|
|
12671
|
+
fragmentCounter: mpu.fragmentCounter
|
|
12672
|
+
};
|
|
12673
|
+
}
|
|
12674
|
+
const outcome = __privateMethod(this, _MmtpContainerParser_instances, emitCombinedSample_fn).call(this, combined, info, resolver, options?.recovered === true);
|
|
12675
|
+
if (outcome.record !== void 0) return outcome.record;
|
|
12676
|
+
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, outcome.reason);
|
|
12677
|
+
};
|
|
12502
12678
|
/**
|
|
12503
12679
|
* Deliver one combined sample: resolve its authored timing, build frame
|
|
12504
12680
|
* metadata, retire the timing entry, and route it. Shared by the ordinary
|
|
12505
12681
|
* completion path and by the rarer completion that falls out of registering
|
|
12506
12682
|
* an authored size for data units that arrived before it.
|
|
12683
|
+
*
|
|
12684
|
+
* Reports a refusal as a reason rather than counting it, because the two
|
|
12685
|
+
* call sites owe different accounting. On `#feed()`'s tail return the
|
|
12686
|
+
* refusal *is* that feed()'s outcome and must be attributed; on the
|
|
12687
|
+
* register-completion path it belongs to an earlier sample while this
|
|
12688
|
+
* packet's own fragment continues to its own outcome, so counting it there
|
|
12689
|
+
* would push `outcomes` past `fedObjects` — the very invariant the
|
|
12690
|
+
* attribution exists to keep readable. Leaving the choice at the call site
|
|
12691
|
+
* is what keeps both true.
|
|
12507
12692
|
*/
|
|
12508
12693
|
emitCombinedSample_fn = function(combined, info, resolver, recovered) {
|
|
12509
12694
|
const timing = resolver.sampleTiming(
|
|
@@ -12511,27 +12696,29 @@ emitCombinedSample_fn = function(combined, info, resolver, recovered) {
|
|
|
12511
12696
|
combined.movieFragmentSequenceNumber,
|
|
12512
12697
|
combined.sampleNumber
|
|
12513
12698
|
);
|
|
12514
|
-
if (!timing) return
|
|
12515
|
-
if (combined.data.byteLength !== timing.size) return
|
|
12699
|
+
if (!timing) return { reason: "combined-timing-missing" };
|
|
12700
|
+
if (combined.data.byteLength !== timing.size) return { reason: "combined-size-mismatch" };
|
|
12516
12701
|
const meta = __privateMethod(this, _MmtpContainerParser_instances, buildFrameMeta_fn).call(this, combined, info.packetId, info.sequenceNumber, timing, recovered);
|
|
12517
|
-
if (!meta) return
|
|
12702
|
+
if (!meta) return { reason: "combined-meta-build-failed" };
|
|
12518
12703
|
if (!resolver.consumeSample(
|
|
12519
12704
|
combined.mpuSequenceNumber,
|
|
12520
12705
|
combined.movieFragmentSequenceNumber,
|
|
12521
12706
|
combined.sampleNumber,
|
|
12522
12707
|
timing
|
|
12523
|
-
)) return
|
|
12708
|
+
)) return { reason: "combined-timing-consume-refused" };
|
|
12524
12709
|
__privateWrapper(this, _pendingTimingSamples)._--;
|
|
12525
12710
|
this.routeFrame(combined.data, meta);
|
|
12526
12711
|
return {
|
|
12527
|
-
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12712
|
+
record: {
|
|
12713
|
+
kind: "frame",
|
|
12714
|
+
packet: info,
|
|
12715
|
+
data: combined.data,
|
|
12716
|
+
meta,
|
|
12717
|
+
mpuSequenceNumber: combined.mpuSequenceNumber,
|
|
12718
|
+
fragmentCount: combined.fragmentCount,
|
|
12719
|
+
rapFlag: combined.rapFlag,
|
|
12720
|
+
...combined.priority === void 0 ? {} : { priority: combined.priority }
|
|
12721
|
+
}
|
|
12535
12722
|
};
|
|
12536
12723
|
};
|
|
12537
12724
|
/** Order-independent reliable-moq startup gate: discard delta frames for a
|
|
@@ -13364,6 +13551,7 @@ var MmtpRouter = class {
|
|
|
13364
13551
|
);
|
|
13365
13552
|
}
|
|
13366
13553
|
const repairSbn = __privateMethod(this, _MmtpRouter_instances, deriveRepairSbn_fn).call(this, parsed.ssStart, parsed.ssbLength, ownerPacketId);
|
|
13554
|
+
if (repairSbn === null) return;
|
|
13367
13555
|
const repairEsi = __privateMethod(this, _MmtpRouter_instances, kForPacket_fn).call(this, ownerPacketId) + parsed.rsId;
|
|
13368
13556
|
if (!__privateMethod(this, _MmtpRouter_instances, feedFecTransportSymbol_fn).call(this, ownerPacketId, repairSbn, repairEsi, parsed.repairData, "moq", catalogTrackName)) return;
|
|
13369
13557
|
const recovered = catalogTrackName === void 0 ? __privateGet(this, _fecManager).feedRepairSymbol(
|
|
@@ -13394,7 +13582,7 @@ var MmtpRouter = class {
|
|
|
13394
13582
|
} else {
|
|
13395
13583
|
__privateGet(this, _fecManager).markBlockCompleted(repairSbn, ownerPacketId, catalogTrackName);
|
|
13396
13584
|
}
|
|
13397
|
-
__privateMethod(this, _MmtpRouter_instances, routeRecoveredBlock_fn).call(this, repairSbn, recovered, ownerPacketId,
|
|
13585
|
+
__privateMethod(this, _MmtpRouter_instances, routeRecoveredBlock_fn).call(this, repairSbn, recovered, ownerPacketId, catalogTrackName);
|
|
13398
13586
|
}
|
|
13399
13587
|
}
|
|
13400
13588
|
}
|
|
@@ -13402,7 +13590,7 @@ var MmtpRouter = class {
|
|
|
13402
13590
|
/** Route a recovered FEC block through the parser + dedup pipeline.
|
|
13403
13591
|
* Sync WASM decoders return K fixed-width source symbols concatenated. */
|
|
13404
13592
|
routeRecoveredBlock(blockId, data, packetId, catalogTrackName) {
|
|
13405
|
-
__privateMethod(this, _MmtpRouter_instances, routeRecoveredBlock_fn).call(this, blockId, data, packetId,
|
|
13593
|
+
__privateMethod(this, _MmtpRouter_instances, routeRecoveredBlock_fn).call(this, blockId, data, packetId, catalogTrackName);
|
|
13406
13594
|
}
|
|
13407
13595
|
/** Route a single recovered source symbol through the parser + dedup pipeline.
|
|
13408
13596
|
* Worker-backed decoders emit one padded source symbol per frame event. */
|
|
@@ -13561,8 +13749,9 @@ deriveSbnEsi_fn = function(ssId, packetId) {
|
|
|
13561
13749
|
return { sbn: Math.floor(ssId / k), esi: ssId % k };
|
|
13562
13750
|
};
|
|
13563
13751
|
deriveRepairSbn_fn = function(ssStart, ssbLength, packetId) {
|
|
13564
|
-
|
|
13565
|
-
|
|
13752
|
+
const k = __privateMethod(this, _MmtpRouter_instances, kForPacket_fn).call(this, packetId);
|
|
13753
|
+
if (ssbLength <= 0 || ssbLength > k || ssStart % k !== 0) return null;
|
|
13754
|
+
return Math.floor(ssStart / k);
|
|
13566
13755
|
};
|
|
13567
13756
|
resolveRepairOwnerPacketId_fn = function(packetId, ingress) {
|
|
13568
13757
|
if (__privateMethod(this, _MmtpRouter_instances, classifyPacketId_fn).call(this, packetId) !== null) return packetId;
|
|
@@ -13721,6 +13910,7 @@ processMMTP_fn = function(packet, source, manifestIdentity, manifestAdmitted = f
|
|
|
13721
13910
|
);
|
|
13722
13911
|
}
|
|
13723
13912
|
const repairSbn = __privateMethod(this, _MmtpRouter_instances, deriveRepairSbn_fn).call(this, parsed.ssStart, parsed.ssbLength, ownerPacketId);
|
|
13913
|
+
if (repairSbn === null) return;
|
|
13724
13914
|
const repairEsi = __privateMethod(this, _MmtpRouter_instances, kForPacket_fn).call(this, ownerPacketId) + parsed.rsId;
|
|
13725
13915
|
if (!__privateMethod(this, _MmtpRouter_instances, feedFecTransportSymbol_fn).call(this, ownerPacketId, repairSbn, repairEsi, parsed.repairData, source, catalogTrackNameForPacket(ingress, ownerPacketId))) return;
|
|
13726
13916
|
const repairCatalogTrackName = catalogTrackNameForPacket(ingress, ownerPacketId);
|
|
@@ -13773,7 +13963,7 @@ processMMTP_fn = function(packet, source, manifestIdentity, manifestAdmitted = f
|
|
|
13773
13963
|
repairCatalogTrackName
|
|
13774
13964
|
);
|
|
13775
13965
|
}
|
|
13776
|
-
__privateMethod(this, _MmtpRouter_instances, routeRecoveredBlock_fn).call(this, repairSbn, recovered, ownerPacketId,
|
|
13966
|
+
__privateMethod(this, _MmtpRouter_instances, routeRecoveredBlock_fn).call(this, repairSbn, recovered, ownerPacketId, catalogTrackNameForPacket(ingress, ownerPacketId));
|
|
13777
13967
|
}
|
|
13778
13968
|
}
|
|
13779
13969
|
}
|
|
@@ -13889,7 +14079,7 @@ processMMTP_fn = function(packet, source, manifestIdentity, manifestAdmitted = f
|
|
|
13889
14079
|
catalogTrackName
|
|
13890
14080
|
);
|
|
13891
14081
|
}
|
|
13892
|
-
__privateMethod(this, _MmtpRouter_instances, routeRecoveredBlock_fn).call(this, sourceFec.sbn, recovered, info.packetId,
|
|
14082
|
+
__privateMethod(this, _MmtpRouter_instances, routeRecoveredBlock_fn).call(this, sourceFec.sbn, recovered, info.packetId, catalogTrackName);
|
|
13893
14083
|
}
|
|
13894
14084
|
}
|
|
13895
14085
|
}
|
|
@@ -14237,8 +14427,8 @@ routeDirectRecoveredAudio_fn = function(packetId, data, meta, cb) {
|
|
|
14237
14427
|
};
|
|
14238
14428
|
// ── Private: FEC recovery routing ───────────────────────────────
|
|
14239
14429
|
/** Route WASM-recovered block through appropriate path based on container kind. */
|
|
14240
|
-
routeRecoveredBlock_fn = function(blockId, recovered, ownerPacketId,
|
|
14241
|
-
const k =
|
|
14430
|
+
routeRecoveredBlock_fn = function(blockId, recovered, ownerPacketId, catalogTrackName) {
|
|
14431
|
+
const k = __privateMethod(this, _MmtpRouter_instances, kForPacket_fn).call(this, ownerPacketId);
|
|
14242
14432
|
const packetSymbolSize = __privateMethod(this, _MmtpRouter_instances, symbolSizeForPacket_fn).call(this, ownerPacketId);
|
|
14243
14433
|
const symbolSize = packetSymbolSize > 0 ? packetSymbolSize : void 0;
|
|
14244
14434
|
const result = processFecBlock(recovered, {
|
|
@@ -14319,7 +14509,11 @@ admitRecoveredResult_fn = function(blockId, result, ownerPacketId, catalogTrackN
|
|
|
14319
14509
|
__privateMethod(this, _MmtpRouter_instances, routeProcessedFecSymbols_fn).call(this, blockId, { ...result, symbols: [symbol] }, ownerPacketId, catalogTrackName);
|
|
14320
14510
|
}
|
|
14321
14511
|
admitNext(index + 1);
|
|
14322
|
-
}
|
|
14512
|
+
},
|
|
14513
|
+
// A stalled symbol that is later discarded instead of played must still
|
|
14514
|
+
// advance this loop; enforce mode never calls the release callback for
|
|
14515
|
+
// it (BLO-30095).
|
|
14516
|
+
() => admitNext(index + 1)
|
|
14323
14517
|
);
|
|
14324
14518
|
if (admission.action === "drop") admitNext(index + 1);
|
|
14325
14519
|
};
|
|
@@ -15092,12 +15286,16 @@ var driadDiscovery = new DRIADDiscovery();
|
|
|
15092
15286
|
function endpointKey(endpoint) {
|
|
15093
15287
|
return `${endpoint.sourceAddress ?? ""}|${endpoint.groupAddress}|${endpoint.port}`;
|
|
15094
15288
|
}
|
|
15289
|
+
function carriesMedia(endpoint) {
|
|
15290
|
+
return endpoint.carriesMedia !== false;
|
|
15291
|
+
}
|
|
15095
15292
|
function selectMulticastTier(endpoints, estimate) {
|
|
15096
|
-
|
|
15097
|
-
|
|
15098
|
-
|
|
15293
|
+
const media = endpoints.filter(carriesMedia);
|
|
15294
|
+
if (media.length <= 1)
|
|
15295
|
+
return media[0];
|
|
15296
|
+
const ranked = media.filter((endpoint) => typeof endpoint.bandwidth === "number" && endpoint.bandwidth > 0).sort((a, b) => a.bandwidth - b.bandwidth);
|
|
15099
15297
|
if (ranked.length < 2)
|
|
15100
|
-
return
|
|
15298
|
+
return media[0];
|
|
15101
15299
|
if (estimate === void 0)
|
|
15102
15300
|
return ranked[0];
|
|
15103
15301
|
const budget = estimate * 0.8;
|
|
@@ -15346,7 +15544,7 @@ var MulticastOrchestrator = class {
|
|
|
15346
15544
|
const currentBandwidth = __privateGet(this, _current).bandwidth;
|
|
15347
15545
|
if (typeof currentBandwidth !== "number")
|
|
15348
15546
|
return void 0;
|
|
15349
|
-
const desired = this.options.endpoints.filter((endpoint) => typeof endpoint.bandwidth === "number" && endpoint.bandwidth > currentBandwidth).sort((a, b) => a.bandwidth - b.bandwidth)[0];
|
|
15547
|
+
const desired = this.options.endpoints.filter((endpoint) => carriesMedia(endpoint) && typeof endpoint.bandwidth === "number" && endpoint.bandwidth > currentBandwidth).sort((a, b) => a.bandwidth - b.bandwidth)[0];
|
|
15350
15548
|
if (!desired) {
|
|
15351
15549
|
__privateSet(this, _favored, void 0);
|
|
15352
15550
|
return void 0;
|
|
@@ -16277,6 +16475,14 @@ function getMulticastGlobals() {
|
|
|
16277
16475
|
function hasMulticastGateway() {
|
|
16278
16476
|
return typeof getMulticastGlobals().multicast?.subscribe === "function";
|
|
16279
16477
|
}
|
|
16478
|
+
function normalizeBytesEventDetail(detail) {
|
|
16479
|
+
const value = detail && typeof detail === "object" && "data" in detail ? detail.data : detail;
|
|
16480
|
+
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
|
16481
|
+
if (ArrayBuffer.isView(value)) {
|
|
16482
|
+
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
16483
|
+
}
|
|
16484
|
+
return null;
|
|
16485
|
+
}
|
|
16280
16486
|
var _onPacket, _subscription2, _bytesListener, _resolvedTransport, _videoConfirmed, _audioConfirmed, _watchdog, _failbackWindowMs, _onTakeover, _onFailback, _disposed4, _stats3, _droppedPidCounts, _packetIds, _joinGeneration, _MulticastTransport_instances, releaseSubscription_fn, acceptPacket_fn, recordUnregisteredPidDrop_fn, checkTakeover_fn, resetWatchdog_fn;
|
|
16281
16487
|
var _MulticastTransport = class _MulticastTransport {
|
|
16282
16488
|
constructor(onPacket) {
|
|
@@ -16343,8 +16549,11 @@ var _MulticastTransport = class _MulticastTransport {
|
|
|
16343
16549
|
}
|
|
16344
16550
|
const onBytes = (event) => {
|
|
16345
16551
|
if (__privateGet(this, _disposed4) || generation !== __privateGet(this, _joinGeneration)) return;
|
|
16346
|
-
const
|
|
16347
|
-
|
|
16552
|
+
const packet = normalizeBytesEventDetail(event.detail);
|
|
16553
|
+
if (!packet) {
|
|
16554
|
+
__privateGet(this, _stats3).packetsDroppedUnparseable++;
|
|
16555
|
+
return;
|
|
16556
|
+
}
|
|
16348
16557
|
if (!__privateMethod(this, _MulticastTransport_instances, acceptPacket_fn).call(this, packet)) return;
|
|
16349
16558
|
__privateGet(this, _stats3).packetsReceived++;
|
|
16350
16559
|
__privateGet(this, _stats3).bytesReceived += packet.byteLength;
|
|
@@ -16641,6 +16850,24 @@ function publishFecDiagnostics(packetId, stats) {
|
|
|
16641
16850
|
function altGroupKey(track) {
|
|
16642
16851
|
return track.altGroup === void 0 ? DEFAULT_ALT_GROUP : String(track.altGroup);
|
|
16643
16852
|
}
|
|
16853
|
+
function repairTrackNamesBySource(tracks) {
|
|
16854
|
+
const bySource = /* @__PURE__ */ new Map();
|
|
16855
|
+
const add = (source, repair) => {
|
|
16856
|
+
if (!source || !repair) return;
|
|
16857
|
+
const names = bySource.get(source) ?? /* @__PURE__ */ new Set();
|
|
16858
|
+
names.add(repair);
|
|
16859
|
+
bySource.set(source, names);
|
|
16860
|
+
};
|
|
16861
|
+
for (const track of tracks) {
|
|
16862
|
+
if (track.fec !== void 0 && isFecCatalogConfig(track.fec) && track.fec.repairTrack) {
|
|
16863
|
+
add(track.name, track.fec.repairTrack);
|
|
16864
|
+
}
|
|
16865
|
+
if (track.packaging === "fec-repair" && Array.isArray(track.depends) && track.depends.length === 1) {
|
|
16866
|
+
add(track.depends[0], track.name);
|
|
16867
|
+
}
|
|
16868
|
+
}
|
|
16869
|
+
return bySource;
|
|
16870
|
+
}
|
|
16644
16871
|
var _fec, _router, _transport, _reportedFecDiagnosticsFailure, _streamFecBaseline, _trackFecTiming, _switchingSets, _repairPacketIds, _repairInFlight, _repairLifecycleObservers, _trackResetObservers, _onRepairSubscribeCb, _MulticastManager_instances, configureTrackMapper_fn, applyStreamGlobalFecTiming_fn, _onTrackTypeDiscovered, emitRepairLifecycle_fn;
|
|
16645
16872
|
var MulticastManager = class {
|
|
16646
16873
|
constructor(options) {
|
|
@@ -17101,34 +17328,36 @@ var MulticastManager = class {
|
|
|
17101
17328
|
* a factory returning a distinct decoder per stream.
|
|
17102
17329
|
*/
|
|
17103
17330
|
configureMultiTrack(catalog, wasmDecoderSource) {
|
|
17104
|
-
const
|
|
17331
|
+
const repairNamesBySource = repairTrackNamesBySource(catalog.tracks);
|
|
17332
|
+
const repairOwnerGroup = /* @__PURE__ */ new Map();
|
|
17333
|
+
const repairOwnerAltGroup = /* @__PURE__ */ new Map();
|
|
17334
|
+
for (const track of catalog.tracks) {
|
|
17335
|
+
for (const repairName of repairNamesBySource.get(track.name) ?? []) {
|
|
17336
|
+
repairOwnerGroup.set(repairName, altGroupKey(track));
|
|
17337
|
+
repairOwnerAltGroup.set(repairName, track.altGroup);
|
|
17338
|
+
}
|
|
17339
|
+
}
|
|
17340
|
+
const groupKeyFor = (track) => repairOwnerGroup.get(track.name) ?? altGroupKey(track);
|
|
17105
17341
|
const trackNamesByGroup = /* @__PURE__ */ new Map();
|
|
17106
17342
|
for (const track of catalog.tracks) {
|
|
17107
|
-
const groupKey =
|
|
17343
|
+
const groupKey = groupKeyFor(track);
|
|
17108
17344
|
const groupNames = trackNamesByGroup.get(groupKey) ?? [];
|
|
17109
17345
|
groupNames.push(track.name);
|
|
17110
17346
|
trackNamesByGroup.set(groupKey, groupNames);
|
|
17111
|
-
if (track.fec !== void 0 && isFecCatalogConfig(track.fec) && track.fec.repairTrack) {
|
|
17112
|
-
const explicitRepairNames = explicitRepairNamesByGroup.get(groupKey) ?? /* @__PURE__ */ new Set();
|
|
17113
|
-
explicitRepairNames.add(track.fec.repairTrack);
|
|
17114
|
-
explicitRepairNamesByGroup.set(groupKey, explicitRepairNames);
|
|
17115
|
-
}
|
|
17116
17347
|
}
|
|
17117
17348
|
const hasSwitchingSetByGroup = /* @__PURE__ */ new Map();
|
|
17118
17349
|
for (const [groupKey, trackNames] of trackNamesByGroup) {
|
|
17119
17350
|
hasSwitchingSetByGroup.set(groupKey, hasSwitchingSetRole(trackNames));
|
|
17120
17351
|
}
|
|
17121
17352
|
const resolvedRoles = catalog.tracks.map((track) => {
|
|
17122
|
-
|
|
17123
|
-
const hasSwitchingSet = hasSwitchingSetByGroup.get(
|
|
17124
|
-
const explicitRepairNames = explicitRepairNamesByGroup.get(groupKey);
|
|
17125
|
-
if (explicitRepairNames?.has(track.name)) return "repair";
|
|
17353
|
+
if (repairOwnerGroup.has(track.name)) return "repair";
|
|
17354
|
+
const hasSwitchingSet = hasSwitchingSetByGroup.get(altGroupKey(track)) ?? false;
|
|
17126
17355
|
if (!hasSwitchingSet) return "single";
|
|
17127
17356
|
return parseTrackRole(track.name);
|
|
17128
17357
|
});
|
|
17129
17358
|
const resolvedRolesByGroup = /* @__PURE__ */ new Map();
|
|
17130
17359
|
for (let i = 0; i < catalog.tracks.length; i++) {
|
|
17131
|
-
const groupKey =
|
|
17360
|
+
const groupKey = groupKeyFor(catalog.tracks[i]);
|
|
17132
17361
|
const roles = resolvedRolesByGroup.get(groupKey) ?? [];
|
|
17133
17362
|
roles.push(resolvedRoles[i]);
|
|
17134
17363
|
resolvedRolesByGroup.set(groupKey, roles);
|
|
@@ -17191,10 +17420,11 @@ var MulticastManager = class {
|
|
|
17191
17420
|
for (let i = 0; i < catalog.tracks.length; i++) {
|
|
17192
17421
|
const track = catalog.tracks[i];
|
|
17193
17422
|
const role = resolvedRoles[i];
|
|
17194
|
-
|
|
17195
|
-
|
|
17423
|
+
const altGroup = repairOwnerAltGroup.has(track.name) ? repairOwnerAltGroup.get(track.name) : track.altGroup;
|
|
17424
|
+
if (altGroup !== void 0) {
|
|
17425
|
+
const existing = __privateGet(this, _switchingSets).get(altGroup) ?? [];
|
|
17196
17426
|
existing.push(track.name);
|
|
17197
|
-
__privateGet(this, _switchingSets).set(
|
|
17427
|
+
__privateGet(this, _switchingSets).set(altGroup, existing);
|
|
17198
17428
|
}
|
|
17199
17429
|
if (track.packetId !== void 0) {
|
|
17200
17430
|
__privateGet(this, _router).setPacketIdRole(track.packetId, role);
|
|
@@ -17207,9 +17437,13 @@ var MulticastManager = class {
|
|
|
17207
17437
|
}
|
|
17208
17438
|
if (track.fec !== void 0) {
|
|
17209
17439
|
const fecCfg = track.fec;
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17440
|
+
if (track.packetId !== void 0) {
|
|
17441
|
+
for (const repairName of repairNamesBySource.get(track.name) ?? []) {
|
|
17442
|
+
const repairTrack = catalogTracksByName.get(repairName);
|
|
17443
|
+
if (repairTrack?.packetId !== void 0) {
|
|
17444
|
+
__privateGet(this, _router).setRepairPacketIdOwner(repairTrack.packetId, track.packetId);
|
|
17445
|
+
}
|
|
17446
|
+
}
|
|
17213
17447
|
}
|
|
17214
17448
|
const wasmDecoder = fecDecoders.get(i);
|
|
17215
17449
|
if (track.packetId !== void 0 && wasmDecoder !== void 0) {
|
|
@@ -17499,7 +17733,9 @@ async function setupFecWorkerForTrack(opts) {
|
|
|
17499
17733
|
sampleRate: opts.sampleRate,
|
|
17500
17734
|
algorithm: "raptor",
|
|
17501
17735
|
k: opts.fecK,
|
|
17502
|
-
|
|
17736
|
+
// P as this receiver joined it, not the catalog total: the worker snapshot
|
|
17737
|
+
// and CMCD `x-bc-fec-p` are read from this. Identity on a single layer.
|
|
17738
|
+
repairCount: opts.joinedRepairCount ?? opts.fecRepairCount,
|
|
17503
17739
|
symbolSize: opts.fecSymbolSize,
|
|
17504
17740
|
interleaveDepth: interleaveDepthBlocks,
|
|
17505
17741
|
interleaveMs: opts.fecInterleaveMs,
|
|
@@ -18422,7 +18658,7 @@ _readIndex = new WeakMap();
|
|
|
18422
18658
|
_stalled = new WeakMap();
|
|
18423
18659
|
|
|
18424
18660
|
// src/mmtp-decode-pipeline.ts
|
|
18425
|
-
var _parser2, _fecClient, _frameCb2, _initCb2, _needsKeyframe, _codec, _trackType, _gateDropped, _gateEmitted,
|
|
18661
|
+
var _parser2, _fecClient, _frameCb2, _initCb2, _needsKeyframe, _codec, _trackType, _gateDropped, _gateEmitted, _fedObjects2, _warnedNoParser, _feedOutcomes2, _MmtpDecodePipeline_instances, tag_fn, gatedEmit_fn;
|
|
18426
18662
|
var MmtpDecodePipeline = class {
|
|
18427
18663
|
constructor() {
|
|
18428
18664
|
__privateAdd(this, _MmtpDecodePipeline_instances);
|
|
@@ -18442,7 +18678,7 @@ var MmtpDecodePipeline = class {
|
|
|
18442
18678
|
* emitted. Bounded logging only — these gate nothing. */
|
|
18443
18679
|
__privateAdd(this, _gateDropped, 0);
|
|
18444
18680
|
__privateAdd(this, _gateEmitted, 0);
|
|
18445
|
-
__privateAdd(this,
|
|
18681
|
+
__privateAdd(this, _fedObjects2, 0);
|
|
18446
18682
|
/** Warned-once latch for feeds arriving with no parser. Kept separate from
|
|
18447
18683
|
* #fedObjects so that counter stays a pure monotonic count. */
|
|
18448
18684
|
__privateAdd(this, _warnedNoParser, false);
|
|
@@ -18451,16 +18687,16 @@ var MmtpDecodePipeline = class {
|
|
|
18451
18687
|
* so a packet that fails header parse, fails MFU extraction, or accumulates
|
|
18452
18688
|
* forever as an unreassembled fragment is indistinguishable from one that
|
|
18453
18689
|
* produced a frame. Tally the kinds instead of guessing. */
|
|
18454
|
-
__privateAdd(this,
|
|
18690
|
+
__privateAdd(this, _feedOutcomes2, /* @__PURE__ */ new Map());
|
|
18455
18691
|
}
|
|
18456
18692
|
/** Configure the inner parser. Call before feedMoqObject(). */
|
|
18457
18693
|
configure(config) {
|
|
18458
18694
|
__privateGet(this, _parser2)?.flush();
|
|
18459
18695
|
__privateGet(this, _parser2)?.dispose();
|
|
18460
|
-
__privateSet(this,
|
|
18696
|
+
__privateSet(this, _fedObjects2, 0);
|
|
18461
18697
|
__privateSet(this, _gateDropped, 0);
|
|
18462
18698
|
__privateSet(this, _gateEmitted, 0);
|
|
18463
|
-
__privateGet(this,
|
|
18699
|
+
__privateGet(this, _feedOutcomes2).clear();
|
|
18464
18700
|
__privateSet(this, _warnedNoParser, false);
|
|
18465
18701
|
__privateSet(this, _codec, config.codec);
|
|
18466
18702
|
const trackType = isVideoCodec(config.codec) ? "video" : "audio";
|
|
@@ -18520,10 +18756,10 @@ var MmtpDecodePipeline = class {
|
|
|
18520
18756
|
return {
|
|
18521
18757
|
trackType: __privateGet(this, _trackType),
|
|
18522
18758
|
codec: __privateGet(this, _codec),
|
|
18523
|
-
fedObjects: __privateGet(this,
|
|
18759
|
+
fedObjects: __privateGet(this, _fedObjects2),
|
|
18524
18760
|
emitted: __privateGet(this, _gateEmitted),
|
|
18525
18761
|
gateDropped: __privateGet(this, _gateDropped),
|
|
18526
|
-
outcomes: Object.fromEntries(__privateGet(this,
|
|
18762
|
+
outcomes: Object.fromEntries(__privateGet(this, _feedOutcomes2))
|
|
18527
18763
|
};
|
|
18528
18764
|
}
|
|
18529
18765
|
/**
|
|
@@ -18538,8 +18774,8 @@ var MmtpDecodePipeline = class {
|
|
|
18538
18774
|
}
|
|
18539
18775
|
return;
|
|
18540
18776
|
}
|
|
18541
|
-
__privateSet(this,
|
|
18542
|
-
if (__privateGet(this,
|
|
18777
|
+
__privateSet(this, _fedObjects2, __privateGet(this, _fedObjects2) + 1);
|
|
18778
|
+
if (__privateGet(this, _fedObjects2) === 1) {
|
|
18543
18779
|
console.log(`[mmtp-pipeline] first object fed ${__privateMethod(this, _MmtpDecodePipeline_instances, tag_fn).call(this)} bytes=${packet.length}`);
|
|
18544
18780
|
}
|
|
18545
18781
|
let outcomeKind = "threw";
|
|
@@ -18553,18 +18789,18 @@ var MmtpDecodePipeline = class {
|
|
|
18553
18789
|
const record = __privateGet(this, _parser2).feed(packet);
|
|
18554
18790
|
outcomeKind = record?.kind ?? "null(parse-or-extract-failed)";
|
|
18555
18791
|
} finally {
|
|
18556
|
-
const seen = (__privateGet(this,
|
|
18557
|
-
__privateGet(this,
|
|
18792
|
+
const seen = (__privateGet(this, _feedOutcomes2).get(outcomeKind) ?? 0) + 1;
|
|
18793
|
+
__privateGet(this, _feedOutcomes2).set(outcomeKind, seen);
|
|
18558
18794
|
if (seen === 1) {
|
|
18559
18795
|
console.log(
|
|
18560
|
-
`[mmtp-pipeline] feed outcome FIRST '${outcomeKind}' ${__privateMethod(this, _MmtpDecodePipeline_instances, tag_fn).call(this)} at object #${__privateGet(this,
|
|
18796
|
+
`[mmtp-pipeline] feed outcome FIRST '${outcomeKind}' ${__privateMethod(this, _MmtpDecodePipeline_instances, tag_fn).call(this)} at object #${__privateGet(this, _fedObjects2)} bytes=${packet.length}`
|
|
18561
18797
|
);
|
|
18562
18798
|
}
|
|
18563
18799
|
}
|
|
18564
|
-
if (__privateGet(this,
|
|
18565
|
-
const hist = [...__privateGet(this,
|
|
18800
|
+
if (__privateGet(this, _fedObjects2) % 200 === 0) {
|
|
18801
|
+
const hist = [...__privateGet(this, _feedOutcomes2)].map(([k, v]) => `${k}=${v}`).join(" ");
|
|
18566
18802
|
console.log(
|
|
18567
|
-
`[mmtp-pipeline] feed histogram ${__privateMethod(this, _MmtpDecodePipeline_instances, tag_fn).call(this)} @${__privateGet(this,
|
|
18803
|
+
`[mmtp-pipeline] feed histogram ${__privateMethod(this, _MmtpDecodePipeline_instances, tag_fn).call(this)} @${__privateGet(this, _fedObjects2)}: ${hist} | emitted=${__privateGet(this, _gateEmitted)} gateDropped=${__privateGet(this, _gateDropped)}`
|
|
18568
18804
|
);
|
|
18569
18805
|
}
|
|
18570
18806
|
}
|
|
@@ -18631,9 +18867,9 @@ _codec = new WeakMap();
|
|
|
18631
18867
|
_trackType = new WeakMap();
|
|
18632
18868
|
_gateDropped = new WeakMap();
|
|
18633
18869
|
_gateEmitted = new WeakMap();
|
|
18634
|
-
|
|
18870
|
+
_fedObjects2 = new WeakMap();
|
|
18635
18871
|
_warnedNoParser = new WeakMap();
|
|
18636
|
-
|
|
18872
|
+
_feedOutcomes2 = new WeakMap();
|
|
18637
18873
|
_MmtpDecodePipeline_instances = new WeakSet();
|
|
18638
18874
|
/** Identity prefix for diagnostics: one pipeline per track means two
|
|
18639
18875
|
* instances write to the same console, and unlabelled lines interleave into
|
|
@@ -18649,7 +18885,7 @@ gatedEmit_fn = function(data, meta) {
|
|
|
18649
18885
|
__privateSet(this, _gateDropped, __privateGet(this, _gateDropped) + 1);
|
|
18650
18886
|
if (__privateGet(this, _gateDropped) <= 3 || __privateGet(this, _gateDropped) % 200 === 0) {
|
|
18651
18887
|
console.warn(
|
|
18652
|
-
`[mmtp-pipeline] keyframe gate DROP #${__privateGet(this, _gateDropped)} ${__privateMethod(this, _MmtpDecodePipeline_instances, tag_fn).call(this)} bytes=${data.length} fed=${__privateGet(this,
|
|
18888
|
+
`[mmtp-pipeline] keyframe gate DROP #${__privateGet(this, _gateDropped)} ${__privateMethod(this, _MmtpDecodePipeline_instances, tag_fn).call(this)} bytes=${data.length} fed=${__privateGet(this, _fedObjects2)} emitted=${__privateGet(this, _gateEmitted)}`
|
|
18653
18889
|
);
|
|
18654
18890
|
}
|
|
18655
18891
|
return;
|
|
@@ -18657,7 +18893,7 @@ gatedEmit_fn = function(data, meta) {
|
|
|
18657
18893
|
__privateSet(this, _needsKeyframe, false);
|
|
18658
18894
|
sourceDiscontinuity = true;
|
|
18659
18895
|
console.log(
|
|
18660
|
-
`[mmtp-pipeline] keyframe gate OPENED ${__privateMethod(this, _MmtpDecodePipeline_instances, tag_fn).call(this)} after ${__privateGet(this, _gateDropped)} drops, fed=${__privateGet(this,
|
|
18896
|
+
`[mmtp-pipeline] keyframe gate OPENED ${__privateMethod(this, _MmtpDecodePipeline_instances, tag_fn).call(this)} after ${__privateGet(this, _gateDropped)} drops, fed=${__privateGet(this, _fedObjects2)}`
|
|
18661
18897
|
);
|
|
18662
18898
|
}
|
|
18663
18899
|
__privateSet(this, _gateEmitted, __privateGet(this, _gateEmitted) + 1);
|
|
@@ -19361,6 +19597,16 @@ var NO_FEC = {
|
|
|
19361
19597
|
fecSymbolSize: 0,
|
|
19362
19598
|
fecInterleaveMs: 0
|
|
19363
19599
|
};
|
|
19600
|
+
function joinedRepairSymbolCount(params, joinedRepairTrackNames) {
|
|
19601
|
+
const layers = params.repairLayers;
|
|
19602
|
+
if (layers === void 0 || layers.length === 0) return params.fecRepairCount;
|
|
19603
|
+
const joined = new Set(joinedRepairTrackNames);
|
|
19604
|
+
let total = 0;
|
|
19605
|
+
for (const layer of layers) {
|
|
19606
|
+
if (joined.has(layer.repairTrackName)) total += layer.repairSymbols;
|
|
19607
|
+
}
|
|
19608
|
+
return total;
|
|
19609
|
+
}
|
|
19364
19610
|
function recordOf(value) {
|
|
19365
19611
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
19366
19612
|
}
|
|
@@ -19790,6 +20036,7 @@ export {
|
|
|
19790
20036
|
isSignalingPacket,
|
|
19791
20037
|
isSourcePacket,
|
|
19792
20038
|
isTrackTimingConfig,
|
|
20039
|
+
joinedRepairSymbolCount,
|
|
19793
20040
|
mergeOverrideIntoCmsfTracks,
|
|
19794
20041
|
mergeOverrideIntoHangRenditions,
|
|
19795
20042
|
mfuReassemblyTimeoutMs,
|