@blockcast/mmt-container 2.2.0-main.da2e7cd1dd5d → 2.2.0-main.e1bebe787bc9
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 +5 -2
- package/dist/block-policy.d.ts +55 -13
- package/dist/block-policy.d.ts.map +1 -1
- package/dist/block-policy.js +104 -32
- package/dist/block-policy.js.map +2 -2
- package/dist/browser-runtime.js +1573 -214
- package/dist/browser-runtime.js.map +3 -3
- package/dist/carp-catalog.js.map +2 -2
- package/dist/catalog-fec-params.d.ts +1 -1
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +14 -1
- package/dist/catalog-fec-params.js.map +2 -2
- package/dist/catalog-network-source.js.map +2 -2
- package/dist/cmaf-block-assembler.js +92 -1
- package/dist/cmaf-block-assembler.js.map +2 -2
- package/dist/codec-utils.d.ts.map +1 -1
- package/dist/codec-utils.js +92 -1
- package/dist/codec-utils.js.map +2 -2
- package/dist/delivery-catalog.js +2 -1
- package/dist/delivery-catalog.js.map +2 -2
- package/dist/delta-fallback-config.js +5 -1
- package/dist/delta-fallback-config.js.map +3 -3
- package/dist/fec-manager.d.ts +111 -14
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +613 -91
- package/dist/fec-manager.js.map +2 -2
- package/dist/fec-state.js +5 -1
- package/dist/fec-state.js.map +2 -2
- package/dist/fec-worker-setup.js.map +2 -2
- package/dist/held-layer-admission.js.map +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.d.ts +48 -13
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +97 -25
- package/dist/iso-block-locator.js.map +2 -2
- package/dist/iso-bmff-timing.d.ts +10 -1
- package/dist/iso-bmff-timing.d.ts.map +1 -1
- package/dist/iso-bmff-timing.js +36 -2
- package/dist/iso-bmff-timing.js.map +2 -2
- package/dist/media-router.js.map +1 -1
- package/dist/mfu-reassembler.js.map +2 -2
- package/dist/mmtp-container-parser.d.ts +104 -12
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +308 -27
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +329 -32
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +307 -27
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-fec-session.js.map +2 -2
- package/dist/mmtp-router.d.ts +36 -8
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +676 -76
- package/dist/mmtp-router.js.map +3 -3
- package/dist/multicast-auth-catalog.js.map +2 -2
- package/dist/multicast-input.js.map +2 -2
- package/dist/multicast-manager.d.ts +26 -3
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +1384 -187
- package/dist/multicast-manager.js.map +3 -3
- package/dist/multicast-transport.js +4 -3
- package/dist/multicast-transport.js.map +2 -2
- package/dist/multicast-unwrap.js.map +2 -2
- package/dist/no-modules.d.ts +1 -0
- package/dist/no-modules.d.ts.map +1 -1
- package/dist/no-modules.js +329 -31
- package/dist/no-modules.js.map +4 -4
- package/dist/repair-fetch.d.ts +38 -8
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +286 -27
- package/dist/repair-fetch.js.map +3 -3
- package/dist/repair-layer-subscriptions.js.map +2 -2
- package/dist/signaling.js.map +2 -2
- package/dist/timestamp-codec.js.map +2 -2
- package/dist/track-session.d.ts.map +1 -1
- package/dist/track-session.js +1 -0
- package/dist/track-session.js.map +2 -2
- package/dist/wasm-mfu-reassembler.js.map +2 -2
- package/dist/wasm-mmtp-container-parser.js +307 -27
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +5 -5
- package/src/block-policy.ts +216 -52
- package/src/catalog-fec-params.ts +1 -0
- package/src/codec-utils.ts +121 -1
- package/src/fec-manager.ts +593 -33
- package/src/index.ts +5 -0
- package/src/iso-block-locator.ts +133 -31
- package/src/iso-bmff-timing.ts +40 -1
- package/src/mmtp-container-parser.ts +341 -32
- package/src/mmtp-router.ts +614 -61
- package/src/multicast-manager.ts +136 -16
- package/src/no-modules.ts +3 -0
- package/src/repair-fetch.ts +366 -50
- package/src/track-session.ts +3 -0
package/dist/no-modules.js
CHANGED
|
@@ -895,13 +895,25 @@ function fecCatalogTracks(catalog) {
|
|
|
895
895
|
});
|
|
896
896
|
return { tracks, pointers };
|
|
897
897
|
}
|
|
898
|
-
function
|
|
898
|
+
function runtimeView(catalog, receiver) {
|
|
899
899
|
const { tracks, pointers } = fecCatalogTracks(catalog);
|
|
900
900
|
const report = validateFecCatalog({ tracks }, receiver);
|
|
901
901
|
const at = (path) => {
|
|
902
902
|
const m = /^\/tracks\/(\d+)(.*)$/.exec(path);
|
|
903
903
|
return m ? pointers[Number(m[1])] + m[2] : path;
|
|
904
904
|
};
|
|
905
|
+
return { tracks, pointers, report, at };
|
|
906
|
+
}
|
|
907
|
+
function runtimeFecCatalogReport(catalog, receiver = RUNTIME_FEC_RECEIVER) {
|
|
908
|
+
const { report, at } = runtimeView(catalog, receiver);
|
|
909
|
+
const issue = (i) => Object.freeze({ code: i.code, path: at(i.path) });
|
|
910
|
+
return Object.freeze({
|
|
911
|
+
instances: Object.freeze(report.instances.map((i) => Object.freeze({ ...i, path: at(i.path), issues: Object.freeze(i.issues.map(issue)) }))),
|
|
912
|
+
issues: Object.freeze(report.issues.map(issue))
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
function resolveFecBindings(catalog, receiver = RUNTIME_FEC_RECEIVER) {
|
|
916
|
+
const { tracks, pointers, report, at } = runtimeView(catalog, receiver);
|
|
905
917
|
const trackAt = (i) => recordOf(tracks[i]) ?? {};
|
|
906
918
|
const nameAt = (i) => i === null ? void 0 : trackAt(i)["name"];
|
|
907
919
|
const why = (i) => Object.freeze({
|
|
@@ -4576,9 +4588,10 @@ function isH264IntraSlice(nal) {
|
|
|
4576
4588
|
const sliceType = readH264SliceType(nal);
|
|
4577
4589
|
return sliceType === 2 || sliceType === 4 || sliceType === 7 || sliceType === 9;
|
|
4578
4590
|
}
|
|
4591
|
+
var H264_SLICE_TYPE_ESCAPED_BYTES = 32;
|
|
4579
4592
|
function readH264SliceType(nal) {
|
|
4580
4593
|
if (nal.length < 2 || (nal[0] & 31) !== 1) return null;
|
|
4581
|
-
const rbsp = removeEmulationPrevention(nal.subarray(1));
|
|
4594
|
+
const rbsp = removeEmulationPrevention(nal.subarray(1, 1 + H264_SLICE_TYPE_ESCAPED_BYTES));
|
|
4582
4595
|
const state = { bitOffset: 0 };
|
|
4583
4596
|
if (readUnsignedExpGolomb(rbsp, state) === null) return null;
|
|
4584
4597
|
return readUnsignedExpGolomb(rbsp, state);
|
|
@@ -4725,6 +4738,96 @@ if (void 0) {
|
|
|
4725
4738
|
]))).toBe(false);
|
|
4726
4739
|
});
|
|
4727
4740
|
});
|
|
4741
|
+
describe("readH264SliceType", () => {
|
|
4742
|
+
const wholeNalSliceType = (nal) => {
|
|
4743
|
+
if (nal.length < 2 || (nal[0] & 31) !== 1) return null;
|
|
4744
|
+
const rbsp = removeEmulationPrevention(nal.subarray(1));
|
|
4745
|
+
const state = { bitOffset: 0 };
|
|
4746
|
+
if (readUnsignedExpGolomb(rbsp, state) === null) return null;
|
|
4747
|
+
return readUnsignedExpGolomb(rbsp, state);
|
|
4748
|
+
};
|
|
4749
|
+
const hex2 = (text2) => Uint8Array.from(text2.match(/../g), (byte) => parseInt(byte, 16));
|
|
4750
|
+
const ue = (value) => {
|
|
4751
|
+
const code = (value + 1).toString(2);
|
|
4752
|
+
return "0".repeat(code.length - 1) + code;
|
|
4753
|
+
};
|
|
4754
|
+
const sliceNal = (bits) => {
|
|
4755
|
+
const rbsp = `${bits}1`.padEnd(Math.ceil((bits.length + 1) / 8) * 8, "0").match(/.{8}/g);
|
|
4756
|
+
const nal = [1];
|
|
4757
|
+
let zeros = 0;
|
|
4758
|
+
for (const byte of rbsp.map((bits8) => parseInt(bits8, 2))) {
|
|
4759
|
+
if (zeros >= 2 && byte <= 3) {
|
|
4760
|
+
nal.push(3);
|
|
4761
|
+
zeros = 0;
|
|
4762
|
+
}
|
|
4763
|
+
nal.push(byte);
|
|
4764
|
+
zeros = byte === 0 ? zeros + 1 : 0;
|
|
4765
|
+
}
|
|
4766
|
+
return Uint8Array.from(nal);
|
|
4767
|
+
};
|
|
4768
|
+
const x264Slices = [
|
|
4769
|
+
["64x48 P", hex2("419a231885bfd53888f63ef5b1e1e39b9ff2eabf03fd3f4d7d4317ffcbf75176"), 5, false],
|
|
4770
|
+
["64x48 B", hex2("419e414212fffeeade283707cb70f7"), 6, false],
|
|
4771
|
+
["64x48 non-IDR I", hex2(
|
|
4772
|
+
"4128899037f384db2be0cfe48aa23558781dd429f7db8e8a6ae44f7ca2333ba1029477da6ddfeac61843c5680cbf66247469d64549b0f5f7ca6acc529f5cf032b35d8dedc6b2412ece24f42f80b593fc0f3ff47a08c84799ff2ada18ac39a527e23eb34c8167fd"
|
|
4773
|
+
), 7, true],
|
|
4774
|
+
["1280x720 B, escape at byte 10", hex2(
|
|
4775
|
+
"01006e27a81109ff000003016b662ea5ea46000f57880f3fb0d3f03ff7dac0546fc9966a5f6d86cb795db178882f6e19b75d92170917306190f262fd58268702db2eff86a9651e48"
|
|
4776
|
+
), 6, false],
|
|
4777
|
+
["1280x720 P, escape at byte 15", hex2(
|
|
4778
|
+
"41006e26a8cd1329e1bffea784000003002b5ef096f0320bd99f00037f22327e886223b7996bb04acd35ad9a0385f02c1801eb6226bc94993d1880172ffbb23db74729569b6f3934cba0cba17b7c29ce0e216080cb7b18e5876df59e85302da9cba203fe6769178a2e02eeaa54a6f87568cbaa019a3442eae19c8a7adc8cd02441bee573c5408b6552abd2d9d3"
|
|
4779
|
+
), 5, false],
|
|
4780
|
+
["1280x720 B, escape at byte 22", hex2("01006e27da9109ff01a4c1dbc27ed915a3172ec80000030352"), 6, false],
|
|
4781
|
+
["7680x4320 IDR, first_mb_in_slice 97440", hex2(
|
|
4782
|
+
"650000be5088843a118a000218f1c00040f63800087949c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9"
|
|
4783
|
+
), null, true],
|
|
4784
|
+
["7680x4320 P, first_mb_in_slice 32640", hex2(
|
|
4785
|
+
"410003fc09a20a806ff0ae0085a611cc7ad5f2020e25900ba4c3398016b57e100011021220200020"
|
|
4786
|
+
), 5, false],
|
|
4787
|
+
["7680x4320 P, first_mb_in_slice 97440", hex2(
|
|
4788
|
+
"410000be509a20a8078f5a83cc40d800783b017f5c6d7e4883fb4801a9c569245bd04135f7c00806"
|
|
4789
|
+
), 5, false]
|
|
4790
|
+
];
|
|
4791
|
+
const syntheticSlices = [
|
|
4792
|
+
["an escape inside first_mb_in_slice", sliceNal(ue(2 ** 24 - 1) + ue(2)), 2],
|
|
4793
|
+
["an escape between the fields", sliceNal(ue(2 ** 21 - 1) + ue(7)), 7],
|
|
4794
|
+
["an escape inside slice_type", sliceNal(ue(0) + ue(2 ** 22 - 1)), 2 ** 22 - 1],
|
|
4795
|
+
["the longest fields, five escapes", sliceNal(ue(2 ** 30 - 1) + ue(2 ** 30 - 1)), 2 ** 30 - 1],
|
|
4796
|
+
["the largest values", sliceNal(ue(2 ** 31 - 2) + ue(2 ** 31 - 2)), 2 ** 31 - 2],
|
|
4797
|
+
["31 leading zeros in first_mb_in_slice", sliceNal(`${"0".repeat(31)}1`), null],
|
|
4798
|
+
["31 leading zeros in slice_type", sliceNal(`1${"0".repeat(31)}1`), null],
|
|
4799
|
+
["escapes running past the slice header", sliceNal(ue(0) + ue(5) + "0".repeat(400)), 5]
|
|
4800
|
+
];
|
|
4801
|
+
test("reads the slice_type of real and synthetic slices", () => {
|
|
4802
|
+
for (const [name, nal, sliceType] of [...x264Slices, ...syntheticSlices]) {
|
|
4803
|
+
expect(readH264SliceType(nal), name).toBe(sliceType);
|
|
4804
|
+
}
|
|
4805
|
+
});
|
|
4806
|
+
test("matches the whole-NAL unescape at every truncation", () => {
|
|
4807
|
+
for (const [name, nal] of [...x264Slices, ...syntheticSlices]) {
|
|
4808
|
+
for (let end = 0; end <= nal.length; end++) {
|
|
4809
|
+
const cut = nal.subarray(0, end);
|
|
4810
|
+
expect(readH264SliceType(cut), `${name}, first ${end} bytes`).toBe(wholeNalSliceType(cut));
|
|
4811
|
+
}
|
|
4812
|
+
}
|
|
4813
|
+
});
|
|
4814
|
+
test("matches the whole-NAL unescape on zero-heavy NAL units", () => {
|
|
4815
|
+
const bytes = [0, 0, 0, 3, 1, 2, 128, 255];
|
|
4816
|
+
let seed = 1;
|
|
4817
|
+
const next = () => (seed = Math.imul(seed, 1103515245) + 12345 >>> 0) >>> 16;
|
|
4818
|
+
for (let i = 0; i < 5e3; i++) {
|
|
4819
|
+
const nal = new Uint8Array(2 + next() % 63);
|
|
4820
|
+
nal[0] = 65;
|
|
4821
|
+
for (let j = 1; j < nal.length; j++) nal[j] = bytes[next() % bytes.length];
|
|
4822
|
+
expect(readH264SliceType(nal), Array.from(nal).join()).toBe(wholeNalSliceType(nal));
|
|
4823
|
+
}
|
|
4824
|
+
});
|
|
4825
|
+
test("classifies the x264 slices as keyframes or not", () => {
|
|
4826
|
+
for (const [name, nal, , keyframe] of x264Slices) {
|
|
4827
|
+
expect(classifyH264Keyframe(rawH264NalToAvcc(nal), { allowPartialAvcc: true }), name).toBe(keyframe);
|
|
4828
|
+
}
|
|
4829
|
+
});
|
|
4830
|
+
});
|
|
4728
4831
|
describe("avccToAnnexB", () => {
|
|
4729
4832
|
test("converts with SPS/PPS on keyframe", () => {
|
|
4730
4833
|
const avcc = new Uint8Array([0, 0, 0, 3, 101, 170, 187]);
|
|
@@ -5568,9 +5671,21 @@ var IsoBmffTimingResolver = class {
|
|
|
5568
5671
|
}
|
|
5569
5672
|
#track = null;
|
|
5570
5673
|
#fragments = /* @__PURE__ */ new Map();
|
|
5674
|
+
/** First sample of each pending fragment, kept in `#delivered` with its sample count. */
|
|
5675
|
+
#firstSamples = /* @__PURE__ */ new Map();
|
|
5676
|
+
/**
|
|
5677
|
+
* First sample and sample count of the newest fragments whose every slot was
|
|
5678
|
+
* cleared. Abandonment counts: `releaseSample` clears a slot too, which
|
|
5679
|
+
* matches the combiner, since it retires an abandoned sample as well.
|
|
5680
|
+
*/
|
|
5681
|
+
#delivered = /* @__PURE__ */ new Map();
|
|
5571
5682
|
#pendingSamples = 0;
|
|
5572
5683
|
#evictedSamples = 0;
|
|
5573
5684
|
#lastMovieFragmentRejection = null;
|
|
5685
|
+
/** True once an FT=0 has bound the track that FT=1 timing is read against. */
|
|
5686
|
+
get initialized() {
|
|
5687
|
+
return this.#track !== null;
|
|
5688
|
+
}
|
|
5574
5689
|
get pendingSampleCount() {
|
|
5575
5690
|
return this.#pendingSamples;
|
|
5576
5691
|
}
|
|
@@ -5594,7 +5709,14 @@ var IsoBmffTimingResolver = class {
|
|
|
5594
5709
|
this.#track = timing;
|
|
5595
5710
|
return true;
|
|
5596
5711
|
}
|
|
5597
|
-
|
|
5712
|
+
/**
|
|
5713
|
+
* `recovered` marks an FEC-recovered copy. A recovered block hands back
|
|
5714
|
+
* every FT=1 it holds, the received ones included, so a recovered copy of a
|
|
5715
|
+
* fragment whose samples are all done is a duplicate: admitting it again
|
|
5716
|
+
* would charge stale timing and could displace the live MPU's. A source
|
|
5717
|
+
* copy is still admitted again (a rendition switch re-arms timing that way).
|
|
5718
|
+
*/
|
|
5719
|
+
addMovieFragment(mpuSequenceNumber, data, additionalSampleLimit = this.maxPendingSamples, recovered = false) {
|
|
5598
5720
|
this.#lastMovieFragmentRejection = null;
|
|
5599
5721
|
if (!Number.isInteger(additionalSampleLimit) || additionalSampleLimit < 0) {
|
|
5600
5722
|
this.#lastMovieFragmentRejection = "invalid";
|
|
@@ -5620,6 +5742,8 @@ var IsoBmffTimingResolver = class {
|
|
|
5620
5742
|
(sample, index) => sample !== null && sameSample(sample, parsed.samples[index])
|
|
5621
5743
|
);
|
|
5622
5744
|
}
|
|
5745
|
+
const delivered = recovered ? this.#delivered.get(key) : void 0;
|
|
5746
|
+
if (delivered && delivered.sampleCount === parsed.samples.length && sameSample(delivered.first, parsed.samples[0])) return true;
|
|
5623
5747
|
let freed = 0;
|
|
5624
5748
|
while (this.#fragments.size > 0 && (this.#pendingSamples + parsed.samples.length > this.maxPendingSamples || parsed.samples.length - freed > additionalSampleLimit)) {
|
|
5625
5749
|
freed += this.#evictOldestFragment();
|
|
@@ -5633,6 +5757,7 @@ var IsoBmffTimingResolver = class {
|
|
|
5633
5757
|
return false;
|
|
5634
5758
|
}
|
|
5635
5759
|
this.#fragments.set(key, [...parsed.samples]);
|
|
5760
|
+
this.#firstSamples.set(key, parsed.samples[0]);
|
|
5636
5761
|
this.#pendingSamples += parsed.samples.length;
|
|
5637
5762
|
return true;
|
|
5638
5763
|
}
|
|
@@ -5690,6 +5815,7 @@ var IsoBmffTimingResolver = class {
|
|
|
5690
5815
|
let live = 0;
|
|
5691
5816
|
for (const sample of samples) if (sample !== null) live++;
|
|
5692
5817
|
this.#fragments.delete(oldest);
|
|
5818
|
+
this.#firstSamples.delete(oldest);
|
|
5693
5819
|
this.#pendingSamples -= live;
|
|
5694
5820
|
this.#evictedSamples += live;
|
|
5695
5821
|
return live;
|
|
@@ -5705,12 +5831,23 @@ var IsoBmffTimingResolver = class {
|
|
|
5705
5831
|
if (!samples || !samples[index]) return false;
|
|
5706
5832
|
samples[index] = null;
|
|
5707
5833
|
this.#pendingSamples--;
|
|
5708
|
-
if (samples.every((value) => value === null))
|
|
5834
|
+
if (samples.every((value) => value === null)) {
|
|
5835
|
+
this.#fragments.delete(key);
|
|
5836
|
+
const first = this.#firstSamples.get(key);
|
|
5837
|
+
this.#firstSamples.delete(key);
|
|
5838
|
+
this.#delivered.delete(key);
|
|
5839
|
+
this.#delivered.set(key, { first, sampleCount: samples.length });
|
|
5840
|
+
if (this.#delivered.size > this.maxPendingSamples) {
|
|
5841
|
+
this.#delivered.delete(this.#delivered.keys().next().value);
|
|
5842
|
+
}
|
|
5843
|
+
}
|
|
5709
5844
|
return true;
|
|
5710
5845
|
}
|
|
5711
5846
|
reset() {
|
|
5712
5847
|
this.#track = null;
|
|
5713
5848
|
this.#fragments.clear();
|
|
5849
|
+
this.#firstSamples.clear();
|
|
5850
|
+
this.#delivered.clear();
|
|
5714
5851
|
this.#pendingSamples = 0;
|
|
5715
5852
|
}
|
|
5716
5853
|
};
|
|
@@ -5880,6 +6017,9 @@ function authoredGap(before, after) {
|
|
|
5880
6017
|
function ssIdAfter(a, b) {
|
|
5881
6018
|
return (a - b | 0) > 0;
|
|
5882
6019
|
}
|
|
6020
|
+
function holdsRebuilt(stream) {
|
|
6021
|
+
return stream.buf.some(({ meta }) => meta.fecSbnFirst !== void 0);
|
|
6022
|
+
}
|
|
5883
6023
|
var FecReleaseSequencer = class {
|
|
5884
6024
|
#streams = /* @__PURE__ */ new Map();
|
|
5885
6025
|
#gate;
|
|
@@ -5942,6 +6082,7 @@ var FecReleaseSequencer = class {
|
|
|
5942
6082
|
stream.lastSbn = void 0;
|
|
5943
6083
|
stream.discontinuity = false;
|
|
5944
6084
|
stream.rapSsId = void 0;
|
|
6085
|
+
stream.sourced = false;
|
|
5945
6086
|
}
|
|
5946
6087
|
if (stream.last !== null && compareFrameOrder(frame, stream.last) <= 0) {
|
|
5947
6088
|
this.#recordStat("droppedStale");
|
|
@@ -5968,6 +6109,7 @@ var FecReleaseSequencer = class {
|
|
|
5968
6109
|
if (compareFrameOrder(stream.buf[mid], frame) < 0) lo = mid + 1;
|
|
5969
6110
|
else hi = mid;
|
|
5970
6111
|
}
|
|
6112
|
+
if (stream.buf[lo]?.passed === true) frame.passed = true;
|
|
5971
6113
|
stream.buf.splice(lo, 0, frame);
|
|
5972
6114
|
this.#drainUnlessDeferred(stream);
|
|
5973
6115
|
}
|
|
@@ -6003,6 +6145,41 @@ var FecReleaseSequencer = class {
|
|
|
6003
6145
|
}
|
|
6004
6146
|
return false;
|
|
6005
6147
|
}
|
|
6148
|
+
/**
|
|
6149
|
+
* These streams' sink is being replaced by one that has seen no source
|
|
6150
|
+
* frame yet. First, from a stream that holds a frame the overlay rebuilt,
|
|
6151
|
+
* release to the sink being replaced the frames the unanchored path had
|
|
6152
|
+
* already released to it (#cursorPassed): there they waited in its queue,
|
|
6153
|
+
* which its replacement flushes. A stream that holds none is not drained:
|
|
6154
|
+
* it holds nothing the anchor kept back, and a drain would still force out
|
|
6155
|
+
* a frame held past the hold limit, which before the anchor waited for the
|
|
6156
|
+
* next push. Then treat the streams as unsourced until a source frame is
|
|
6157
|
+
* released.
|
|
6158
|
+
*/
|
|
6159
|
+
unsource(packetId, catalogTrackName) {
|
|
6160
|
+
for (const stream of this.#streams.values()) {
|
|
6161
|
+
if (stream.packetId === packetId && (catalogTrackName === void 0 || stream.catalogTrackName === catalogTrackName)) {
|
|
6162
|
+
if (stream.draining === 0 && holdsRebuilt(stream)) {
|
|
6163
|
+
if (this.#deferDepth > 0) this.#deferredStreams.add(stream);
|
|
6164
|
+
else this.#drain(stream, true);
|
|
6165
|
+
}
|
|
6166
|
+
stream.sourced = false;
|
|
6167
|
+
}
|
|
6168
|
+
}
|
|
6169
|
+
}
|
|
6170
|
+
/**
|
|
6171
|
+
* Whether a stream of `packetId` holds a frame the keyframe overlay rebuilt
|
|
6172
|
+
* (FrameMeta.fecSbnFirst). Without `catalogTrackName`, every stream of the
|
|
6173
|
+
* packetId.
|
|
6174
|
+
*/
|
|
6175
|
+
holdsRebuilt(packetId, catalogTrackName) {
|
|
6176
|
+
for (const stream of this.#streams.values()) {
|
|
6177
|
+
if (stream.packetId !== packetId) continue;
|
|
6178
|
+
if (catalogTrackName !== void 0 && stream.catalogTrackName !== catalogTrackName) continue;
|
|
6179
|
+
if (holdsRebuilt(stream)) return true;
|
|
6180
|
+
}
|
|
6181
|
+
return false;
|
|
6182
|
+
}
|
|
6006
6183
|
/** Re-evaluate held gaps after FEC state changed. */
|
|
6007
6184
|
poke(streamKey) {
|
|
6008
6185
|
if (streamKey !== void 0) {
|
|
@@ -6094,16 +6271,32 @@ var FecReleaseSequencer = class {
|
|
|
6094
6271
|
last: null,
|
|
6095
6272
|
lastSbn: void 0,
|
|
6096
6273
|
discontinuity: false,
|
|
6097
|
-
rapSsId: void 0
|
|
6274
|
+
rapSsId: void 0,
|
|
6275
|
+
sourced: false,
|
|
6276
|
+
draining: 0
|
|
6098
6277
|
};
|
|
6099
6278
|
this.#streams.set(streamKey, stream);
|
|
6100
6279
|
}
|
|
6101
6280
|
return stream;
|
|
6102
6281
|
}
|
|
6103
|
-
#
|
|
6282
|
+
/** `asUnanchored`: release overlay-rebuilt frames when unanchored did (#cursorPassed). */
|
|
6283
|
+
#drain(stream, asUnanchored = false) {
|
|
6284
|
+
stream.draining++;
|
|
6285
|
+
try {
|
|
6286
|
+
this.#drainLoop(stream, asUnanchored);
|
|
6287
|
+
} finally {
|
|
6288
|
+
stream.draining--;
|
|
6289
|
+
}
|
|
6290
|
+
}
|
|
6291
|
+
#drainLoop(stream, asUnanchored) {
|
|
6104
6292
|
while (stream.buf.length > 0 && stream.last !== null) {
|
|
6105
6293
|
const head = stream.buf[0];
|
|
6106
6294
|
const last = stream.last;
|
|
6295
|
+
if (compareFrameOrder(head, last) <= 0) {
|
|
6296
|
+
stream.buf.shift();
|
|
6297
|
+
this.#release(stream, head, void 0);
|
|
6298
|
+
continue;
|
|
6299
|
+
}
|
|
6107
6300
|
if (stream.discontinuity) {
|
|
6108
6301
|
stream.discontinuity = false;
|
|
6109
6302
|
stream.buf.shift();
|
|
@@ -6117,9 +6310,10 @@ var FecReleaseSequencer = class {
|
|
|
6117
6310
|
}
|
|
6118
6311
|
const headSbn = head.meta.fecSbn;
|
|
6119
6312
|
const from = stream.lastSbn ?? headSbn;
|
|
6120
|
-
const to = headSbn ?? stream.lastSbn;
|
|
6313
|
+
const to = head.meta.fecSbnFirst ?? headSbn ?? stream.lastSbn;
|
|
6121
6314
|
let lost = [];
|
|
6122
6315
|
const unanchored = from === void 0 && to === void 0;
|
|
6316
|
+
let unresolved = false;
|
|
6123
6317
|
if (from !== void 0 && to !== void 0) {
|
|
6124
6318
|
const resolved = this.#gate.resolvedLoss(
|
|
6125
6319
|
stream.packetId,
|
|
@@ -6128,7 +6322,8 @@ var FecReleaseSequencer = class {
|
|
|
6128
6322
|
Math.max(from, to),
|
|
6129
6323
|
from
|
|
6130
6324
|
);
|
|
6131
|
-
|
|
6325
|
+
unresolved = resolved === null;
|
|
6326
|
+
if (unresolved && !this.#cursorPassed(stream, asUnanchored) && !this.#unrepairableWaitOver(stream, last, head, from, to)) {
|
|
6132
6327
|
const heldMs = performance.now() - head.arrivedAtMs;
|
|
6133
6328
|
if (heldMs <= this.#gate.holdLimitMs(stream.packetId, stream.catalogTrackName)) return;
|
|
6134
6329
|
this.#recordStat("forcedWindowFlushes");
|
|
@@ -6136,22 +6331,69 @@ var FecReleaseSequencer = class {
|
|
|
6136
6331
|
this.#release(stream, head, this.#gate.decide(last, head, [], true));
|
|
6137
6332
|
continue;
|
|
6138
6333
|
}
|
|
6139
|
-
lost = resolved;
|
|
6334
|
+
lost = resolved ?? [];
|
|
6140
6335
|
}
|
|
6141
6336
|
stream.buf.shift();
|
|
6142
6337
|
this.#release(
|
|
6143
6338
|
stream,
|
|
6144
6339
|
head,
|
|
6145
|
-
lost.length > 0 || unanchored || authoredGap(last.meta, head.meta) ? this.#gate.decide(last, head, lost, false) : void 0
|
|
6340
|
+
lost.length > 0 || unanchored || unresolved || authoredGap(last.meta, head.meta) ? this.#gate.decide(last, head, lost, false) : void 0
|
|
6146
6341
|
);
|
|
6147
6342
|
}
|
|
6148
6343
|
}
|
|
6344
|
+
/**
|
|
6345
|
+
* The head has waited out a gap only a late source can still fill
|
|
6346
|
+
* (FecReleaseGate.unrepairableWaitMs). Not yet: the gate is asked to poke
|
|
6347
|
+
* the stream when it has (`wakeAt`), since no packet may come by then.
|
|
6348
|
+
*/
|
|
6349
|
+
#unrepairableWaitOver(stream, last, head, from, to) {
|
|
6350
|
+
const waitMs = this.#gate.unrepairableWaitMs?.(last, head, from, to);
|
|
6351
|
+
if (waitMs === void 0) return false;
|
|
6352
|
+
const atMs = head.arrivedAtMs + waitMs;
|
|
6353
|
+
if (performance.now() >= atMs) return true;
|
|
6354
|
+
this.#gate.wakeAt?.(stream.packetId, stream.catalogTrackName, atMs);
|
|
6355
|
+
return false;
|
|
6356
|
+
}
|
|
6357
|
+
/**
|
|
6358
|
+
* An overlay-rebuilt frame (fecSbnFirst) waits no longer than the BLO-53342
|
|
6359
|
+
* source cursor holds it unanchored, and neither does a later frame behind
|
|
6360
|
+
* it. Unanchored, a frame that waits on no block (fecSbnFirst set, or no
|
|
6361
|
+
* fecSbn) left the gate once every frame ahead of it had: mark it `passed`,
|
|
6362
|
+
* like each frame that arrived in front of it since (stale there). The head
|
|
6363
|
+
* then goes, decided as it would be unanchored, once a frame the base path
|
|
6364
|
+
* delivered (a source frame, or one base FEC recovered) is buffered after a
|
|
6365
|
+
* marked one: the base path has passed that one, so a frame still missing
|
|
6366
|
+
* before it can only come from a repair. It also goes while no source frame
|
|
6367
|
+
* has been released, when the direct path shows a recovered frame at once.
|
|
6368
|
+
* And it goes at once while a staged switch decides on when frames arrive
|
|
6369
|
+
* (FecReleaseGate.releaseUnanchored), and when unsource releases into a
|
|
6370
|
+
* sink being replaced: unanchored, it had already reached the sink.
|
|
6371
|
+
* The scan also writes: the `passed` marks it sets stay on the frames,
|
|
6372
|
+
* and push marks a frame it inserts in front of a marked one from them.
|
|
6373
|
+
*/
|
|
6374
|
+
#cursorPassed(stream, asUnanchored) {
|
|
6375
|
+
let at = -1;
|
|
6376
|
+
for (let i = 0; i < stream.buf.length; i++) {
|
|
6377
|
+
const frame = stream.buf[i];
|
|
6378
|
+
if (frame.meta.fecSbnFirst !== void 0 || frame.meta.fecSbn === void 0) {
|
|
6379
|
+
frame.passed = true;
|
|
6380
|
+
if (at < 0) at = i;
|
|
6381
|
+
} else if (frame.passed !== true) break;
|
|
6382
|
+
}
|
|
6383
|
+
if (at < 0) return false;
|
|
6384
|
+
return asUnanchored || !stream.sourced || this.#gate.releaseUnanchored?.(stream.packetId, stream.catalogTrackName) === true || stream.buf.some(({ meta }, i) => i > at && meta.fecSbnFirst === void 0 && (meta.recovered !== true || meta.fecSbn !== void 0));
|
|
6385
|
+
}
|
|
6149
6386
|
#release(stream, frame, decision) {
|
|
6387
|
+
const stale = stream.last !== null && compareFrameOrder(frame, stream.last) <= 0;
|
|
6388
|
+
if (stale) this.#recordStat("droppedStale");
|
|
6150
6389
|
if (decision) frame.meta.gapBefore = decision;
|
|
6151
6390
|
stream.last = frame;
|
|
6152
|
-
if (frame.meta.fecSbn !== void 0
|
|
6391
|
+
if (frame.meta.fecSbn !== void 0 && (frame.meta.fecSbnFirst === void 0 || stream.lastSbn !== void 0)) {
|
|
6392
|
+
stream.lastSbn = frame.meta.fecSbn;
|
|
6393
|
+
}
|
|
6394
|
+
if (frame.meta.recovered !== true) stream.sourced = true;
|
|
6153
6395
|
this.#gate.onReleased?.(frame.data, frame.meta);
|
|
6154
|
-
this.#emit(frame.data, frame.meta);
|
|
6396
|
+
if (!stale) this.#emit(frame.data, frame.meta);
|
|
6155
6397
|
}
|
|
6156
6398
|
};
|
|
6157
6399
|
var FMPU_BOX_TYPES = /* @__PURE__ */ new Set(["ftyp", "moov", "moof"]);
|
|
@@ -6192,6 +6434,12 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6192
6434
|
this.#reclaimedTimingSamples = 0;
|
|
6193
6435
|
this.#evictedTimingSamples = 0;
|
|
6194
6436
|
this.#rejectedMovieFragments = 0;
|
|
6437
|
+
this.#recoveredHeadsAwaitingTiming = {
|
|
6438
|
+
held: 0,
|
|
6439
|
+
expired: 0,
|
|
6440
|
+
discarded: 0,
|
|
6441
|
+
superseded: 0
|
|
6442
|
+
};
|
|
6195
6443
|
this.#sequencers = /* @__PURE__ */ new Map();
|
|
6196
6444
|
this.#fecGate = null;
|
|
6197
6445
|
this.#fecSequencer = null;
|
|
@@ -6300,6 +6548,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6300
6548
|
#reclaimedTimingSamples;
|
|
6301
6549
|
#evictedTimingSamples;
|
|
6302
6550
|
#rejectedMovieFragments;
|
|
6551
|
+
#recoveredHeadsAwaitingTiming;
|
|
6303
6552
|
#sequencers;
|
|
6304
6553
|
#fecGate;
|
|
6305
6554
|
#fecSequencer;
|
|
@@ -6405,11 +6654,12 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6405
6654
|
/**
|
|
6406
6655
|
* Typed view of the ISO-BMFF timing-sample budget.
|
|
6407
6656
|
*
|
|
6408
|
-
*
|
|
6409
|
-
*
|
|
6410
|
-
*
|
|
6411
|
-
*
|
|
6412
|
-
*
|
|
6657
|
+
* Each stream admits timing against its own window of `capacity` slots
|
|
6658
|
+
* (BLO-52085). A stream at capacity displaces its own oldest timing to
|
|
6659
|
+
* admit the moof in hand, and `evicted` counts the slots so displaced:
|
|
6660
|
+
* timing a stream declared and never delivered shows up there. `pending`
|
|
6661
|
+
* sums every stream, so it can exceed `capacity`. Per repo policy this is
|
|
6662
|
+
* a producer-owned counter -- never infer budget state by parsing logs.
|
|
6413
6663
|
*/
|
|
6414
6664
|
get timingBudgetStats() {
|
|
6415
6665
|
return {
|
|
@@ -6420,6 +6670,14 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6420
6670
|
rejectedMovieFragments: this.#rejectedMovieFragments
|
|
6421
6671
|
};
|
|
6422
6672
|
}
|
|
6673
|
+
/** Recovered heads parked for FT=1 timing (BLO-53369). Survives dispose(). */
|
|
6674
|
+
get recoveredHeadsAwaitingTiming() {
|
|
6675
|
+
let pending = 0;
|
|
6676
|
+
for (const { awaitingTiming } of this.#timingStreams.values()) {
|
|
6677
|
+
for (const head of awaitingTiming) if (head.options?.recovered) pending++;
|
|
6678
|
+
}
|
|
6679
|
+
return { ...this.#recoveredHeadsAwaitingTiming, pending };
|
|
6680
|
+
}
|
|
6423
6681
|
get reorderStats() {
|
|
6424
6682
|
let bufferedFrames = this.#fecSequencer?.buffered ?? 0;
|
|
6425
6683
|
for (const { sequencer } of this.#sequencers.values()) bufferedFrames += sequencer.buffered;
|
|
@@ -6461,6 +6719,14 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6461
6719
|
fecReleaseRapAbove(packetId, catalogTrackName, ssId) {
|
|
6462
6720
|
return this.#fecSequencer?.rapAbove(packetId, catalogTrackName, ssId) ?? false;
|
|
6463
6721
|
}
|
|
6722
|
+
/** See FecReleaseSequencer.unsource. */
|
|
6723
|
+
unsourceFecRelease(packetId, catalogTrackName) {
|
|
6724
|
+
this.#fecSequencer?.unsource(packetId, catalogTrackName);
|
|
6725
|
+
}
|
|
6726
|
+
/** See FecReleaseSequencer.holdsRebuilt. */
|
|
6727
|
+
fecReleaseHoldsRebuilt(packetId, catalogTrackName) {
|
|
6728
|
+
return this.#fecSequencer?.holdsRebuilt(packetId, catalogTrackName) ?? false;
|
|
6729
|
+
}
|
|
6464
6730
|
/** Re-evaluate held gaps after FEC block state changed. */
|
|
6465
6731
|
pokeFecRelease(packetId, catalogTrackName) {
|
|
6466
6732
|
if (!this.#fecSequencer) return;
|
|
@@ -6593,7 +6859,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6593
6859
|
const now = Date.now();
|
|
6594
6860
|
for (const { awaitingTiming } of this.#timingStreams.values()) {
|
|
6595
6861
|
while (awaitingTiming.length > 0 && now - awaitingTiming[0].arrivedAt > timeoutMs) {
|
|
6596
|
-
awaitingTiming.shift();
|
|
6862
|
+
this.#leaveAwaitingTiming(awaitingTiming.shift(), "expired");
|
|
6597
6863
|
}
|
|
6598
6864
|
}
|
|
6599
6865
|
}
|
|
@@ -6711,11 +6977,16 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6711
6977
|
if (mpu.fragmentationIndicator !== 0 || mpu.fragmentCounter !== 0)
|
|
6712
6978
|
return this.#drop("fragment-unexpected-fragmentation");
|
|
6713
6979
|
const resolver2 = this.#timingResolver(streamKey, info.packetId, false);
|
|
6714
|
-
if (!resolver2) return this.#drop("fragment-no-resolver");
|
|
6980
|
+
if (!resolver2?.initialized) return this.#drop("fragment-no-resolver");
|
|
6715
6981
|
const pendingBefore = resolver2.pendingSampleCount;
|
|
6716
6982
|
const evictedBefore = resolver2.evictedSampleCount;
|
|
6717
|
-
const remaining = this.#maxPendingTimingSamples -
|
|
6718
|
-
const admitted = resolver2.addMovieFragment(
|
|
6983
|
+
const remaining = this.#maxPendingTimingSamples - resolver2.pendingSampleCount;
|
|
6984
|
+
const admitted = resolver2.addMovieFragment(
|
|
6985
|
+
mpu.mpuSequenceNumber,
|
|
6986
|
+
data,
|
|
6987
|
+
remaining,
|
|
6988
|
+
options?.recovered === true
|
|
6989
|
+
);
|
|
6719
6990
|
this.#pendingTimingSamples += resolver2.pendingSampleCount - pendingBefore;
|
|
6720
6991
|
this.#evictedTimingSamples += resolver2.evictedSampleCount - evictedBefore;
|
|
6721
6992
|
if (!admitted) {
|
|
@@ -6735,7 +7006,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6735
7006
|
};
|
|
6736
7007
|
}
|
|
6737
7008
|
if (fragmentType !== 2) return this.#drop("unknown-fragment-type");
|
|
6738
|
-
const resolver = this.#timingResolver(streamKey, info.packetId,
|
|
7009
|
+
const resolver = this.#timingResolver(streamKey, info.packetId, true);
|
|
6739
7010
|
if (!resolver) return this.#drop("mfu-no-resolver");
|
|
6740
7011
|
if (!Number.isSafeInteger(data.byteLength) || data.byteLength <= 0)
|
|
6741
7012
|
return this.#drop("mfu-empty-payload");
|
|
@@ -6756,6 +7027,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6756
7027
|
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
6757
7028
|
movieFragmentSequenceNumber: mfuDuHeader.movieFragmentSequenceNumber,
|
|
6758
7029
|
sampleNumber: mfuDuHeader.sampleNumber,
|
|
7030
|
+
sequenceNumber: info.sequenceNumber,
|
|
6759
7031
|
arrivedAt: Date.now()
|
|
6760
7032
|
});
|
|
6761
7033
|
return this.#drop("mfu-sample-timing-missing");
|
|
@@ -6781,7 +7053,8 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6781
7053
|
info,
|
|
6782
7054
|
resolver,
|
|
6783
7055
|
options?.recovered === true,
|
|
6784
|
-
options?.fecSbn
|
|
7056
|
+
options?.fecSbn,
|
|
7057
|
+
options?.fecSbnFirst
|
|
6785
7058
|
);
|
|
6786
7059
|
if (deferred.record === void 0) this.#countDeferredOutcome(deferred.reason);
|
|
6787
7060
|
}
|
|
@@ -6874,7 +7147,8 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6874
7147
|
info,
|
|
6875
7148
|
resolver,
|
|
6876
7149
|
options?.recovered === true,
|
|
6877
|
-
options?.fecSbn
|
|
7150
|
+
options?.fecSbn,
|
|
7151
|
+
options?.fecSbnFirst
|
|
6878
7152
|
);
|
|
6879
7153
|
if (outcome.record !== void 0) return outcome.record;
|
|
6880
7154
|
return this.#drop(outcome.reason);
|
|
@@ -6894,7 +7168,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6894
7168
|
* attribution exists to keep readable. Leaving the choice at the call site
|
|
6895
7169
|
* is what keeps both true.
|
|
6896
7170
|
*/
|
|
6897
|
-
#emitCombinedSample(combined, info, resolver, recovered, fecSbn) {
|
|
7171
|
+
#emitCombinedSample(combined, info, resolver, recovered, fecSbn, fecSbnFirst) {
|
|
6898
7172
|
const timing = resolver.sampleTiming(
|
|
6899
7173
|
combined.mpuSequenceNumber,
|
|
6900
7174
|
combined.movieFragmentSequenceNumber,
|
|
@@ -6911,6 +7185,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6911
7185
|
);
|
|
6912
7186
|
if (!meta) return { reason: "combined-meta-build-failed" };
|
|
6913
7187
|
if (fecSbn !== void 0) meta.fecSbn = fecSbn;
|
|
7188
|
+
if (fecSbnFirst !== void 0) meta.fecSbnFirst = fecSbnFirst;
|
|
6914
7189
|
if (!resolver.consumeSample(
|
|
6915
7190
|
combined.mpuSequenceNumber,
|
|
6916
7191
|
combined.movieFragmentSequenceNumber,
|
|
@@ -7144,6 +7419,9 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
7144
7419
|
for (const { sequencer } of this.#sequencers.values()) sequencer.discard();
|
|
7145
7420
|
this.#sequencers.clear();
|
|
7146
7421
|
this.#fecSequencer?.discard();
|
|
7422
|
+
for (const { awaitingTiming } of this.#timingStreams.values()) {
|
|
7423
|
+
for (const head of awaitingTiming) this.#leaveAwaitingTiming(head, "discarded");
|
|
7424
|
+
}
|
|
7147
7425
|
this.#timingStreams.clear();
|
|
7148
7426
|
this.#pendingTimingSamples = 0;
|
|
7149
7427
|
this.#reliableMoqStartupGate.clear();
|
|
@@ -7162,10 +7440,23 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
7162
7440
|
return resolver;
|
|
7163
7441
|
}
|
|
7164
7442
|
#awaitTiming(streamKey, head) {
|
|
7165
|
-
const
|
|
7166
|
-
if (!
|
|
7443
|
+
const state = this.#timingStreams.get(streamKey);
|
|
7444
|
+
if (!state) return;
|
|
7445
|
+
if (!head.options?.recovered) {
|
|
7446
|
+
const kept = state.awaitingTiming.filter((queued) => !queued.options?.recovered || queued.sequenceNumber !== head.sequenceNumber);
|
|
7447
|
+
this.#recoveredHeadsAwaitingTiming.superseded += state.awaitingTiming.length - kept.length;
|
|
7448
|
+
state.awaitingTiming = kept;
|
|
7449
|
+
}
|
|
7450
|
+
const awaitingTiming = state.awaitingTiming;
|
|
7167
7451
|
awaitingTiming.push(head);
|
|
7168
|
-
if (
|
|
7452
|
+
if (head.options?.recovered) this.#recoveredHeadsAwaitingTiming.held++;
|
|
7453
|
+
if (awaitingTiming.length > MAX_AWAITING_TIMING_HEADS) {
|
|
7454
|
+
this.#leaveAwaitingTiming(awaitingTiming.shift(), "expired");
|
|
7455
|
+
}
|
|
7456
|
+
}
|
|
7457
|
+
/** Count a recovered head leaving the queue other than by replay or its source copy. */
|
|
7458
|
+
#leaveAwaitingTiming(head, outcome) {
|
|
7459
|
+
if (head.options?.recovered) this.#recoveredHeadsAwaitingTiming[outcome]++;
|
|
7169
7460
|
}
|
|
7170
7461
|
/**
|
|
7171
7462
|
* Feed again the heads whose timing the FT=1 just admitted declares. That
|
|
@@ -7193,6 +7484,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
7193
7484
|
const state = this.#timingStreams.get(streamKey);
|
|
7194
7485
|
if (!state) return;
|
|
7195
7486
|
this.#timingStreams.delete(streamKey);
|
|
7487
|
+
for (const head of state.awaitingTiming) this.#leaveAwaitingTiming(head, "discarded");
|
|
7196
7488
|
this.#pendingTimingSamples -= state.resolver.pendingSampleCount;
|
|
7197
7489
|
if (this.#pendingTimingSamples < 0) {
|
|
7198
7490
|
throw new Error("[MmtpContainerParser] pending timing sample accounting underflow");
|
|
@@ -7967,7 +8259,7 @@ function validateCmsfMmtpCatalog(value, _options = {}) {
|
|
|
7967
8259
|
}
|
|
7968
8260
|
|
|
7969
8261
|
// src/no-modules.ts
|
|
7970
|
-
import { catalogFecInterleaveMs, fecBlockBudgetMs as fecBlockBudgetMs2, fecBlockDeadlineMs } from "@blockcast/mmt-fec";
|
|
8262
|
+
import { catalogFecInterleaveMs as catalogFecInterleaveMs2, fecBlockBudgetMs as fecBlockBudgetMs2, fecBlockDeadlineMs } from "@blockcast/mmt-fec";
|
|
7971
8263
|
|
|
7972
8264
|
// src/fec-state.ts
|
|
7973
8265
|
var FEC_INACTIVE_REASONS = Object.freeze([
|
|
@@ -8013,6 +8305,10 @@ function resolveFecState(evidence) {
|
|
|
8013
8305
|
return INACTIVE["reliable-moq"];
|
|
8014
8306
|
}
|
|
8015
8307
|
|
|
8308
|
+
// src/catalog-fec-params.ts
|
|
8309
|
+
import { catalogFecInterleaveMs } from "@blockcast/mmt-fec";
|
|
8310
|
+
var MAX_SAFE_TICKS_PER_HZ = Number.MAX_SAFE_INTEGER / 1e3;
|
|
8311
|
+
|
|
8016
8312
|
// src/mmtp-fec-session.ts
|
|
8017
8313
|
import { deriveFecRetentionBlocks, fecBlockBudgetMs } from "@blockcast/mmt-fec";
|
|
8018
8314
|
|
|
@@ -12003,7 +12299,7 @@ export {
|
|
|
12003
12299
|
catalogAmtNetworkSource,
|
|
12004
12300
|
catalogAtsc3NetworkSource,
|
|
12005
12301
|
catalogDeclaresFec,
|
|
12006
|
-
catalogFecInterleaveMs,
|
|
12302
|
+
catalogFecInterleaveMs2 as catalogFecInterleaveMs,
|
|
12007
12303
|
createWasmMmtpContainerParser,
|
|
12008
12304
|
datagramMfuReassembly,
|
|
12009
12305
|
fecBlockBudgetMs2 as fecBlockBudgetMs,
|
|
@@ -12013,7 +12309,9 @@ export {
|
|
|
12013
12309
|
reliableMoqMfuReassembly,
|
|
12014
12310
|
resolveFecState,
|
|
12015
12311
|
resolveGroupDurationMs,
|
|
12016
|
-
|
|
12312
|
+
runtimeFecCatalogReport,
|
|
12313
|
+
validateCmsfMmtpCatalog,
|
|
12314
|
+
validateFecCatalog
|
|
12017
12315
|
};
|
|
12018
12316
|
/*! Bundled license information:
|
|
12019
12317
|
|