@blockcast/mmt-container 2.2.0-main.fb5c7dfbe2de → 2.2.0-main.fde7aee36726
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 +1284 -174
- 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/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 +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -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 +2 -0
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +52 -2
- 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/fec-manager.ts +534 -41
- package/src/fec-state.ts +21 -5
- package/src/index.ts +23 -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 +27 -2
- 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-validation.json +266 -7
- package/test-vectors/moq/mmtp-mode-selection.json +259 -0
package/src/mmtp-router.ts
CHANGED
|
@@ -333,6 +333,18 @@ const OVERLAY_REBUILT_LIMIT = 256;
|
|
|
333
333
|
* longer recover and be admitted as multicast-only. */
|
|
334
334
|
const OVERLAY_MOQ_HORIZON_BLOCKS = 64;
|
|
335
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Where a packet entered this router. `'multicast'` and `'moq'` are the
|
|
338
|
+
* transport attribution every frame carries (`MmtpSourcePath`);
|
|
339
|
+
* `'moq-datagram'` is an "mfu-datagram" subscription (mmt-02 4.3.1): a lossy
|
|
340
|
+
* unicast leg, so it takes every loss rule a multicast datagram takes (FEC
|
|
341
|
+
* holds, deadlines, startup partial blocks, the publisher-restart epoch,
|
|
342
|
+
* 7.2.7 unicast admission) and none of the multicast socket's (ingress
|
|
343
|
+
* flows, the ordered-relay frontier). Frames it yields are attributed
|
|
344
|
+
* `'moq'` and their provenance `'mixed'`: the bytes crossed QUIC.
|
|
345
|
+
*/
|
|
346
|
+
export type MmtpIngestSource = MmtpSourcePath | "moq-datagram";
|
|
347
|
+
|
|
336
348
|
export interface MmtpIngressContext {
|
|
337
349
|
tracks: readonly Readonly<{ name: string; packetId: number }>[];
|
|
338
350
|
/**
|
|
@@ -781,6 +793,8 @@ export interface FECManagerLike {
|
|
|
781
793
|
/** fec-01 4.5: refuse a repair header whose block length the track's scheme
|
|
782
794
|
* forbids, before it touches block state (optional). */
|
|
783
795
|
admitRepairBlockLength?(packetId: number, ssbLength: number, rsbLength: number, rsId: number): boolean;
|
|
796
|
+
/** Count a repair packet dropped because its owning track could not be named (optional). */
|
|
797
|
+
countUnresolvedRepairOwner?(reason: "unregistered" | "ownerAbsent" | "ownerAmbiguous"): void;
|
|
784
798
|
/** core-00 7.5 / mmt-02 7.3 admission of one repair object of the named
|
|
785
799
|
* instance; counts a discard per instance (optional). */
|
|
786
800
|
admitRepairObject?(
|
|
@@ -822,13 +836,16 @@ export interface FECManagerLike {
|
|
|
822
836
|
/** Delivery-gap sample for one multicast packet (FECManager.noteMulticastArrival). */
|
|
823
837
|
noteMulticastArrival?(packetId: number, packetSequenceNumber: number): void;
|
|
824
838
|
|
|
839
|
+
/** Delivery-gap sample for one packet of a lossy path, keyed by path (FECManager.noteArrival). */
|
|
840
|
+
noteArrival?(path: "multicast" | "moq-datagram", packetId: number, packetSequenceNumber: number): void;
|
|
841
|
+
|
|
825
842
|
/** Record a transport symbol for first-arrival-wins dedup and path counters. */
|
|
826
843
|
feedSymbolFromSource(
|
|
827
844
|
packetId: number,
|
|
828
845
|
sbn: number,
|
|
829
846
|
esi: number,
|
|
830
847
|
data: Uint8Array,
|
|
831
|
-
source:
|
|
848
|
+
source: MmtpIngestSource,
|
|
832
849
|
catalogTrackName?: string,
|
|
833
850
|
): boolean;
|
|
834
851
|
|
|
@@ -889,16 +906,32 @@ export interface FECManagerLike {
|
|
|
889
906
|
catalogTrackName?: string,
|
|
890
907
|
): { mode: ClassifierMode; reason: ClassifierReason | null };
|
|
891
908
|
|
|
892
|
-
/**
|
|
893
|
-
|
|
909
|
+
/**
|
|
910
|
+
* Whether an MPU boundary still bounds the stream's RAPs; given a gap
|
|
911
|
+
* inside one MPU, whether the catalog keyframe interval also rules a
|
|
912
|
+
* keyframe out of it and no source held in the gap carries part of a RAP
|
|
913
|
+
* (FECManager.mpuBoundsRapsFor).
|
|
914
|
+
*/
|
|
915
|
+
mpuBoundsRapsFor?(
|
|
916
|
+
packetId: number,
|
|
917
|
+
catalogTrackName?: string,
|
|
918
|
+
gap?: {
|
|
919
|
+
readonly mpu: number;
|
|
920
|
+
readonly from?: AuthoredTiming;
|
|
921
|
+
readonly to?: AuthoredTiming;
|
|
922
|
+
readonly fromSsId?: number;
|
|
923
|
+
readonly toSsId?: number;
|
|
924
|
+
},
|
|
925
|
+
): boolean;
|
|
894
926
|
|
|
895
|
-
/** Record a RAP released in order (RAP-spacing invariant). */
|
|
927
|
+
/** Record a RAP released in order (RAP-spacing invariant; its decode time anchors the MPU's keyframe instants). */
|
|
896
928
|
noteReleasedRap?(
|
|
897
929
|
packetId: number,
|
|
898
930
|
catalogTrackName: string | undefined,
|
|
899
931
|
mpu: number,
|
|
900
932
|
presentationTime: bigint,
|
|
901
933
|
mediaTimescale: number,
|
|
934
|
+
decodeTime?: bigint,
|
|
902
935
|
): void;
|
|
903
936
|
|
|
904
937
|
/** Refresh the block inactivity deadline after accepted repair progress. */
|
|
@@ -966,6 +999,16 @@ export interface FECManagerLike {
|
|
|
966
999
|
fromSsId: number,
|
|
967
1000
|
toSsId: number,
|
|
968
1001
|
): readonly number[] | null;
|
|
1002
|
+
/** iso-ssbg1-v1: how long a frame that arrived at `arrivedAtMs` waits once only a late source can fill the SS_IDs before it, longer when they may hold a RAP an installed keyframe overlay can still rebuild, or behind a run no repair has delimited until its FEC deadline (FECManager.isoRepairlessWaitMs). */
|
|
1003
|
+
isoRepairlessWaitMs?(
|
|
1004
|
+
packetId: number,
|
|
1005
|
+
catalogTrackName: string | undefined,
|
|
1006
|
+
fromSsId: number,
|
|
1007
|
+
toSsId: number,
|
|
1008
|
+
rapMayHide?: boolean,
|
|
1009
|
+
rapNext?: boolean,
|
|
1010
|
+
arrivedAtMs?: number,
|
|
1011
|
+
): number | undefined;
|
|
969
1012
|
|
|
970
1013
|
|
|
971
1014
|
/**
|
|
@@ -974,6 +1017,8 @@ export interface FECManagerLike {
|
|
|
974
1017
|
* how long the router keeps a stream's duplicate ledgers.
|
|
975
1018
|
*/
|
|
976
1019
|
blockLifetimeMsForPacket?(packetId: number): number | undefined;
|
|
1020
|
+
/** Duplicate-ledger retention an "mfu-datagram" leg needs (FECManager.datagramLegLedgerRetentionMsForPacket). */
|
|
1021
|
+
datagramLegLedgerRetentionMsForPacket?(packetId: number): number | undefined;
|
|
977
1022
|
|
|
978
1023
|
/** FEC symbol size T in bytes (0 = unknown / no FEC). */
|
|
979
1024
|
readonly symbolSize: number;
|
|
@@ -1043,9 +1088,10 @@ export interface FECManagerLike {
|
|
|
1043
1088
|
/**
|
|
1044
1089
|
* Classification evidence carried by one first-arrival network source
|
|
1045
1090
|
* packet: the MMTP header R bit and the MPU / data-unit identity it states
|
|
1046
|
-
* (movie fragment, sample, DU offset). `idx` is the 0-based
|
|
1047
|
-
* (`sample_number` is 1-based)
|
|
1048
|
-
*
|
|
1091
|
+
* (movie fragment, sample, DU offset). `idx` is the sample's 0-based
|
|
1092
|
+
* position within its movie fragment (`sample_number` is 1-based);
|
|
1093
|
+
* BlockClassifier turns it and the fragment into an MPU position. The
|
|
1094
|
+
* packet_sequence_number rides along for FECManager's forward-jump bound.
|
|
1049
1095
|
*/
|
|
1050
1096
|
function sourceSymbolEvidence(
|
|
1051
1097
|
packet: Uint8Array,
|
|
@@ -1106,6 +1152,20 @@ export class MmtpRouter {
|
|
|
1106
1152
|
/** The flow whose receiver admitted a stream's source datagrams, by packetId then catalog track name: recovered packets answer to it. */
|
|
1107
1153
|
readonly #provenanceStreamFlow = new Map<number, Map<string | undefined, string>>();
|
|
1108
1154
|
#unregisteredFlowDrops = 0;
|
|
1155
|
+
/** "mfu-datagram" leg packets of a packet id the ingress does not name (never the signaling flow). */
|
|
1156
|
+
#datagramLegIngressDrops = 0;
|
|
1157
|
+
/** "mfu-datagram" leg packets of the signaling flow (packet id 0): expected, one per group. */
|
|
1158
|
+
#datagramLegSignalingPackets = 0;
|
|
1159
|
+
/**
|
|
1160
|
+
* The streams a live "mfu-datagram" leg has fed, catalog track names by
|
|
1161
|
+
* packet id: their ledgers and release gate take the leg's bounds. A stream
|
|
1162
|
+
* leaves when its leg does: `endDatagramLeg`, `resetTrack`, `dispose`, or
|
|
1163
|
+
* the first multicast packet of its packet id (the ordered switch retires
|
|
1164
|
+
* the leg first). The "mfu" sibling shares the packet id, never the name.
|
|
1165
|
+
*/
|
|
1166
|
+
readonly #datagramLegStreams = new Map<number, Set<string | undefined>>();
|
|
1167
|
+
/** The leg's presentation budget (setDatagramLegPresentationBudget), or null: no presentation bound. */
|
|
1168
|
+
#datagramLegPresentationBudgetMs: ((packetId: number, catalogTrackName?: string) => number) | null = null;
|
|
1109
1169
|
#ambiguousRecoveredDrops = 0;
|
|
1110
1170
|
|
|
1111
1171
|
// Temp state set by #processMMTP before calling parser.feed(),
|
|
@@ -1236,6 +1296,8 @@ export class MmtpRouter {
|
|
|
1236
1296
|
// end: a synchronous recovery completes its block BEFORE routing the
|
|
1237
1297
|
// recovered frames, and releasing a held gap in between would strand them.
|
|
1238
1298
|
#fecPokeDepth = 0;
|
|
1299
|
+
/** FecReleaseGate.wakeAt timers, by media stream key. */
|
|
1300
|
+
readonly #fecWakes = new Map<string, { atMs: number; timer: ReturnType<typeof setTimeout> }>();
|
|
1239
1301
|
#pendingFecPokes = new Map<string, { packetId: number; catalogTrackName?: string }>();
|
|
1240
1302
|
// ── Phase 14: per-role packetId dispatch (D-26, D-27, D-28) ───────
|
|
1241
1303
|
/** Maps packetId → TrackRole. Default: 'single' when absent (legacy path). */
|
|
@@ -1656,10 +1718,14 @@ export class MmtpRouter {
|
|
|
1656
1718
|
if (blockSpanMs === undefined || blockLifetimeMs === undefined) return NO_FEC_GEOMETRY_HORIZON;
|
|
1657
1719
|
// FECManager reports 0 for a stream the catalog gave no block span.
|
|
1658
1720
|
if (blockSpanMs === 0) return NO_BLOCK_SPAN_HORIZON;
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1721
|
+
let retentionMs = duplicateRetentionMs({ blockSpanMs, blockLifetimeMs });
|
|
1722
|
+
// An "mfu-datagram" leg's datagrams may trail a joining FETCH by a whole
|
|
1723
|
+
// group: remember at least span + tolerance + group, or the lag reads as
|
|
1724
|
+
// a publisher restart (mmt-02 4.3.1, 6.1 step 3).
|
|
1725
|
+
if (this.#datagramLegStreams.has(packetId)) {
|
|
1726
|
+
retentionMs = Math.max(retentionMs, fec.datagramLegLedgerRetentionMsForPacket?.(packetId) ?? 0);
|
|
1727
|
+
}
|
|
1728
|
+
return { kind: "fec-horizon", retentionMs };
|
|
1663
1729
|
}
|
|
1664
1730
|
|
|
1665
1731
|
/**
|
|
@@ -2165,7 +2231,7 @@ export class MmtpRouter {
|
|
|
2165
2231
|
repairPacketId: number,
|
|
2166
2232
|
packet: Uint8Array,
|
|
2167
2233
|
header: MMTPHeader,
|
|
2168
|
-
source:
|
|
2234
|
+
source: MmtpIngestSource,
|
|
2169
2235
|
): void {
|
|
2170
2236
|
const repair = inst ? parseMoqRepairFrameWithHeader(packet, header) : null;
|
|
2171
2237
|
if (!inst || !repair) {
|
|
@@ -2181,7 +2247,7 @@ export class MmtpRouter {
|
|
|
2181
2247
|
const blockStart = placement.block.start;
|
|
2182
2248
|
if (placement.span !== undefined) this.#replayOverlaySources(inst, placement.span.block.start, placement.span.placed);
|
|
2183
2249
|
this.#replayOverlaySources(inst, blockStart, placement.placed);
|
|
2184
|
-
if (source
|
|
2250
|
+
if (source !== "multicast") this.#noteOverlayMoqBlock(inst, blockStart);
|
|
2185
2251
|
const alreadyCompleted = fec.isBlockCompleted(blockStart, pid, name);
|
|
2186
2252
|
const recovered = fec.feedRepairSymbol(pid, repair.ssStart, repair.ssbLength, repair.rsId, repair.symbolData, name);
|
|
2187
2253
|
if (recovered && !alreadyCompleted) this.#routeOverlayRecovered(inst, blockStart, recovered);
|
|
@@ -2194,7 +2260,7 @@ export class MmtpRouter {
|
|
|
2194
2260
|
): void {
|
|
2195
2261
|
const { fec, repairPacketId: pid, streamName: name } = inst;
|
|
2196
2262
|
for (const { ssId, payload } of placed) {
|
|
2197
|
-
if (payload.source
|
|
2263
|
+
if (payload.source !== "multicast") this.#noteOverlayMoqBlock(inst, blockStart);
|
|
2198
2264
|
if (payload.oversized) continue;
|
|
2199
2265
|
const alreadyCompleted = fec.isBlockCompleted(blockStart, pid, name);
|
|
2200
2266
|
const recovered = fec.feedSourceSymbol(pid, ssId, payload.symbolData, name);
|
|
@@ -2223,7 +2289,7 @@ export class MmtpRouter {
|
|
|
2223
2289
|
header: MMTPHeader,
|
|
2224
2290
|
sequenceNumber: number,
|
|
2225
2291
|
rapFlag: boolean,
|
|
2226
|
-
source:
|
|
2292
|
+
source: MmtpIngestSource,
|
|
2227
2293
|
baseSsId: number | undefined,
|
|
2228
2294
|
): void {
|
|
2229
2295
|
if (this.#overlays.size === 0) return;
|
|
@@ -2266,7 +2332,7 @@ export class MmtpRouter {
|
|
|
2266
2332
|
});
|
|
2267
2333
|
continue;
|
|
2268
2334
|
}
|
|
2269
|
-
if (source
|
|
2335
|
+
if (source !== "multicast") this.#noteOverlayMoqBlock(inst, coords.sbn);
|
|
2270
2336
|
if (oversized) continue;
|
|
2271
2337
|
const alreadyCompleted = fec.isBlockCompleted(coords.sbn, pid, name);
|
|
2272
2338
|
const recovered = fec.feedSourceSymbol(pid, ssId, symbolData, name);
|
|
@@ -3015,6 +3081,51 @@ export class MmtpRouter {
|
|
|
3015
3081
|
return this.#unregisteredFlowDrops;
|
|
3016
3082
|
}
|
|
3017
3083
|
|
|
3084
|
+
/** "mfu-datagram" leg packets dropped because the leg's ingress does not name their packet id (packet id 0 apart). */
|
|
3085
|
+
get datagramLegIngressDropCount(): number {
|
|
3086
|
+
return this.#datagramLegIngressDrops;
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
/** "mfu-datagram" leg packets of the MMTP signaling flow (packet id 0), which no track owns. */
|
|
3090
|
+
get datagramLegSignalingPacketCount(): number {
|
|
3091
|
+
return this.#datagramLegSignalingPackets;
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3094
|
+
/**
|
|
3095
|
+
* The "mfu-datagram" leg's presentation bound (mmt-02 6.1 step 6): how
|
|
3096
|
+
* long after a frame arrives it must leave the release gate when the gap
|
|
3097
|
+
* before it holds no RAP, FT=0 or FT=1 data (the player's presentation
|
|
3098
|
+
* delay less its decode lead). The gap is then decided at the earlier of
|
|
3099
|
+
* the FEC block deadline and this bound; a gap that may hold a RAP keeps
|
|
3100
|
+
* the block deadline. Null, or a value that is not finite and positive:
|
|
3101
|
+
* the block deadline alone, as on multicast.
|
|
3102
|
+
*/
|
|
3103
|
+
setDatagramLegPresentationBudget(budgetMs: ((packetId: number, catalogTrackName?: string) => number) | null): void {
|
|
3104
|
+
this.#datagramLegPresentationBudgetMs = budgetMs;
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
/**
|
|
3108
|
+
* The "mfu-datagram" leg is over (unsubscribed, or switched to another
|
|
3109
|
+
* path): no stream keeps its presentation bound or its ledger retention.
|
|
3110
|
+
* Parser, FEC and ledger state stay, so the packet ids continue on the
|
|
3111
|
+
* next path without an epoch. A later leg datagram starts a leg again.
|
|
3112
|
+
*/
|
|
3113
|
+
endDatagramLeg(): void {
|
|
3114
|
+
this.#datagramLegStreams.clear();
|
|
3115
|
+
this.#datagramLegPresentationBudgetMs = null;
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
#datagramLegPresentationWaitMs(packetId: number, catalogTrackName: string | undefined): number | undefined {
|
|
3119
|
+
if (this.#datagramLegPresentationBudgetMs === null || this.#datagramLegStreams.get(packetId)?.has(catalogTrackName) !== true) return undefined;
|
|
3120
|
+
let budgetMs: number;
|
|
3121
|
+
try {
|
|
3122
|
+
budgetMs = this.#datagramLegPresentationBudgetMs(packetId, catalogTrackName);
|
|
3123
|
+
} catch {
|
|
3124
|
+
return undefined;
|
|
3125
|
+
}
|
|
3126
|
+
return Number.isFinite(budgetMs) && budgetMs > 0 ? budgetMs : undefined;
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3018
3129
|
/** Recovered packets dropped because more than one protected flow could own their stream. */
|
|
3019
3130
|
get ambiguousRecoveredDropCount(): number {
|
|
3020
3131
|
return this.#ambiguousRecoveredDrops;
|
|
@@ -3033,10 +3144,14 @@ export class MmtpRouter {
|
|
|
3033
3144
|
* caller that forgot it silently attributed its bytes to a multicast socket
|
|
3034
3145
|
* they may never have crossed — and that attribution is what the physical-
|
|
3035
3146
|
* delivery evidence path is built on. Absence is not multicast; say which.
|
|
3147
|
+
* `"moq-datagram"` is an "mfu-datagram" subscription (MmtpIngestSource):
|
|
3148
|
+
* `ingress.tracks` MUST name the datagram catalog track for its packet id,
|
|
3149
|
+
* and a packet of a packet id it does not name is dropped and counted
|
|
3150
|
+
* (`datagramLegIngressDropCount`; the signaling flow, packet id 0, apart).
|
|
3036
3151
|
*/
|
|
3037
3152
|
feedPacket(
|
|
3038
3153
|
packet: Uint8Array,
|
|
3039
|
-
source:
|
|
3154
|
+
source: MmtpIngestSource,
|
|
3040
3155
|
ingress?: MmtpIngressContext,
|
|
3041
3156
|
): void {
|
|
3042
3157
|
if (this.#disposed) return;
|
|
@@ -3093,17 +3208,21 @@ export class MmtpRouter {
|
|
|
3093
3208
|
|
|
3094
3209
|
/**
|
|
3095
3210
|
* Feed a repair packet from MoQ (reliable QUIC) — parses MMTP repair
|
|
3096
|
-
* header and delegates to FECManager for FEC recovery.
|
|
3211
|
+
* header and delegates to FECManager for FEC recovery. `source` is
|
|
3212
|
+
* `"moq-datagram"` for a repair object of an "mfu-datagram" track's repair
|
|
3213
|
+
* track, which arrives as a datagram and so counts as an in-band symbol of
|
|
3214
|
+
* the leg; a FETCHed repair stays `"moq"` (RepairVia `quic`).
|
|
3097
3215
|
*/
|
|
3098
3216
|
feedRepairPacket(
|
|
3099
3217
|
packet: Uint8Array,
|
|
3100
3218
|
ownerPacketIdHint?: number,
|
|
3101
3219
|
catalogTrackName?: string,
|
|
3102
3220
|
repairTrackName?: string,
|
|
3221
|
+
source: "moq" | "moq-datagram" = "moq",
|
|
3103
3222
|
): void {
|
|
3104
3223
|
if (this.#disposed) return;
|
|
3105
3224
|
this.#withDeferredFecPokes(() => {
|
|
3106
|
-
this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName);
|
|
3225
|
+
this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source);
|
|
3107
3226
|
});
|
|
3108
3227
|
}
|
|
3109
3228
|
|
|
@@ -3112,6 +3231,7 @@ export class MmtpRouter {
|
|
|
3112
3231
|
ownerPacketIdHint: number | undefined,
|
|
3113
3232
|
catalogTrackName: string | undefined,
|
|
3114
3233
|
repairTrackName: string | undefined,
|
|
3234
|
+
source: "moq" | "moq-datagram",
|
|
3115
3235
|
admitted = false,
|
|
3116
3236
|
): void {
|
|
3117
3237
|
// One header parse per packet, as on the multicast repair branch: mmt-fec's
|
|
@@ -3127,7 +3247,7 @@ export class MmtpRouter {
|
|
|
3127
3247
|
const repairPacketId = header.packetId;
|
|
3128
3248
|
const overlay = this.#overlayRepairTarget(repairPacketId, repairTrackName);
|
|
3129
3249
|
if (overlay !== undefined) {
|
|
3130
|
-
this.#routeOverlayRepair(overlay, repairPacketId, packet, header,
|
|
3250
|
+
this.#routeOverlayRepair(overlay, repairPacketId, packet, header, source);
|
|
3131
3251
|
return;
|
|
3132
3252
|
}
|
|
3133
3253
|
|
|
@@ -3155,7 +3275,7 @@ export class MmtpRouter {
|
|
|
3155
3275
|
let unlisted = false;
|
|
3156
3276
|
if (ownerPacketId != null && !admitted) {
|
|
3157
3277
|
const admit = this.#admitUnicast(repairPacketId, packet, () =>
|
|
3158
|
-
this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, true));
|
|
3278
|
+
this.#feedRepairPacket(packet, ownerPacketIdHint, catalogTrackName, repairTrackName, source, true));
|
|
3159
3279
|
if (admit === "held" || admit === "dropped") return;
|
|
3160
3280
|
unlisted = admit === "unlisted";
|
|
3161
3281
|
}
|
|
@@ -3179,7 +3299,7 @@ export class MmtpRouter {
|
|
|
3179
3299
|
this.#noteUnreadableFecPayloadId(ownerPacketId, "repair");
|
|
3180
3300
|
return;
|
|
3181
3301
|
}
|
|
3182
|
-
this.#handleIsoRepair(ownerPacketId, catalogTrackName, parsed,
|
|
3302
|
+
this.#handleIsoRepair(ownerPacketId, catalogTrackName, parsed, source, repairTrackName);
|
|
3183
3303
|
}
|
|
3184
3304
|
}
|
|
3185
3305
|
|
|
@@ -3303,7 +3423,7 @@ export class MmtpRouter {
|
|
|
3303
3423
|
ownerPacketId: number,
|
|
3304
3424
|
catalogTrackName: string | undefined,
|
|
3305
3425
|
repair: { ssStart: number; ssbLength: number; rsbLength: number; rsId: number; symbolData: Uint8Array },
|
|
3306
|
-
source:
|
|
3426
|
+
source: MmtpIngestSource,
|
|
3307
3427
|
repairTrackName?: string,
|
|
3308
3428
|
): void {
|
|
3309
3429
|
const fec = this.#fecManager;
|
|
@@ -3451,6 +3571,7 @@ export class MmtpRouter {
|
|
|
3451
3571
|
debugRouter(
|
|
3452
3572
|
`[MmtpRouter] Dropping repair packet pid=${packetId}: physical PID is unregistered`,
|
|
3453
3573
|
);
|
|
3574
|
+
this.#fecManager?.countUnresolvedRepairOwner?.("unregistered");
|
|
3454
3575
|
return null;
|
|
3455
3576
|
}
|
|
3456
3577
|
|
|
@@ -3464,6 +3585,7 @@ export class MmtpRouter {
|
|
|
3464
3585
|
debugRouter(
|
|
3465
3586
|
`[MmtpRouter] Dropping repair packet pid=${packetId}: catalog owner is ${owners.length === 0 ? "absent" : "ambiguous"}`,
|
|
3466
3587
|
);
|
|
3588
|
+
this.#fecManager?.countUnresolvedRepairOwner?.(owners.length === 0 ? "ownerAbsent" : "ownerAmbiguous");
|
|
3467
3589
|
return null;
|
|
3468
3590
|
}
|
|
3469
3591
|
|
|
@@ -3534,6 +3656,9 @@ export class MmtpRouter {
|
|
|
3534
3656
|
}
|
|
3535
3657
|
this.#parser.resetTrack(packetId, catalogTrackName);
|
|
3536
3658
|
this.resetKeyframeOverlays(packetId, catalogTrackName);
|
|
3659
|
+
// A new epoch is no leg stream until a leg datagram says so again.
|
|
3660
|
+
const legNames = this.#datagramLegStreams.get(packetId);
|
|
3661
|
+
if (legNames?.delete(catalogTrackName) && legNames.size === 0) this.#datagramLegStreams.delete(packetId);
|
|
3537
3662
|
this.#restampedStreams.delete(this.#mediaStreamKey(packetId, catalogTrackName));
|
|
3538
3663
|
const assistPrefix = assistKey(packetId, catalogTrackName, 0).slice(0, -1);
|
|
3539
3664
|
for (const key of this.#assistBlocks.keys()) if (key.startsWith(assistPrefix)) this.#assistBlocks.delete(key);
|
|
@@ -3922,8 +4047,11 @@ export class MmtpRouter {
|
|
|
3922
4047
|
this.#disposed = true;
|
|
3923
4048
|
this.#staged = null;
|
|
3924
4049
|
this.cancelKeyframeLostTimer();
|
|
4050
|
+
for (const { timer } of this.#fecWakes.values()) clearTimeout(timer);
|
|
4051
|
+
this.#fecWakes.clear();
|
|
3925
4052
|
this.#parser.dispose();
|
|
3926
4053
|
this.#streams.clear();
|
|
4054
|
+
this.endDatagramLeg();
|
|
3927
4055
|
this.#trackPacketCallbacks.clear();
|
|
3928
4056
|
this.#latestVideoSeqByStream.clear();
|
|
3929
4057
|
this.#lastDirectSourceVideoTsByStream.clear();
|
|
@@ -4138,6 +4266,52 @@ export class MmtpRouter {
|
|
|
4138
4266
|
if (!fec?.terminalRetentionMsForPacket) return Infinity;
|
|
4139
4267
|
return fec.terminalRetentionMsForPacket(packetId) ?? 0;
|
|
4140
4268
|
},
|
|
4269
|
+
// Once no repair can fill a gap (FECManager.isoRepairlessWaitMs: only a
|
|
4270
|
+
// late source can), its frame waits the late-symbol allowance when the
|
|
4271
|
+
// gap holds no RAP an installed keyframe overlay could still rebuild:
|
|
4272
|
+
// lost deltas of one MPU (delta-lost), the tail of the MPU before a RAP
|
|
4273
|
+
// that opens the next one while MPU boundaries bound RAPs (rap-next,
|
|
4274
|
+
// unless the gap holds a stated block's loss: the overlay may rebuild
|
|
4275
|
+
// that MPU's FT=0, and the block's group then complete it), or
|
|
4276
|
+
// an audio gap. A gap that may hold one (rap-lost, rap-unknown, or any
|
|
4277
|
+
// other rap-next, whose gap may hold a whole MPU and the keyframe the
|
|
4278
|
+
// overlay protects) waits for that overlay's repair too (BLO-52085
|
|
4279
|
+
// D4). A run no repair has delimited instead waits for its FEC
|
|
4280
|
+
// deadline, whatever the decision (FECManager.isoRepairlessWaitMs). The
|
|
4281
|
+
// FEC check comes first: most held gaps are not behind such a span, and
|
|
4282
|
+
// deciding one scans both frames' bitstreams.
|
|
4283
|
+
unrepairableWaitMs: (before, after, fromSbn, toSbn) => {
|
|
4284
|
+
const fec = this.#fecManager;
|
|
4285
|
+
const { packetId, catalogTrackName } = after.meta;
|
|
4286
|
+
const arrivedAtMs = after.arrivedAtMs;
|
|
4287
|
+
const allowanceMs = fec?.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, false, false, arrivedAtMs);
|
|
4288
|
+
// On an "mfu-datagram" leg a gap of delta data alone also goes at the
|
|
4289
|
+
// held frame's presentation time (mmt-02 6.1 step 6), repair pending
|
|
4290
|
+
// or not; a gap that may hold a RAP keeps the block deadline.
|
|
4291
|
+
const presentationMs = this.#datagramLegPresentationWaitMs(packetId, catalogTrackName);
|
|
4292
|
+
if (!fec || (allowanceMs === undefined && presentationMs === undefined)) return undefined;
|
|
4293
|
+
const decision = this.#decideGap(before, after, [], false);
|
|
4294
|
+
const mpu = before.meta.mpuSequenceNumber;
|
|
4295
|
+
const intoNextMpu = decision.reason === "rap-next" && mpu !== undefined &&
|
|
4296
|
+
after.meta.mpuSequenceNumber === ((mpu + 1) >>> 0) &&
|
|
4297
|
+
fec.mpuBoundsRapsFor?.(packetId, catalogTrackName) === true;
|
|
4298
|
+
if (decision.action === "stall" || (decision.reason === "rap-next" && !intoNextMpu)) {
|
|
4299
|
+
return allowanceMs === undefined
|
|
4300
|
+
? undefined
|
|
4301
|
+
: fec.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, true, false, arrivedAtMs);
|
|
4302
|
+
}
|
|
4303
|
+
const waitMs = allowanceMs === undefined
|
|
4304
|
+
? undefined
|
|
4305
|
+
: decision.reason === "rap-next"
|
|
4306
|
+
? fec.isoRepairlessWaitMs?.(packetId, catalogTrackName, fromSbn, toSbn, false, true, arrivedAtMs)
|
|
4307
|
+
: allowanceMs;
|
|
4308
|
+
// A track with no catalog span has no classifier, so nothing ruled a
|
|
4309
|
+
// keyframe out of a gap inside one MPU (FECManager.mpuBoundsRapsFor):
|
|
4310
|
+
// its delta-lost is unproven and never takes the presentation bound.
|
|
4311
|
+
if (decision.reason === "delta-lost" && !((fec.interleaveDepthMsForPacket?.(packetId) ?? 0) > 0)) return waitMs;
|
|
4312
|
+
if (presentationMs === undefined) return waitMs;
|
|
4313
|
+
return waitMs === undefined ? presentationMs : Math.min(waitMs, presentationMs);
|
|
4314
|
+
},
|
|
4141
4315
|
decide: (before, after, lostBlocks, discontinuity) => {
|
|
4142
4316
|
const decision = this.#decideGap(before, after, lostBlocks, discontinuity);
|
|
4143
4317
|
this.#onFrameGap?.(decision);
|
|
@@ -4147,6 +4321,20 @@ export class MmtpRouter {
|
|
|
4147
4321
|
onRap: (packetId, catalogTrackName, ssId) => {
|
|
4148
4322
|
for (const observer of this.#fecRapObservers) observer(packetId, catalogTrackName, ssId);
|
|
4149
4323
|
},
|
|
4324
|
+
// One timer per stream, at the earliest wake asked: its drain re-arms
|
|
4325
|
+
// for the next frame still waiting.
|
|
4326
|
+
wakeAt: (packetId, catalogTrackName, atMs) => {
|
|
4327
|
+
if (this.#disposed) return;
|
|
4328
|
+
const key = this.#mediaStreamKey(packetId, catalogTrackName);
|
|
4329
|
+
const armed = this.#fecWakes.get(key);
|
|
4330
|
+
if (armed !== undefined && armed.atMs <= atMs) return;
|
|
4331
|
+
if (armed !== undefined) clearTimeout(armed.timer);
|
|
4332
|
+
const timer = setTimeout(() => {
|
|
4333
|
+
this.#fecWakes.delete(key);
|
|
4334
|
+
this.#requestFecPoke(packetId, catalogTrackName);
|
|
4335
|
+
}, Math.max(0, Math.ceil(atMs - performance.now())));
|
|
4336
|
+
this.#fecWakes.set(key, { atMs, timer });
|
|
4337
|
+
},
|
|
4150
4338
|
// A staged switch commits on when each side's frames reach it
|
|
4151
4339
|
// (#interceptSwitchFrame): both sides' overlay keyframes reach it when
|
|
4152
4340
|
// they did unanchored.
|
|
@@ -4165,6 +4353,7 @@ export class MmtpRouter {
|
|
|
4165
4353
|
meta.mpuSequenceNumber,
|
|
4166
4354
|
timing.presentationTime,
|
|
4167
4355
|
timing.mediaTimescale,
|
|
4356
|
+
timing.decodeTime,
|
|
4168
4357
|
);
|
|
4169
4358
|
},
|
|
4170
4359
|
};
|
|
@@ -4190,17 +4379,40 @@ export class MmtpRouter {
|
|
|
4190
4379
|
): FrameGapDecision {
|
|
4191
4380
|
const { packetId, catalogTrackName } = after.meta;
|
|
4192
4381
|
const trackKind = this.#classifyPacketId(packetId) === false ? "audio" : "video";
|
|
4193
|
-
//
|
|
4194
|
-
// the
|
|
4382
|
+
// decideGap counts the frames a delta-lost gap missed as the difference
|
|
4383
|
+
// of the two sides' sample_number. That is exact only within one movie
|
|
4384
|
+
// fragment, which numbers its samples consecutively, and is stated only
|
|
4385
|
+
// while the classifier verifies the geometry. Two fragments state no
|
|
4386
|
+
// count: an MPU of several multi-sample fragments still classifies while
|
|
4387
|
+
// the classifier received only one of them first-hand (BLO-55339).
|
|
4388
|
+
// ponytail: cross-fragment gaps report missingFrames null; count them from
|
|
4389
|
+
// BlockClassifier MPU positions when concealedFrames must cover them.
|
|
4195
4390
|
const positionsTrusted =
|
|
4196
|
-
this.#fecManager?.classifierModeFor?.(packetId, catalogTrackName).mode === "classifying"
|
|
4391
|
+
this.#fecManager?.classifierModeFor?.(packetId, catalogTrackName).mode === "classifying" &&
|
|
4392
|
+
before.meta.movieFragmentSequenceNumber === after.meta.movieFragmentSequenceNumber;
|
|
4197
4393
|
// "Same MPU on both sides" proves a delta-only gap only while an MPU
|
|
4198
4394
|
// boundary bounds the stream's RAPs. Once a RAP was seen inside an MPU
|
|
4199
4395
|
// (or an MPU outran its GOP), a lost RAP can hide inside one MPU, so the
|
|
4200
4396
|
// MPU is withheld and a non-RAP after the gap stalls as rap-unknown. A
|
|
4201
|
-
// manager that cannot answer is treated as unable to prove it.
|
|
4202
|
-
|
|
4203
|
-
|
|
4397
|
+
// manager that cannot answer is treated as unable to prove it. Inside
|
|
4398
|
+
// one video MPU the catalog keyframe interval must also rule a keyframe
|
|
4399
|
+
// out of the gap (fec-multicast-00 Block Classification item 3), and no
|
|
4400
|
+
// packet held in it may carry part of a RAP.
|
|
4401
|
+
const mpu = before.meta.mpuSequenceNumber;
|
|
4402
|
+
const sameMpu = trackKind === "video" && mpu !== undefined && after.meta.mpuSequenceNumber === mpu;
|
|
4403
|
+
const mpuTrusted = this.#fecManager?.mpuBoundsRapsFor?.(
|
|
4404
|
+
packetId,
|
|
4405
|
+
catalogTrackName,
|
|
4406
|
+
sameMpu
|
|
4407
|
+
? {
|
|
4408
|
+
mpu,
|
|
4409
|
+
from: before.meta.authoredTiming,
|
|
4410
|
+
to: after.meta.authoredTiming,
|
|
4411
|
+
fromSsId: before.meta.fecSbn,
|
|
4412
|
+
toSsId: after.meta.fecSbnFirst ?? after.meta.fecSbn,
|
|
4413
|
+
}
|
|
4414
|
+
: undefined,
|
|
4415
|
+
) === true;
|
|
4204
4416
|
const evidence = (frame: { data: Uint8Array; meta: ParserFrameMeta }): GapFrameEvidence => {
|
|
4205
4417
|
const timing = frame.meta.authoredTiming;
|
|
4206
4418
|
const sampleNumber = frame.meta.sampleNumber;
|
|
@@ -4339,7 +4551,7 @@ export class MmtpRouter {
|
|
|
4339
4551
|
*/
|
|
4340
4552
|
#processMMTP(
|
|
4341
4553
|
packet: Uint8Array,
|
|
4342
|
-
source:
|
|
4554
|
+
source: MmtpIngestSource,
|
|
4343
4555
|
manifestAdmitted = false,
|
|
4344
4556
|
ingress?: MmtpIngressContext,
|
|
4345
4557
|
overlapCopy = false,
|
|
@@ -4358,22 +4570,47 @@ export class MmtpRouter {
|
|
|
4358
4570
|
// admission is the same arrival, not a new one.
|
|
4359
4571
|
if (source === "multicast" && !manifestAdmitted) {
|
|
4360
4572
|
this.#fecManager?.noteMulticastArrival?.(info.packetId, info.sequenceNumber);
|
|
4361
|
-
}
|
|
4362
|
-
|
|
4573
|
+
} else if (source === "moq-datagram" && !manifestAdmitted) {
|
|
4574
|
+
// The leg's own estimator: its stalls never widen the multicast wait.
|
|
4575
|
+
this.#fecManager?.noteArrival?.("moq-datagram", info.packetId, info.sequenceNumber);
|
|
4576
|
+
}
|
|
4577
|
+
if (source !== "moq" && !ingressHasPacketId(ingress, info.packetId)) {
|
|
4578
|
+
if (source === "moq-datagram") {
|
|
4579
|
+
// The signaling object (packet id 0, Object 0 of every group) is no
|
|
4580
|
+
// track's packet and carries no FEC Source Info: counted apart, so
|
|
4581
|
+
// the ingress-drop counter stays a misconfiguration signal.
|
|
4582
|
+
if (info.packetId === MMTP_SIGNALING_PACKET_ID) this.#datagramLegSignalingPackets++;
|
|
4583
|
+
else this.#datagramLegIngressDrops++;
|
|
4584
|
+
}
|
|
4363
4585
|
debugRouter(
|
|
4364
|
-
`[MmtpRouter] Dropping
|
|
4586
|
+
`[MmtpRouter] Dropping ${source} packet pid=${info.packetId}: absent from ingress tracks`,
|
|
4365
4587
|
);
|
|
4366
4588
|
return;
|
|
4367
4589
|
}
|
|
4590
|
+
if (source === "moq-datagram") {
|
|
4591
|
+
if (!info.isRepair) {
|
|
4592
|
+
let names = this.#datagramLegStreams.get(info.packetId);
|
|
4593
|
+
if (!names) this.#datagramLegStreams.set(info.packetId, (names = new Set()));
|
|
4594
|
+
names.add(catalogTrackNameForPacket(ingress, info.packetId));
|
|
4595
|
+
}
|
|
4596
|
+
} else if (source === "multicast") {
|
|
4597
|
+
// The ordered switch retires the leg before the first multicast packet
|
|
4598
|
+
// of its packet id: from here the stream is a multicast one, and the
|
|
4599
|
+
// leg's presentation bound and ledger retention no longer apply.
|
|
4600
|
+
this.#datagramLegStreams.delete(info.packetId);
|
|
4601
|
+
}
|
|
4368
4602
|
const packetRole = this.#packetIdRoles.get(info.packetId);
|
|
4369
4603
|
if (
|
|
4370
|
-
source
|
|
4604
|
+
source !== "moq" &&
|
|
4371
4605
|
this.#classifyPacketId(info.packetId) === null &&
|
|
4372
4606
|
(!info.isRepair || packetRole !== "repair")
|
|
4373
4607
|
) {
|
|
4374
4608
|
debugRouter(
|
|
4375
|
-
`[MmtpRouter] Dropping
|
|
4609
|
+
`[MmtpRouter] Dropping ${source} packet pid=${info.packetId}: physical PID is unregistered`,
|
|
4376
4610
|
);
|
|
4611
|
+
// #resolveRepairOwnerPacketId's "unregistered" drop for every leg that is
|
|
4612
|
+
// not a MoQ stream: a multicast leg and a "moq-datagram" leg both count here.
|
|
4613
|
+
if (info.isRepair) this.#fecManager?.countUnresolvedRepairOwner?.("unregistered");
|
|
4377
4614
|
return;
|
|
4378
4615
|
}
|
|
4379
4616
|
if (!info.isRepair && hasAmbiguousCatalogTrackName(ingress, info.packetId)) {
|
|
@@ -4431,7 +4668,8 @@ export class MmtpRouter {
|
|
|
4431
4668
|
|
|
4432
4669
|
// A MoQ packet of a track a protected flow lists is a datagram of that
|
|
4433
4670
|
// flow on its unicast path (7.2.7): admitted before it is read, or held.
|
|
4434
|
-
|
|
4671
|
+
// An "mfu-datagram" object is one too: it crossed QUIC, not the flow.
|
|
4672
|
+
if (source !== "multicast" && !manifestAdmitted) {
|
|
4435
4673
|
const admit = this.#admitUnicast(info.packetId, packet, () =>
|
|
4436
4674
|
this.#processMMTP(packet, source, true, ingress, overlapCopy, true), overlapCopy);
|
|
4437
4675
|
if (admit !== "unlisted") {
|
|
@@ -4475,7 +4713,7 @@ export class MmtpRouter {
|
|
|
4475
4713
|
// An unadmitted MoQ symbol reaching here is unlisted (#admitUnicast);
|
|
4476
4714
|
// a flow-less multicast one is unverified.
|
|
4477
4715
|
if (
|
|
4478
|
-
((flowless && this.#userAgentGoverns(ownerPacketId)) || (source
|
|
4716
|
+
((flowless && this.#userAgentGoverns(ownerPacketId)) || (source !== "multicast" && !manifestAdmitted)) &&
|
|
4479
4717
|
this.#setAsideUnlistedRepair(ownerPacketId, catalogTrackNameForPacket(ingress, ownerPacketId), repair)
|
|
4480
4718
|
) return;
|
|
4481
4719
|
this.#repairPidCounts[info.packetId] = (this.#repairPidCounts[info.packetId] || 0) + 1;
|
|
@@ -4556,9 +4794,10 @@ export class MmtpRouter {
|
|
|
4556
4794
|
// checked; an overlap copy is MoQ bytes and says nothing about the
|
|
4557
4795
|
// multicast publisher, and neither does a packet a provenance hold queue
|
|
4558
4796
|
// released: it predates the horizon because it waited, not because the
|
|
4559
|
-
// publisher restarted.
|
|
4797
|
+
// publisher restarted. An "mfu-datagram" leg is the publisher's own
|
|
4798
|
+
// datagrams, so it shows a restart as multicast does.
|
|
4560
4799
|
if (
|
|
4561
|
-
source
|
|
4800
|
+
source !== "moq" &&
|
|
4562
4801
|
!overlapCopy &&
|
|
4563
4802
|
!releasedFromQuarantine &&
|
|
4564
4803
|
catalogTrackName !== undefined &&
|
|
@@ -4671,6 +4910,10 @@ export class MmtpRouter {
|
|
|
4671
4910
|
evidence: sourceSymbolEvidence(packet, parsed.header, info.rapFlag, info.sequenceNumber),
|
|
4672
4911
|
oversized: !(this.#fecManager.isoSourceFits?.(info.packetId, rawSymbol.length) ?? false),
|
|
4673
4912
|
}) ?? false;
|
|
4913
|
+
// A held source can complete the SS_IDs a waiting frame's gap asks
|
|
4914
|
+
// for, or anchor its run, as a located one can complete a block:
|
|
4915
|
+
// ask the gate again, or the frame waits for the next packet.
|
|
4916
|
+
if (held) this.#requestFecPoke(info.packetId, catalogTrackName);
|
|
4674
4917
|
parseSourceSymbol = held && !duplicates.parsedSymbols.has(ssId);
|
|
4675
4918
|
}
|
|
4676
4919
|
} else if (fecUnreadable && info.fecPayloadId) {
|
|
@@ -4836,7 +5079,7 @@ export class MmtpRouter {
|
|
|
4836
5079
|
parserOptions?: {
|
|
4837
5080
|
skipFecPayloadId?: boolean;
|
|
4838
5081
|
recovered?: boolean;
|
|
4839
|
-
source?:
|
|
5082
|
+
source?: MmtpIngestSource;
|
|
4840
5083
|
deliveryProvenance?: MmtpDeliveryProvenance;
|
|
4841
5084
|
catalogTrackName?: string;
|
|
4842
5085
|
fecSbn?: number;
|
|
@@ -4860,7 +5103,9 @@ export class MmtpRouter {
|
|
|
4860
5103
|
const feedOptions = {
|
|
4861
5104
|
skipFecPayloadId: parserOptions?.skipFecPayloadId,
|
|
4862
5105
|
recovered: parserOptions?.recovered,
|
|
4863
|
-
|
|
5106
|
+
// Frame attribution is the transport path: an "mfu-datagram" object
|
|
5107
|
+
// crossed QUIC, so its frames are 'moq' (provenance 'mixed').
|
|
5108
|
+
source: parserOptions?.source === "moq-datagram" ? "moq" : parserOptions?.source,
|
|
4864
5109
|
deliveryProvenance: parserOptions?.deliveryProvenance,
|
|
4865
5110
|
catalogTrackName: parserOptions?.catalogTrackName,
|
|
4866
5111
|
...(parserOptions?.fecSbn === undefined ? {} : { fecSbn: parserOptions.fecSbn }),
|
|
@@ -4884,7 +5129,7 @@ export class MmtpRouter {
|
|
|
4884
5129
|
sbn: number,
|
|
4885
5130
|
esi: number,
|
|
4886
5131
|
data: Uint8Array,
|
|
4887
|
-
source:
|
|
5132
|
+
source: MmtpIngestSource,
|
|
4888
5133
|
catalogTrackName?: string,
|
|
4889
5134
|
): boolean {
|
|
4890
5135
|
const fecManager = this.#fecManager;
|