@blockcast/mmt-container 2.2.0-main.cc080e5a56f2 → 2.2.0-main.cc3fe0684403
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 +88 -16
- package/dist/block-policy.d.ts.map +1 -1
- package/dist/block-policy.js +164 -56
- package/dist/block-policy.js.map +3 -3
- package/dist/browser-runtime.js +1485 -172
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +40 -1
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +163 -10
- package/dist/carp-catalog.js.map +4 -4
- package/dist/catalog-fec-params.d.ts +1 -1
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +48 -1
- package/dist/catalog-fec-params.js.map +3 -3
- package/dist/catalog-network-source.js +34 -0
- package/dist/catalog-network-source.js.map +3 -3
- package/dist/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/datagram-leg-deadline.d.ts +118 -0
- package/dist/datagram-leg-deadline.d.ts.map +1 -0
- package/dist/datagram-leg-deadline.js +217 -0
- package/dist/datagram-leg-deadline.js.map +7 -0
- package/dist/delivery-catalog.js +68 -0
- package/dist/delivery-catalog.js.map +4 -4
- package/dist/delta-fallback-config.js +39 -1
- package/dist/delta-fallback-config.js.map +4 -4
- package/dist/fec-manager.d.ts +155 -10
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +596 -81
- package/dist/fec-manager.js.map +4 -4
- package/dist/fec-state.d.ts +17 -5
- package/dist/fec-state.d.ts.map +1 -1
- package/dist/fec-state.js +41 -1
- package/dist/fec-state.js.map +3 -3
- package/dist/fec-worker-setup.js +34 -0
- package/dist/fec-worker-setup.js.map +3 -3
- package/dist/held-layer-admission.js +34 -0
- package/dist/held-layer-admission.js.map +3 -3
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.d.ts +16 -0
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +62 -0
- package/dist/iso-block-locator.js.map +3 -3
- package/dist/mfu-reassembler.js +34 -0
- package/dist/mfu-reassembler.js.map +3 -3
- package/dist/mmtp-container-parser.d.ts +30 -2
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +140 -2
- package/dist/mmtp-container-parser.js.map +3 -3
- package/dist/mmtp-container-parser.no-modules.js +293 -18
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +140 -2
- package/dist/mmtp-decode-pipeline.js.map +3 -3
- package/dist/mmtp-fec-session.js +34 -0
- package/dist/mmtp-fec-session.js.map +3 -3
- package/dist/mmtp-mode-selection.d.ts +48 -0
- package/dist/mmtp-mode-selection.d.ts.map +1 -0
- package/dist/mmtp-mode-selection.js +79 -0
- package/dist/mmtp-mode-selection.js.map +7 -0
- package/dist/mmtp-router.d.ts +66 -8
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +348 -27
- package/dist/mmtp-router.js.map +4 -4
- package/dist/multicast-auth-catalog.js +42 -2
- package/dist/multicast-auth-catalog.js.map +3 -3
- package/dist/multicast-input.js +42 -2
- package/dist/multicast-input.js.map +3 -3
- package/dist/multicast-manager.d.ts +108 -1
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +1067 -138
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.js +68 -0
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js +34 -0
- package/dist/multicast-unwrap.js.map +3 -3
- package/dist/no-modules.d.ts +1 -0
- package/dist/no-modules.d.ts.map +1 -1
- package/dist/no-modules.js +295 -19
- package/dist/no-modules.js.map +4 -4
- package/dist/phase14-catalog-override.d.ts +2 -1
- package/dist/phase14-catalog-override.d.ts.map +1 -1
- package/dist/phase14-catalog-override.js +69 -2
- package/dist/phase14-catalog-override.js.map +3 -3
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +50 -0
- package/dist/repair-fetch.js.map +3 -3
- package/dist/repair-layer-subscriptions.js +34 -0
- package/dist/repair-layer-subscriptions.js.map +3 -3
- package/dist/signaling.js +34 -0
- package/dist/signaling.js.map +3 -3
- package/dist/timestamp-codec.js +34 -0
- package/dist/timestamp-codec.js.map +3 -3
- package/dist/wasm-mfu-reassembler.js +34 -0
- package/dist/wasm-mfu-reassembler.js.map +3 -3
- package/dist/wasm-mmtp-container-parser.js +140 -2
- package/dist/wasm-mmtp-container-parser.js.map +3 -3
- package/package.json +5 -5
- package/schemas/catalog.schema.json +2 -2
- package/src/block-policy.ts +324 -83
- package/src/carp-catalog.ts +165 -5
- package/src/catalog-fec-params.ts +1 -0
- package/src/codec-utils.ts +121 -1
- package/src/datagram-leg-deadline.ts +342 -0
- package/src/fec-manager.ts +534 -41
- package/src/fec-state.ts +21 -5
- package/src/index.ts +38 -0
- package/src/iso-block-locator.ts +34 -0
- package/src/mmtp-container-parser.ts +57 -11
- package/src/mmtp-mode-selection.ts +80 -0
- package/src/mmtp-router.ts +287 -42
- package/src/multicast-manager.ts +218 -10
- package/src/no-modules.ts +3 -0
- package/src/phase14-catalog-override.ts +14 -3
- package/src/repair-fetch.ts +23 -0
- package/test-vectors/catalog/README.md +36 -2
- package/test-vectors/catalog/mmtp-siblings/ambiguous-sibling.json +158 -0
- package/test-vectors/catalog/mmtp-siblings/ladder-bitrate-only.json +231 -0
- package/test-vectors/catalog/mmtp-siblings/ladder-four-rungs.json +405 -0
- package/test-vectors/catalog/mmtp-siblings/ladder-other-names.json +231 -0
- package/test-vectors/catalog/mmtp-siblings/mmtp-mode-unknown.json +143 -0
- package/test-vectors/catalog/mmtp-siblings/multicast-endpoint-lists-datagram-track.json +143 -0
- package/test-vectors/catalog/mmtp-siblings/no-sibling.json +79 -0
- package/test-vectors/catalog/mmtp-siblings/rendition-mismatch.json +143 -0
- package/test-vectors/catalog/mmtp-siblings/stream-delivery-mode.json +143 -0
- package/test-vectors/catalog/mmtp-siblings/timescale-mismatch.json +143 -0
- package/test-vectors/catalog/mmtp-siblings/valid-pair.json +142 -0
- package/test-vectors/catalog/section-codes.json +3 -3
- package/test-vectors/catalog-timing.json +559 -1
- package/test-vectors/catalog-validation.json +266 -7
- package/test-vectors/moq/mmtp-mode-selection.json +259 -0
package/dist/mmtp-router.js
CHANGED
|
@@ -370,6 +370,40 @@ var RUNTIME_FEC_RECEIVER = Object.freeze({
|
|
|
370
370
|
overlays: true
|
|
371
371
|
});
|
|
372
372
|
|
|
373
|
+
// ../mmt-base/dist/mmtp-siblings.js
|
|
374
|
+
var MMTP_MODES = Object.freeze(["mfu", "mfu-datagram"]);
|
|
375
|
+
var MMTP_SIBLING_HARD_FIELDS = Object.freeze([
|
|
376
|
+
"namespace",
|
|
377
|
+
"timescale",
|
|
378
|
+
"presentationAnchorTicks",
|
|
379
|
+
"groupDuration"
|
|
380
|
+
]);
|
|
381
|
+
var MMTP_SIBLING_RENDITION_FIELDS = Object.freeze([
|
|
382
|
+
"codec",
|
|
383
|
+
"width",
|
|
384
|
+
"height",
|
|
385
|
+
"framerate",
|
|
386
|
+
"bitrate",
|
|
387
|
+
"samplerate",
|
|
388
|
+
"channelConfig",
|
|
389
|
+
"lang"
|
|
390
|
+
]);
|
|
391
|
+
var MMTP_SIBLING_SOFT_FIELDS = Object.freeze([
|
|
392
|
+
"initRef",
|
|
393
|
+
"keyframeIntervalMs",
|
|
394
|
+
"keyframeIntervalTicks",
|
|
395
|
+
"isLive",
|
|
396
|
+
"altGroup"
|
|
397
|
+
]);
|
|
398
|
+
|
|
399
|
+
// ../mmt-base/dist/datagram-leg-size.js
|
|
400
|
+
var DATAGRAM_LEG_UDP_FLOOR = 1200;
|
|
401
|
+
var DATAGRAM_LEG_QUIC_WT_FRAMING = 48;
|
|
402
|
+
var DATAGRAM_LEG_OBJECT_HEADER = 13;
|
|
403
|
+
var DATAGRAM_LEG_RELAY_ROOM = 16;
|
|
404
|
+
var DATAGRAM_LEG_DATAGRAM_MAX = DATAGRAM_LEG_UDP_FLOOR - DATAGRAM_LEG_QUIC_WT_FRAMING;
|
|
405
|
+
var DATAGRAM_LEG_BODY_MAX = DATAGRAM_LEG_DATAGRAM_MAX - DATAGRAM_LEG_OBJECT_HEADER - DATAGRAM_LEG_RELAY_ROOM;
|
|
406
|
+
|
|
373
407
|
// node_modules/@blockcast/mmt-transport/dist/multicast-tier.js
|
|
374
408
|
function endpointKey(endpoint) {
|
|
375
409
|
return `${endpoint.sourceAddress ?? ""}|${endpoint.groupAddress}|${endpoint.port}`;
|
|
@@ -620,6 +654,40 @@ var RUNTIME_FEC_RECEIVER2 = Object.freeze({
|
|
|
620
654
|
overlays: true
|
|
621
655
|
});
|
|
622
656
|
|
|
657
|
+
// node_modules/@blockcast/mmt-base/dist/mmtp-siblings.js
|
|
658
|
+
var MMTP_MODES2 = Object.freeze(["mfu", "mfu-datagram"]);
|
|
659
|
+
var MMTP_SIBLING_HARD_FIELDS2 = Object.freeze([
|
|
660
|
+
"namespace",
|
|
661
|
+
"timescale",
|
|
662
|
+
"presentationAnchorTicks",
|
|
663
|
+
"groupDuration"
|
|
664
|
+
]);
|
|
665
|
+
var MMTP_SIBLING_RENDITION_FIELDS2 = Object.freeze([
|
|
666
|
+
"codec",
|
|
667
|
+
"width",
|
|
668
|
+
"height",
|
|
669
|
+
"framerate",
|
|
670
|
+
"bitrate",
|
|
671
|
+
"samplerate",
|
|
672
|
+
"channelConfig",
|
|
673
|
+
"lang"
|
|
674
|
+
]);
|
|
675
|
+
var MMTP_SIBLING_SOFT_FIELDS2 = Object.freeze([
|
|
676
|
+
"initRef",
|
|
677
|
+
"keyframeIntervalMs",
|
|
678
|
+
"keyframeIntervalTicks",
|
|
679
|
+
"isLive",
|
|
680
|
+
"altGroup"
|
|
681
|
+
]);
|
|
682
|
+
|
|
683
|
+
// node_modules/@blockcast/mmt-base/dist/datagram-leg-size.js
|
|
684
|
+
var DATAGRAM_LEG_UDP_FLOOR2 = 1200;
|
|
685
|
+
var DATAGRAM_LEG_QUIC_WT_FRAMING2 = 48;
|
|
686
|
+
var DATAGRAM_LEG_OBJECT_HEADER2 = 13;
|
|
687
|
+
var DATAGRAM_LEG_RELAY_ROOM2 = 16;
|
|
688
|
+
var DATAGRAM_LEG_DATAGRAM_MAX2 = DATAGRAM_LEG_UDP_FLOOR2 - DATAGRAM_LEG_QUIC_WT_FRAMING2;
|
|
689
|
+
var DATAGRAM_LEG_BODY_MAX2 = DATAGRAM_LEG_DATAGRAM_MAX2 - DATAGRAM_LEG_OBJECT_HEADER2 - DATAGRAM_LEG_RELAY_ROOM2;
|
|
690
|
+
|
|
623
691
|
// node_modules/@blockcast/mmt-transport/dist/multicast-orchestrator.js
|
|
624
692
|
var DEFAULT_DWELL_MS = 3e3;
|
|
625
693
|
var DEFAULT_JOIN_DEADLINE_MS = 5e3;
|
|
@@ -4827,9 +4895,10 @@ function isH264IntraSlice(nal) {
|
|
|
4827
4895
|
const sliceType = readH264SliceType(nal);
|
|
4828
4896
|
return sliceType === 2 || sliceType === 4 || sliceType === 7 || sliceType === 9;
|
|
4829
4897
|
}
|
|
4898
|
+
var H264_SLICE_TYPE_ESCAPED_BYTES = 32;
|
|
4830
4899
|
function readH264SliceType(nal) {
|
|
4831
4900
|
if (nal.length < 2 || (nal[0] & 31) !== 1) return null;
|
|
4832
|
-
const rbsp = removeEmulationPrevention(nal.subarray(1));
|
|
4901
|
+
const rbsp = removeEmulationPrevention(nal.subarray(1, 1 + H264_SLICE_TYPE_ESCAPED_BYTES));
|
|
4833
4902
|
const state = { bitOffset: 0 };
|
|
4834
4903
|
if (readUnsignedExpGolomb(rbsp, state) === null) return null;
|
|
4835
4904
|
return readUnsignedExpGolomb(rbsp, state);
|
|
@@ -4976,6 +5045,96 @@ if (void 0) {
|
|
|
4976
5045
|
]))).toBe(false);
|
|
4977
5046
|
});
|
|
4978
5047
|
});
|
|
5048
|
+
describe("readH264SliceType", () => {
|
|
5049
|
+
const wholeNalSliceType = (nal) => {
|
|
5050
|
+
if (nal.length < 2 || (nal[0] & 31) !== 1) return null;
|
|
5051
|
+
const rbsp = removeEmulationPrevention(nal.subarray(1));
|
|
5052
|
+
const state = { bitOffset: 0 };
|
|
5053
|
+
if (readUnsignedExpGolomb(rbsp, state) === null) return null;
|
|
5054
|
+
return readUnsignedExpGolomb(rbsp, state);
|
|
5055
|
+
};
|
|
5056
|
+
const hex = (text2) => Uint8Array.from(text2.match(/../g), (byte) => parseInt(byte, 16));
|
|
5057
|
+
const ue = (value) => {
|
|
5058
|
+
const code = (value + 1).toString(2);
|
|
5059
|
+
return "0".repeat(code.length - 1) + code;
|
|
5060
|
+
};
|
|
5061
|
+
const sliceNal = (bits) => {
|
|
5062
|
+
const rbsp = `${bits}1`.padEnd(Math.ceil((bits.length + 1) / 8) * 8, "0").match(/.{8}/g);
|
|
5063
|
+
const nal = [1];
|
|
5064
|
+
let zeros = 0;
|
|
5065
|
+
for (const byte of rbsp.map((bits8) => parseInt(bits8, 2))) {
|
|
5066
|
+
if (zeros >= 2 && byte <= 3) {
|
|
5067
|
+
nal.push(3);
|
|
5068
|
+
zeros = 0;
|
|
5069
|
+
}
|
|
5070
|
+
nal.push(byte);
|
|
5071
|
+
zeros = byte === 0 ? zeros + 1 : 0;
|
|
5072
|
+
}
|
|
5073
|
+
return Uint8Array.from(nal);
|
|
5074
|
+
};
|
|
5075
|
+
const x264Slices = [
|
|
5076
|
+
["64x48 P", hex("419a231885bfd53888f63ef5b1e1e39b9ff2eabf03fd3f4d7d4317ffcbf75176"), 5, false],
|
|
5077
|
+
["64x48 B", hex("419e414212fffeeade283707cb70f7"), 6, false],
|
|
5078
|
+
["64x48 non-IDR I", hex(
|
|
5079
|
+
"4128899037f384db2be0cfe48aa23558781dd429f7db8e8a6ae44f7ca2333ba1029477da6ddfeac61843c5680cbf66247469d64549b0f5f7ca6acc529f5cf032b35d8dedc6b2412ece24f42f80b593fc0f3ff47a08c84799ff2ada18ac39a527e23eb34c8167fd"
|
|
5080
|
+
), 7, true],
|
|
5081
|
+
["1280x720 B, escape at byte 10", hex(
|
|
5082
|
+
"01006e27a81109ff000003016b662ea5ea46000f57880f3fb0d3f03ff7dac0546fc9966a5f6d86cb795db178882f6e19b75d92170917306190f262fd58268702db2eff86a9651e48"
|
|
5083
|
+
), 6, false],
|
|
5084
|
+
["1280x720 P, escape at byte 15", hex(
|
|
5085
|
+
"41006e26a8cd1329e1bffea784000003002b5ef096f0320bd99f00037f22327e886223b7996bb04acd35ad9a0385f02c1801eb6226bc94993d1880172ffbb23db74729569b6f3934cba0cba17b7c29ce0e216080cb7b18e5876df59e85302da9cba203fe6769178a2e02eeaa54a6f87568cbaa019a3442eae19c8a7adc8cd02441bee573c5408b6552abd2d9d3"
|
|
5086
|
+
), 5, false],
|
|
5087
|
+
["1280x720 B, escape at byte 22", hex("01006e27da9109ff01a4c1dbc27ed915a3172ec80000030352"), 6, false],
|
|
5088
|
+
["7680x4320 IDR, first_mb_in_slice 97440", hex(
|
|
5089
|
+
"650000be5088843a118a000218f1c00040f63800087949c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9c9"
|
|
5090
|
+
), null, true],
|
|
5091
|
+
["7680x4320 P, first_mb_in_slice 32640", hex(
|
|
5092
|
+
"410003fc09a20a806ff0ae0085a611cc7ad5f2020e25900ba4c3398016b57e100011021220200020"
|
|
5093
|
+
), 5, false],
|
|
5094
|
+
["7680x4320 P, first_mb_in_slice 97440", hex(
|
|
5095
|
+
"410000be509a20a8078f5a83cc40d800783b017f5c6d7e4883fb4801a9c569245bd04135f7c00806"
|
|
5096
|
+
), 5, false]
|
|
5097
|
+
];
|
|
5098
|
+
const syntheticSlices = [
|
|
5099
|
+
["an escape inside first_mb_in_slice", sliceNal(ue(2 ** 24 - 1) + ue(2)), 2],
|
|
5100
|
+
["an escape between the fields", sliceNal(ue(2 ** 21 - 1) + ue(7)), 7],
|
|
5101
|
+
["an escape inside slice_type", sliceNal(ue(0) + ue(2 ** 22 - 1)), 2 ** 22 - 1],
|
|
5102
|
+
["the longest fields, five escapes", sliceNal(ue(2 ** 30 - 1) + ue(2 ** 30 - 1)), 2 ** 30 - 1],
|
|
5103
|
+
["the largest values", sliceNal(ue(2 ** 31 - 2) + ue(2 ** 31 - 2)), 2 ** 31 - 2],
|
|
5104
|
+
["31 leading zeros in first_mb_in_slice", sliceNal(`${"0".repeat(31)}1`), null],
|
|
5105
|
+
["31 leading zeros in slice_type", sliceNal(`1${"0".repeat(31)}1`), null],
|
|
5106
|
+
["escapes running past the slice header", sliceNal(ue(0) + ue(5) + "0".repeat(400)), 5]
|
|
5107
|
+
];
|
|
5108
|
+
test("reads the slice_type of real and synthetic slices", () => {
|
|
5109
|
+
for (const [name, nal, sliceType] of [...x264Slices, ...syntheticSlices]) {
|
|
5110
|
+
expect(readH264SliceType(nal), name).toBe(sliceType);
|
|
5111
|
+
}
|
|
5112
|
+
});
|
|
5113
|
+
test("matches the whole-NAL unescape at every truncation", () => {
|
|
5114
|
+
for (const [name, nal] of [...x264Slices, ...syntheticSlices]) {
|
|
5115
|
+
for (let end = 0; end <= nal.length; end++) {
|
|
5116
|
+
const cut = nal.subarray(0, end);
|
|
5117
|
+
expect(readH264SliceType(cut), `${name}, first ${end} bytes`).toBe(wholeNalSliceType(cut));
|
|
5118
|
+
}
|
|
5119
|
+
}
|
|
5120
|
+
});
|
|
5121
|
+
test("matches the whole-NAL unescape on zero-heavy NAL units", () => {
|
|
5122
|
+
const bytes = [0, 0, 0, 3, 1, 2, 128, 255];
|
|
5123
|
+
let seed = 1;
|
|
5124
|
+
const next = () => (seed = Math.imul(seed, 1103515245) + 12345 >>> 0) >>> 16;
|
|
5125
|
+
for (let i = 0; i < 5e3; i++) {
|
|
5126
|
+
const nal = new Uint8Array(2 + next() % 63);
|
|
5127
|
+
nal[0] = 65;
|
|
5128
|
+
for (let j = 1; j < nal.length; j++) nal[j] = bytes[next() % bytes.length];
|
|
5129
|
+
expect(readH264SliceType(nal), Array.from(nal).join()).toBe(wholeNalSliceType(nal));
|
|
5130
|
+
}
|
|
5131
|
+
});
|
|
5132
|
+
test("classifies the x264 slices as keyframes or not", () => {
|
|
5133
|
+
for (const [name, nal, , keyframe] of x264Slices) {
|
|
5134
|
+
expect(classifyH264Keyframe(rawH264NalToAvcc(nal), { allowPartialAvcc: true }), name).toBe(keyframe);
|
|
5135
|
+
}
|
|
5136
|
+
});
|
|
5137
|
+
});
|
|
4979
5138
|
describe("avccToAnnexB", () => {
|
|
4980
5139
|
test("converts with SPS/PPS on keyframe", () => {
|
|
4981
5140
|
const avcc = new Uint8Array([0, 0, 0, 3, 101, 170, 187]);
|
|
@@ -8329,7 +8488,7 @@ var FecReleaseSequencer = class {
|
|
|
8329
8488
|
from
|
|
8330
8489
|
);
|
|
8331
8490
|
unresolved = resolved === null;
|
|
8332
|
-
if (unresolved && !this.#cursorPassed(stream, asUnanchored)) {
|
|
8491
|
+
if (unresolved && !this.#cursorPassed(stream, asUnanchored) && !this.#unrepairableWaitOver(stream, last, head, from, to)) {
|
|
8333
8492
|
const heldMs = performance.now() - head.arrivedAtMs;
|
|
8334
8493
|
if (heldMs <= this.#gate.holdLimitMs(stream.packetId, stream.catalogTrackName)) return;
|
|
8335
8494
|
this.#recordStat("forcedWindowFlushes");
|
|
@@ -8347,6 +8506,19 @@ var FecReleaseSequencer = class {
|
|
|
8347
8506
|
);
|
|
8348
8507
|
}
|
|
8349
8508
|
}
|
|
8509
|
+
/**
|
|
8510
|
+
* The head has waited out a gap only a late source can still fill
|
|
8511
|
+
* (FecReleaseGate.unrepairableWaitMs). Not yet: the gate is asked to poke
|
|
8512
|
+
* the stream when it has (`wakeAt`), since no packet may come by then.
|
|
8513
|
+
*/
|
|
8514
|
+
#unrepairableWaitOver(stream, last, head, from, to) {
|
|
8515
|
+
const waitMs = this.#gate.unrepairableWaitMs?.(last, head, from, to);
|
|
8516
|
+
if (waitMs === void 0) return false;
|
|
8517
|
+
const atMs = head.arrivedAtMs + waitMs;
|
|
8518
|
+
if (performance.now() >= atMs) return true;
|
|
8519
|
+
this.#gate.wakeAt?.(stream.packetId, stream.catalogTrackName, atMs);
|
|
8520
|
+
return false;
|
|
8521
|
+
}
|
|
8350
8522
|
/**
|
|
8351
8523
|
* An overlay-rebuilt frame (fecSbnFirst) waits no longer than the BLO-53342
|
|
8352
8524
|
* source cursor holds it unanchored, and neither does a later frame behind
|
|
@@ -10157,6 +10329,20 @@ var MmtpRouter = class {
|
|
|
10157
10329
|
/** The flow whose receiver admitted a stream's source datagrams, by packetId then catalog track name: recovered packets answer to it. */
|
|
10158
10330
|
#provenanceStreamFlow = /* @__PURE__ */ new Map();
|
|
10159
10331
|
#unregisteredFlowDrops = 0;
|
|
10332
|
+
/** "mfu-datagram" leg packets of a packet id the ingress does not name (never the signaling flow). */
|
|
10333
|
+
#datagramLegIngressDrops = 0;
|
|
10334
|
+
/** "mfu-datagram" leg packets of the signaling flow (packet id 0): expected, one per group. */
|
|
10335
|
+
#datagramLegSignalingPackets = 0;
|
|
10336
|
+
/**
|
|
10337
|
+
* The streams a live "mfu-datagram" leg has fed, catalog track names by
|
|
10338
|
+
* packet id: their ledgers and release gate take the leg's bounds. A stream
|
|
10339
|
+
* leaves when its leg does: `endDatagramLeg`, `resetTrack`, `dispose`, or
|
|
10340
|
+
* the first multicast packet of its packet id (the ordered switch retires
|
|
10341
|
+
* the leg first). The "mfu" sibling shares the packet id, never the name.
|
|
10342
|
+
*/
|
|
10343
|
+
#datagramLegStreams = /* @__PURE__ */ new Map();
|
|
10344
|
+
/** The leg's presentation budget (setDatagramLegPresentationBudget), or null: no presentation bound. */
|
|
10345
|
+
#datagramLegPresentationBudgetMs = null;
|
|
10160
10346
|
#ambiguousRecoveredDrops = 0;
|
|
10161
10347
|
// Temp state set by #processMMTP before calling parser.feed(),
|
|
10162
10348
|
// read by the parser's onFrame callback for CMAF assembly + dedup.
|
|
@@ -10262,6 +10448,8 @@ var MmtpRouter = class {
|
|
|
10262
10448
|
// end: a synchronous recovery completes its block BEFORE routing the
|
|
10263
10449
|
// recovered frames, and releasing a held gap in between would strand them.
|
|
10264
10450
|
#fecPokeDepth = 0;
|
|
10451
|
+
/** FecReleaseGate.wakeAt timers, by media stream key. */
|
|
10452
|
+
#fecWakes = /* @__PURE__ */ new Map();
|
|
10265
10453
|
#pendingFecPokes = /* @__PURE__ */ new Map();
|
|
10266
10454
|
// ── Phase 14: per-role packetId dispatch (D-26, D-27, D-28) ───────
|
|
10267
10455
|
/** Maps packetId → TrackRole. Default: 'single' when absent (legacy path). */
|
|
@@ -10530,10 +10718,11 @@ var MmtpRouter = class {
|
|
|
10530
10718
|
const blockLifetimeMs = fec.blockLifetimeMsForPacket(packetId);
|
|
10531
10719
|
if (blockSpanMs === void 0 || blockLifetimeMs === void 0) return NO_FEC_GEOMETRY_HORIZON;
|
|
10532
10720
|
if (blockSpanMs === 0) return NO_BLOCK_SPAN_HORIZON;
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
retentionMs
|
|
10536
|
-
}
|
|
10721
|
+
let retentionMs = duplicateRetentionMs({ blockSpanMs, blockLifetimeMs });
|
|
10722
|
+
if (this.#datagramLegStreams.has(packetId)) {
|
|
10723
|
+
retentionMs = Math.max(retentionMs, fec.datagramLegLedgerRetentionMsForPacket?.(packetId) ?? 0);
|
|
10724
|
+
}
|
|
10725
|
+
return { kind: "fec-horizon", retentionMs };
|
|
10537
10726
|
}
|
|
10538
10727
|
/**
|
|
10539
10728
|
* Init segments rejected since construction because their packetId had no
|
|
@@ -10956,7 +11145,7 @@ var MmtpRouter = class {
|
|
|
10956
11145
|
const blockStart = placement.block.start;
|
|
10957
11146
|
if (placement.span !== void 0) this.#replayOverlaySources(inst, placement.span.block.start, placement.span.placed);
|
|
10958
11147
|
this.#replayOverlaySources(inst, blockStart, placement.placed);
|
|
10959
|
-
if (source
|
|
11148
|
+
if (source !== "multicast") this.#noteOverlayMoqBlock(inst, blockStart);
|
|
10960
11149
|
const alreadyCompleted = fec.isBlockCompleted(blockStart, pid, name);
|
|
10961
11150
|
const recovered = fec.feedRepairSymbol(pid, repair.ssStart, repair.ssbLength, repair.rsId, repair.symbolData, name);
|
|
10962
11151
|
if (recovered && !alreadyCompleted) this.#routeOverlayRecovered(inst, blockStart, recovered);
|
|
@@ -10964,7 +11153,7 @@ var MmtpRouter = class {
|
|
|
10964
11153
|
#replayOverlaySources(inst, blockStart, placed) {
|
|
10965
11154
|
const { fec, repairPacketId: pid, streamName: name } = inst;
|
|
10966
11155
|
for (const { ssId, payload } of placed) {
|
|
10967
|
-
if (payload.source
|
|
11156
|
+
if (payload.source !== "multicast") this.#noteOverlayMoqBlock(inst, blockStart);
|
|
10968
11157
|
if (payload.oversized) continue;
|
|
10969
11158
|
const alreadyCompleted = fec.isBlockCompleted(blockStart, pid, name);
|
|
10970
11159
|
const recovered = fec.feedSourceSymbol(pid, ssId, payload.symbolData, name);
|
|
@@ -11017,7 +11206,7 @@ var MmtpRouter = class {
|
|
|
11017
11206
|
});
|
|
11018
11207
|
continue;
|
|
11019
11208
|
}
|
|
11020
|
-
if (source
|
|
11209
|
+
if (source !== "multicast") this.#noteOverlayMoqBlock(inst, coords.sbn);
|
|
11021
11210
|
if (oversized) continue;
|
|
11022
11211
|
const alreadyCompleted = fec.isBlockCompleted(coords.sbn, pid, name);
|
|
11023
11212
|
const recovered = fec.feedSourceSymbol(pid, ssId, symbolData, name);
|
|
@@ -11606,6 +11795,46 @@ var MmtpRouter = class {
|
|
|
11606
11795
|
get unregisteredFlowDropCount() {
|
|
11607
11796
|
return this.#unregisteredFlowDrops;
|
|
11608
11797
|
}
|
|
11798
|
+
/** "mfu-datagram" leg packets dropped because the leg's ingress does not name their packet id (packet id 0 apart). */
|
|
11799
|
+
get datagramLegIngressDropCount() {
|
|
11800
|
+
return this.#datagramLegIngressDrops;
|
|
11801
|
+
}
|
|
11802
|
+
/** "mfu-datagram" leg packets of the MMTP signaling flow (packet id 0), which no track owns. */
|
|
11803
|
+
get datagramLegSignalingPacketCount() {
|
|
11804
|
+
return this.#datagramLegSignalingPackets;
|
|
11805
|
+
}
|
|
11806
|
+
/**
|
|
11807
|
+
* The "mfu-datagram" leg's presentation bound (mmt-02 6.1 step 6): how
|
|
11808
|
+
* long after a frame arrives it must leave the release gate when the gap
|
|
11809
|
+
* before it holds no RAP, FT=0 or FT=1 data (the player's presentation
|
|
11810
|
+
* delay less its decode lead). The gap is then decided at the earlier of
|
|
11811
|
+
* the FEC block deadline and this bound; a gap that may hold a RAP keeps
|
|
11812
|
+
* the block deadline. Null, or a value that is not finite and positive:
|
|
11813
|
+
* the block deadline alone, as on multicast.
|
|
11814
|
+
*/
|
|
11815
|
+
setDatagramLegPresentationBudget(budgetMs) {
|
|
11816
|
+
this.#datagramLegPresentationBudgetMs = budgetMs;
|
|
11817
|
+
}
|
|
11818
|
+
/**
|
|
11819
|
+
* The "mfu-datagram" leg is over (unsubscribed, or switched to another
|
|
11820
|
+
* path): no stream keeps its presentation bound or its ledger retention.
|
|
11821
|
+
* Parser, FEC and ledger state stay, so the packet ids continue on the
|
|
11822
|
+
* next path without an epoch. A later leg datagram starts a leg again.
|
|
11823
|
+
*/
|
|
11824
|
+
endDatagramLeg() {
|
|
11825
|
+
this.#datagramLegStreams.clear();
|
|
11826
|
+
this.#datagramLegPresentationBudgetMs = null;
|
|
11827
|
+
}
|
|
11828
|
+
#datagramLegPresentationWaitMs(packetId, catalogTrackName) {
|
|
11829
|
+
if (this.#datagramLegPresentationBudgetMs === null || this.#datagramLegStreams.get(packetId)?.has(catalogTrackName) !== true) return void 0;
|
|
11830
|
+
let budgetMs;
|
|
11831
|
+
try {
|
|
11832
|
+
budgetMs = this.#datagramLegPresentationBudgetMs(packetId, catalogTrackName);
|
|
11833
|
+
} catch {
|
|
11834
|
+
return void 0;
|
|
11835
|
+
}
|
|
11836
|
+
return Number.isFinite(budgetMs) && budgetMs > 0 ? budgetMs : void 0;
|
|
11837
|
+
}
|
|
11609
11838
|
/** Recovered packets dropped because more than one protected flow could own their stream. */
|
|
11610
11839
|
get ambiguousRecoveredDropCount() {
|
|
11611
11840
|
return this.#ambiguousRecoveredDrops;
|
|
@@ -11623,6 +11852,10 @@ var MmtpRouter = class {
|
|
|
11623
11852
|
* caller that forgot it silently attributed its bytes to a multicast socket
|
|
11624
11853
|
* they may never have crossed — and that attribution is what the physical-
|
|
11625
11854
|
* delivery evidence path is built on. Absence is not multicast; say which.
|
|
11855
|
+
* `"moq-datagram"` is an "mfu-datagram" subscription (MmtpIngestSource):
|
|
11856
|
+
* `ingress.tracks` MUST name the datagram catalog track for its packet id,
|
|
11857
|
+
* and a packet of a packet id it does not name is dropped and counted
|
|
11858
|
+
* (`datagramLegIngressDropCount`; the signaling flow, packet id 0, apart).
|
|
11626
11859
|
*/
|
|
11627
11860
|
feedPacket(packet, source, ingress) {
|
|
11628
11861
|
if (this.#disposed) return;
|
|
@@ -11672,15 +11905,18 @@ var MmtpRouter = class {
|
|
|
11672
11905
|
}
|
|
11673
11906
|
/**
|
|
11674
11907
|
* Feed a repair packet from MoQ (reliable QUIC) — parses MMTP repair
|
|
11675
|
-
* header and delegates to FECManager for FEC recovery.
|
|
11908
|
+
* header and delegates to FECManager for FEC recovery. `source` is
|
|
11909
|
+
* `"moq-datagram"` for a repair object of an "mfu-datagram" track's repair
|
|
11910
|
+
* track, which arrives as a datagram and so counts as an in-band symbol of
|
|
11911
|
+
* the leg; a FETCHed repair stays `"moq"` (RepairVia `quic`).
|
|
11676
11912
|
*/
|
|
11677
|
-
feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName) {
|
|
11913
|
+
feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source = "moq") {
|
|
11678
11914
|
if (this.#disposed) return;
|
|
11679
11915
|
this.#withDeferredFecPokes(() => {
|
|
11680
|
-
this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName);
|
|
11916
|
+
this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source);
|
|
11681
11917
|
});
|
|
11682
11918
|
}
|
|
11683
|
-
#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, admitted = false) {
|
|
11919
|
+
#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source, admitted = false) {
|
|
11684
11920
|
let header;
|
|
11685
11921
|
try {
|
|
11686
11922
|
header = parseMMTPHeader(packet);
|
|
@@ -11690,7 +11926,7 @@ var MmtpRouter = class {
|
|
|
11690
11926
|
const repairPacketId = header.packetId;
|
|
11691
11927
|
const overlay = this.#overlayRepairTarget(repairPacketId, repairTrackName);
|
|
11692
11928
|
if (overlay !== void 0) {
|
|
11693
|
-
this.#routeOverlayRepair(overlay, repairPacketId, packet, header,
|
|
11929
|
+
this.#routeOverlayRepair(overlay, repairPacketId, packet, header, source);
|
|
11694
11930
|
return;
|
|
11695
11931
|
}
|
|
11696
11932
|
const hintedOwner = ownerPacketIdHint != null && this.#classifyPacketId(ownerPacketIdHint) !== null ? ownerPacketIdHint : null;
|
|
@@ -11702,7 +11938,7 @@ var MmtpRouter = class {
|
|
|
11702
11938
|
}
|
|
11703
11939
|
let unlisted = false;
|
|
11704
11940
|
if (ownerPacketId != null && !admitted) {
|
|
11705
|
-
const admit = this.#admitUnicast(repairPacketId, packet, () => this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, true));
|
|
11941
|
+
const admit = this.#admitUnicast(repairPacketId, packet, () => this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source, true));
|
|
11706
11942
|
if (admit === "held" || admit === "dropped") return;
|
|
11707
11943
|
unlisted = admit === "unlisted";
|
|
11708
11944
|
}
|
|
@@ -11723,7 +11959,7 @@ var MmtpRouter = class {
|
|
|
11723
11959
|
this.#noteUnreadableFecPayloadId(ownerPacketId, "repair");
|
|
11724
11960
|
return;
|
|
11725
11961
|
}
|
|
11726
|
-
this.#handleIsoRepair(ownerPacketId, catalogTrackName, parsed,
|
|
11962
|
+
this.#handleIsoRepair(ownerPacketId, catalogTrackName, parsed, source, repairTrackName);
|
|
11727
11963
|
}
|
|
11728
11964
|
}
|
|
11729
11965
|
// ── Packet FEC geometry and block profile ───────────────────────
|
|
@@ -11928,6 +12164,7 @@ var MmtpRouter = class {
|
|
|
11928
12164
|
debugRouter(
|
|
11929
12165
|
`[MmtpRouter] Dropping repair packet pid=${packetId}: physical PID is unregistered`
|
|
11930
12166
|
);
|
|
12167
|
+
this.#fecManager?.countUnresolvedRepairOwner?.("unregistered");
|
|
11931
12168
|
return null;
|
|
11932
12169
|
}
|
|
11933
12170
|
const registeredOwners = this.#repairOwnersByPacketId.get(packetId) ?? /* @__PURE__ */ new Set();
|
|
@@ -11936,6 +12173,7 @@ var MmtpRouter = class {
|
|
|
11936
12173
|
debugRouter(
|
|
11937
12174
|
`[MmtpRouter] Dropping repair packet pid=${packetId}: catalog owner is ${owners.length === 0 ? "absent" : "ambiguous"}`
|
|
11938
12175
|
);
|
|
12176
|
+
this.#fecManager?.countUnresolvedRepairOwner?.(owners.length === 0 ? "ownerAbsent" : "ownerAmbiguous");
|
|
11939
12177
|
return null;
|
|
11940
12178
|
}
|
|
11941
12179
|
/** Route a recovered FEC block through the parser + dedup pipeline.
|
|
@@ -11985,6 +12223,8 @@ var MmtpRouter = class {
|
|
|
11985
12223
|
}
|
|
11986
12224
|
this.#parser.resetTrack(packetId, catalogTrackName);
|
|
11987
12225
|
this.resetKeyframeOverlays(packetId, catalogTrackName);
|
|
12226
|
+
const legNames = this.#datagramLegStreams.get(packetId);
|
|
12227
|
+
if (legNames?.delete(catalogTrackName) && legNames.size === 0) this.#datagramLegStreams.delete(packetId);
|
|
11988
12228
|
this.#restampedStreams.delete(this.#mediaStreamKey(packetId, catalogTrackName));
|
|
11989
12229
|
const assistPrefix = assistKey(packetId, catalogTrackName, 0).slice(0, -1);
|
|
11990
12230
|
for (const key of this.#assistBlocks.keys()) if (key.startsWith(assistPrefix)) this.#assistBlocks.delete(key);
|
|
@@ -12322,8 +12562,11 @@ var MmtpRouter = class {
|
|
|
12322
12562
|
this.#disposed = true;
|
|
12323
12563
|
this.#staged = null;
|
|
12324
12564
|
this.cancelKeyframeLostTimer();
|
|
12565
|
+
for (const { timer } of this.#fecWakes.values()) clearTimeout(timer);
|
|
12566
|
+
this.#fecWakes.clear();
|
|
12325
12567
|
this.#parser.dispose();
|
|
12326
12568
|
this.#streams.clear();
|
|
12569
|
+
this.endDatagramLeg();
|
|
12327
12570
|
this.#trackPacketCallbacks.clear();
|
|
12328
12571
|
this.#latestVideoSeqByStream.clear();
|
|
12329
12572
|
this.#lastDirectSourceVideoTsByStream.clear();
|
|
@@ -12503,6 +12746,38 @@ var MmtpRouter = class {
|
|
|
12503
12746
|
if (!fec?.terminalRetentionMsForPacket) return Infinity;
|
|
12504
12747
|
return fec.terminalRetentionMsForPacket(packetId) ?? 0;
|
|
12505
12748
|
},
|
|
12749
|
+
// Once no repair can fill a gap (FECManager.isoRepairlessWaitMs: only a
|
|
12750
|
+
// late source can), its frame waits the late-symbol allowance when the
|
|
12751
|
+
// gap holds no RAP an installed keyframe overlay could still rebuild:
|
|
12752
|
+
// lost deltas of one MPU (delta-lost), the tail of the MPU before a RAP
|
|
12753
|
+
// that opens the next one while MPU boundaries bound RAPs (rap-next,
|
|
12754
|
+
// unless the gap holds a stated block's loss: the overlay may rebuild
|
|
12755
|
+
// that MPU's FT=0, and the block's group then complete it), or
|
|
12756
|
+
// an audio gap. A gap that may hold one (rap-lost, rap-unknown, or any
|
|
12757
|
+
// other rap-next, whose gap may hold a whole MPU and the keyframe the
|
|
12758
|
+
// overlay protects) waits for that overlay's repair too (BLO-52085
|
|
12759
|
+
// D4). A run no repair has delimited instead waits for its FEC
|
|
12760
|
+
// deadline, whatever the decision (FECManager.isoRepairlessWaitMs). The
|
|
12761
|
+
// FEC check comes first: most held gaps are not behind such a span, and
|
|
12762
|
+
// deciding one scans both frames' bitstreams.
|
|
12763
|
+
unrepairableWaitMs: (before, after, fromSbn, toSbn) => {
|
|
12764
|
+
const fec = this.#fecManager;
|
|
12765
|
+
const { packetId, catalogTrackName } = after.meta;
|
|
12766
|
+
const arrivedAtMs = after.arrivedAtMs;
|
|
12767
|
+
const allowanceMs = fec?.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, false, false, arrivedAtMs);
|
|
12768
|
+
const presentationMs = this.#datagramLegPresentationWaitMs(packetId, catalogTrackName);
|
|
12769
|
+
if (!fec || allowanceMs === void 0 && presentationMs === void 0) return void 0;
|
|
12770
|
+
const decision = this.#decideGap(before, after, [], false);
|
|
12771
|
+
const mpu = before.meta.mpuSequenceNumber;
|
|
12772
|
+
const intoNextMpu = decision.reason === "rap-next" && mpu !== void 0 && after.meta.mpuSequenceNumber === mpu + 1 >>> 0 && fec.mpuBoundsRapsFor?.(packetId, catalogTrackName) === true;
|
|
12773
|
+
if (decision.action === "stall" || decision.reason === "rap-next" && !intoNextMpu) {
|
|
12774
|
+
return allowanceMs === void 0 ? void 0 : fec.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, true, false, arrivedAtMs);
|
|
12775
|
+
}
|
|
12776
|
+
const waitMs = allowanceMs === void 0 ? void 0 : decision.reason === "rap-next" ? fec.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, false, true, arrivedAtMs) : allowanceMs;
|
|
12777
|
+
if (decision.reason === "delta-lost" && !((fec.interleaveDepthMsForPacket?.(packetId) ?? 0) > 0)) return waitMs;
|
|
12778
|
+
if (presentationMs === void 0) return waitMs;
|
|
12779
|
+
return waitMs === void 0 ? presentationMs : Math.min(waitMs, presentationMs);
|
|
12780
|
+
},
|
|
12506
12781
|
decide: (before, after, lostBlocks, discontinuity) => {
|
|
12507
12782
|
const decision = this.#decideGap(before, after, lostBlocks, discontinuity);
|
|
12508
12783
|
this.#onFrameGap?.(decision);
|
|
@@ -12512,6 +12787,20 @@ var MmtpRouter = class {
|
|
|
12512
12787
|
onRap: (packetId, catalogTrackName, ssId) => {
|
|
12513
12788
|
for (const observer of this.#fecRapObservers) observer(packetId, catalogTrackName, ssId);
|
|
12514
12789
|
},
|
|
12790
|
+
// One timer per stream, at the earliest wake asked: its drain re-arms
|
|
12791
|
+
// for the next frame still waiting.
|
|
12792
|
+
wakeAt: (packetId, catalogTrackName, atMs) => {
|
|
12793
|
+
if (this.#disposed) return;
|
|
12794
|
+
const key = this.#mediaStreamKey(packetId, catalogTrackName);
|
|
12795
|
+
const armed = this.#fecWakes.get(key);
|
|
12796
|
+
if (armed !== void 0 && armed.atMs <= atMs) return;
|
|
12797
|
+
if (armed !== void 0) clearTimeout(armed.timer);
|
|
12798
|
+
const timer = setTimeout(() => {
|
|
12799
|
+
this.#fecWakes.delete(key);
|
|
12800
|
+
this.#requestFecPoke(packetId, catalogTrackName);
|
|
12801
|
+
}, Math.max(0, Math.ceil(atMs - performance.now())));
|
|
12802
|
+
this.#fecWakes.set(key, { atMs, timer });
|
|
12803
|
+
},
|
|
12515
12804
|
// A staged switch commits on when each side's frames reach it
|
|
12516
12805
|
// (#interceptSwitchFrame): both sides' overlay keyframes reach it when
|
|
12517
12806
|
// they did unanchored.
|
|
@@ -12529,7 +12818,8 @@ var MmtpRouter = class {
|
|
|
12529
12818
|
meta.catalogTrackName,
|
|
12530
12819
|
meta.mpuSequenceNumber,
|
|
12531
12820
|
timing.presentationTime,
|
|
12532
|
-
timing.mediaTimescale
|
|
12821
|
+
timing.mediaTimescale,
|
|
12822
|
+
timing.decodeTime
|
|
12533
12823
|
);
|
|
12534
12824
|
}
|
|
12535
12825
|
};
|
|
@@ -12547,8 +12837,20 @@ var MmtpRouter = class {
|
|
|
12547
12837
|
#decideGap(before, after, lostBlocks, discontinuity) {
|
|
12548
12838
|
const { packetId, catalogTrackName } = after.meta;
|
|
12549
12839
|
const trackKind = this.#classifyPacketId(packetId) === false ? "audio" : "video";
|
|
12550
|
-
const positionsTrusted = this.#fecManager?.classifierModeFor?.(packetId, catalogTrackName).mode === "classifying";
|
|
12551
|
-
const
|
|
12840
|
+
const positionsTrusted = this.#fecManager?.classifierModeFor?.(packetId, catalogTrackName).mode === "classifying" && before.meta.movieFragmentSequenceNumber === after.meta.movieFragmentSequenceNumber;
|
|
12841
|
+
const mpu = before.meta.mpuSequenceNumber;
|
|
12842
|
+
const sameMpu = trackKind === "video" && mpu !== void 0 && after.meta.mpuSequenceNumber === mpu;
|
|
12843
|
+
const mpuTrusted = this.#fecManager?.mpuBoundsRapsFor?.(
|
|
12844
|
+
packetId,
|
|
12845
|
+
catalogTrackName,
|
|
12846
|
+
sameMpu ? {
|
|
12847
|
+
mpu,
|
|
12848
|
+
from: before.meta.authoredTiming,
|
|
12849
|
+
to: after.meta.authoredTiming,
|
|
12850
|
+
fromSsId: before.meta.fecSbn,
|
|
12851
|
+
toSsId: after.meta.fecSbnFirst ?? after.meta.fecSbn
|
|
12852
|
+
} : void 0
|
|
12853
|
+
) === true;
|
|
12552
12854
|
const evidence = (frame) => {
|
|
12553
12855
|
const timing = frame.meta.authoredTiming;
|
|
12554
12856
|
const sampleNumber = frame.meta.sampleNumber;
|
|
@@ -12664,18 +12966,34 @@ var MmtpRouter = class {
|
|
|
12664
12966
|
if (manifestAdmitted && !info.isRepair && ingress?.admittedBy !== USER_AGENT_VERIFIED) this.#admittedSourceDatagrams++;
|
|
12665
12967
|
if (source === "multicast" && !manifestAdmitted) {
|
|
12666
12968
|
this.#fecManager?.noteMulticastArrival?.(info.packetId, info.sequenceNumber);
|
|
12969
|
+
} else if (source === "moq-datagram" && !manifestAdmitted) {
|
|
12970
|
+
this.#fecManager?.noteArrival?.("moq-datagram", info.packetId, info.sequenceNumber);
|
|
12667
12971
|
}
|
|
12668
|
-
if (source
|
|
12972
|
+
if (source !== "moq" && !ingressHasPacketId(ingress, info.packetId)) {
|
|
12973
|
+
if (source === "moq-datagram") {
|
|
12974
|
+
if (info.packetId === MMTP_SIGNALING_PACKET_ID) this.#datagramLegSignalingPackets++;
|
|
12975
|
+
else this.#datagramLegIngressDrops++;
|
|
12976
|
+
}
|
|
12669
12977
|
debugRouter(
|
|
12670
|
-
`[MmtpRouter] Dropping
|
|
12978
|
+
`[MmtpRouter] Dropping ${source} packet pid=${info.packetId}: absent from ingress tracks`
|
|
12671
12979
|
);
|
|
12672
12980
|
return;
|
|
12673
12981
|
}
|
|
12982
|
+
if (source === "moq-datagram") {
|
|
12983
|
+
if (!info.isRepair) {
|
|
12984
|
+
let names = this.#datagramLegStreams.get(info.packetId);
|
|
12985
|
+
if (!names) this.#datagramLegStreams.set(info.packetId, names = /* @__PURE__ */ new Set());
|
|
12986
|
+
names.add(catalogTrackNameForPacket(ingress, info.packetId));
|
|
12987
|
+
}
|
|
12988
|
+
} else if (source === "multicast") {
|
|
12989
|
+
this.#datagramLegStreams.delete(info.packetId);
|
|
12990
|
+
}
|
|
12674
12991
|
const packetRole = this.#packetIdRoles.get(info.packetId);
|
|
12675
|
-
if (source
|
|
12992
|
+
if (source !== "moq" && this.#classifyPacketId(info.packetId) === null && (!info.isRepair || packetRole !== "repair")) {
|
|
12676
12993
|
debugRouter(
|
|
12677
|
-
`[MmtpRouter] Dropping
|
|
12994
|
+
`[MmtpRouter] Dropping ${source} packet pid=${info.packetId}: physical PID is unregistered`
|
|
12678
12995
|
);
|
|
12996
|
+
if (info.isRepair) this.#fecManager?.countUnresolvedRepairOwner?.("unregistered");
|
|
12679
12997
|
return;
|
|
12680
12998
|
}
|
|
12681
12999
|
if (!info.isRepair && hasAmbiguousCatalogTrackName(ingress, info.packetId)) {
|
|
@@ -12711,7 +13029,7 @@ var MmtpRouter = class {
|
|
|
12711
13029
|
}
|
|
12712
13030
|
return;
|
|
12713
13031
|
}
|
|
12714
|
-
if (source
|
|
13032
|
+
if (source !== "multicast" && !manifestAdmitted) {
|
|
12715
13033
|
const admit = this.#admitUnicast(info.packetId, packet, () => this.#processMMTP(packet, source, true, ingress, overlapCopy, true), overlapCopy);
|
|
12716
13034
|
if (admit !== "unlisted") {
|
|
12717
13035
|
if (admit === "admitted") this.#processMMTP(packet, source, true, ingress, overlapCopy);
|
|
@@ -12740,7 +13058,7 @@ var MmtpRouter = class {
|
|
|
12740
13058
|
);
|
|
12741
13059
|
if (!repair) return;
|
|
12742
13060
|
if (ownerPacketId != null && this.#fecManager) {
|
|
12743
|
-
if ((flowless && this.#userAgentGoverns(ownerPacketId) || source
|
|
13061
|
+
if ((flowless && this.#userAgentGoverns(ownerPacketId) || source !== "multicast" && !manifestAdmitted) && this.#setAsideUnlistedRepair(ownerPacketId, catalogTrackNameForPacket(ingress, ownerPacketId), repair)) return;
|
|
12744
13062
|
this.#repairPidCounts[info.packetId] = (this.#repairPidCounts[info.packetId] || 0) + 1;
|
|
12745
13063
|
const count = this.#repairPidCounts[info.packetId];
|
|
12746
13064
|
if (count <= 2 || count % 500 === 0) {
|
|
@@ -12779,7 +13097,7 @@ var MmtpRouter = class {
|
|
|
12779
13097
|
const fecSource = this.#fecManager !== null && fecPayloadId != null;
|
|
12780
13098
|
const coords = fecSource && fecPayloadId ? this.#locateFecSource(info.packetId, catalogTrackName, fecPayloadId.ssId) ?? void 0 : void 0;
|
|
12781
13099
|
duplicates.advance(coords?.sbn);
|
|
12782
|
-
if (source
|
|
13100
|
+
if (source !== "moq" && !overlapCopy && !releasedFromQuarantine && catalogTrackName !== void 0 && duplicates.predatesHorizon(info.sequenceNumber, fecPayloadId?.ssId)) {
|
|
12783
13101
|
this.#publisherRestarts++;
|
|
12784
13102
|
console.warn(
|
|
12785
13103
|
`[MmtpRouter] publisher restart on pid=${info.packetId} track=${catalogTrackName}: packet_sequence_number=${info.sequenceNumber} predates the stream's FEC horizon; starting a new epoch`
|
|
@@ -12840,6 +13158,7 @@ var MmtpRouter = class {
|
|
|
12840
13158
|
evidence: sourceSymbolEvidence(packet, parsed.header, info.rapFlag, info.sequenceNumber),
|
|
12841
13159
|
oversized: !(this.#fecManager.isoSourceFits?.(info.packetId, rawSymbol.length) ?? false)
|
|
12842
13160
|
}) ?? false;
|
|
13161
|
+
if (held) this.#requestFecPoke(info.packetId, catalogTrackName);
|
|
12843
13162
|
parseSourceSymbol = held && !duplicates.parsedSymbols.has(ssId);
|
|
12844
13163
|
}
|
|
12845
13164
|
} else if (fecUnreadable && info.fecPayloadId) {
|
|
@@ -12967,7 +13286,9 @@ var MmtpRouter = class {
|
|
|
12967
13286
|
const feedOptions = {
|
|
12968
13287
|
skipFecPayloadId: parserOptions?.skipFecPayloadId,
|
|
12969
13288
|
recovered: parserOptions?.recovered,
|
|
12970
|
-
|
|
13289
|
+
// Frame attribution is the transport path: an "mfu-datagram" object
|
|
13290
|
+
// crossed QUIC, so its frames are 'moq' (provenance 'mixed').
|
|
13291
|
+
source: parserOptions?.source === "moq-datagram" ? "moq" : parserOptions?.source,
|
|
12971
13292
|
deliveryProvenance: parserOptions?.deliveryProvenance,
|
|
12972
13293
|
catalogTrackName: parserOptions?.catalogTrackName,
|
|
12973
13294
|
...parserOptions?.fecSbn === void 0 ? {} : { fecSbn: parserOptions.fecSbn },
|