@blockcast/mmt-container 2.2.0-main.4a79a288e69e → 2.2.0-main.4ccba0f2f32a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-runtime.js +1119 -165
- package/dist/browser-runtime.js.map +3 -3
- package/dist/delta-fallback-config.js.map +1 -1
- package/dist/fec-manager.d.ts +67 -11
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +377 -54
- package/dist/fec-manager.js.map +2 -2
- package/dist/fec-worker-setup.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -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/media-router.js.map +1 -1
- package/dist/mmtp-container-parser.d.ts +64 -8
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +159 -21
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +158 -23
- package/dist/mmtp-container-parser.no-modules.js.map +2 -2
- package/dist/mmtp-decode-pipeline.js +158 -21
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-router.d.ts +31 -8
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +481 -68
- package/dist/mmtp-router.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 +940 -139
- package/dist/multicast-manager.js.map +2 -2
- package/dist/multicast-transport.js +2 -2
- package/dist/multicast-transport.js.map +2 -2
- package/dist/no-modules.js +158 -21
- package/dist/no-modules.js.map +2 -2
- package/dist/repair-fetch.d.ts +36 -8
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +285 -26
- package/dist/repair-fetch.js.map +3 -3
- 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-mmtp-container-parser.js +158 -21
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +5 -5
- package/src/fec-manager.ts +407 -28
- package/src/index.ts +3 -0
- package/src/iso-block-locator.ts +133 -31
- package/src/mmtp-container-parser.ts +273 -26
- package/src/mmtp-router.ts +541 -55
- package/src/multicast-manager.ts +118 -14
- package/src/repair-fetch.ts +363 -49
- package/src/track-session.ts +3 -0
|
@@ -5197,6 +5197,9 @@ function authoredGap(before, after) {
|
|
|
5197
5197
|
function ssIdAfter(a, b) {
|
|
5198
5198
|
return (a - b | 0) > 0;
|
|
5199
5199
|
}
|
|
5200
|
+
function holdsRebuilt(stream) {
|
|
5201
|
+
return stream.buf.some(({ meta }) => meta.fecSbnFirst !== void 0);
|
|
5202
|
+
}
|
|
5200
5203
|
var FecReleaseSequencer = class {
|
|
5201
5204
|
#streams = /* @__PURE__ */ new Map();
|
|
5202
5205
|
#gate;
|
|
@@ -5259,6 +5262,7 @@ var FecReleaseSequencer = class {
|
|
|
5259
5262
|
stream.lastSbn = void 0;
|
|
5260
5263
|
stream.discontinuity = false;
|
|
5261
5264
|
stream.rapSsId = void 0;
|
|
5265
|
+
stream.sourced = false;
|
|
5262
5266
|
}
|
|
5263
5267
|
if (stream.last !== null && compareFrameOrder(frame, stream.last) <= 0) {
|
|
5264
5268
|
this.#recordStat("droppedStale");
|
|
@@ -5285,6 +5289,7 @@ var FecReleaseSequencer = class {
|
|
|
5285
5289
|
if (compareFrameOrder(stream.buf[mid], frame) < 0) lo = mid + 1;
|
|
5286
5290
|
else hi = mid;
|
|
5287
5291
|
}
|
|
5292
|
+
if (stream.buf[lo]?.passed === true) frame.passed = true;
|
|
5288
5293
|
stream.buf.splice(lo, 0, frame);
|
|
5289
5294
|
this.#drainUnlessDeferred(stream);
|
|
5290
5295
|
}
|
|
@@ -5320,6 +5325,41 @@ var FecReleaseSequencer = class {
|
|
|
5320
5325
|
}
|
|
5321
5326
|
return false;
|
|
5322
5327
|
}
|
|
5328
|
+
/**
|
|
5329
|
+
* These streams' sink is being replaced by one that has seen no source
|
|
5330
|
+
* frame yet. First, from a stream that holds a frame the overlay rebuilt,
|
|
5331
|
+
* release to the sink being replaced the frames the unanchored path had
|
|
5332
|
+
* already released to it (#cursorPassed): there they waited in its queue,
|
|
5333
|
+
* which its replacement flushes. A stream that holds none is not drained:
|
|
5334
|
+
* it holds nothing the anchor kept back, and a drain would still force out
|
|
5335
|
+
* a frame held past the hold limit, which before the anchor waited for the
|
|
5336
|
+
* next push. Then treat the streams as unsourced until a source frame is
|
|
5337
|
+
* released.
|
|
5338
|
+
*/
|
|
5339
|
+
unsource(packetId, catalogTrackName) {
|
|
5340
|
+
for (const stream of this.#streams.values()) {
|
|
5341
|
+
if (stream.packetId === packetId && (catalogTrackName === void 0 || stream.catalogTrackName === catalogTrackName)) {
|
|
5342
|
+
if (stream.draining === 0 && holdsRebuilt(stream)) {
|
|
5343
|
+
if (this.#deferDepth > 0) this.#deferredStreams.add(stream);
|
|
5344
|
+
else this.#drain(stream, true);
|
|
5345
|
+
}
|
|
5346
|
+
stream.sourced = false;
|
|
5347
|
+
}
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
/**
|
|
5351
|
+
* Whether a stream of `packetId` holds a frame the keyframe overlay rebuilt
|
|
5352
|
+
* (FrameMeta.fecSbnFirst). Without `catalogTrackName`, every stream of the
|
|
5353
|
+
* packetId.
|
|
5354
|
+
*/
|
|
5355
|
+
holdsRebuilt(packetId, catalogTrackName) {
|
|
5356
|
+
for (const stream of this.#streams.values()) {
|
|
5357
|
+
if (stream.packetId !== packetId) continue;
|
|
5358
|
+
if (catalogTrackName !== void 0 && stream.catalogTrackName !== catalogTrackName) continue;
|
|
5359
|
+
if (holdsRebuilt(stream)) return true;
|
|
5360
|
+
}
|
|
5361
|
+
return false;
|
|
5362
|
+
}
|
|
5323
5363
|
/** Re-evaluate held gaps after FEC state changed. */
|
|
5324
5364
|
poke(streamKey) {
|
|
5325
5365
|
if (streamKey !== void 0) {
|
|
@@ -5411,16 +5451,32 @@ var FecReleaseSequencer = class {
|
|
|
5411
5451
|
last: null,
|
|
5412
5452
|
lastSbn: void 0,
|
|
5413
5453
|
discontinuity: false,
|
|
5414
|
-
rapSsId: void 0
|
|
5454
|
+
rapSsId: void 0,
|
|
5455
|
+
sourced: false,
|
|
5456
|
+
draining: 0
|
|
5415
5457
|
};
|
|
5416
5458
|
this.#streams.set(streamKey, stream);
|
|
5417
5459
|
}
|
|
5418
5460
|
return stream;
|
|
5419
5461
|
}
|
|
5420
|
-
#
|
|
5462
|
+
/** `asUnanchored`: release overlay-rebuilt frames when unanchored did (#cursorPassed). */
|
|
5463
|
+
#drain(stream, asUnanchored = false) {
|
|
5464
|
+
stream.draining++;
|
|
5465
|
+
try {
|
|
5466
|
+
this.#drainLoop(stream, asUnanchored);
|
|
5467
|
+
} finally {
|
|
5468
|
+
stream.draining--;
|
|
5469
|
+
}
|
|
5470
|
+
}
|
|
5471
|
+
#drainLoop(stream, asUnanchored) {
|
|
5421
5472
|
while (stream.buf.length > 0 && stream.last !== null) {
|
|
5422
5473
|
const head = stream.buf[0];
|
|
5423
5474
|
const last = stream.last;
|
|
5475
|
+
if (compareFrameOrder(head, last) <= 0) {
|
|
5476
|
+
stream.buf.shift();
|
|
5477
|
+
this.#release(stream, head, void 0);
|
|
5478
|
+
continue;
|
|
5479
|
+
}
|
|
5424
5480
|
if (stream.discontinuity) {
|
|
5425
5481
|
stream.discontinuity = false;
|
|
5426
5482
|
stream.buf.shift();
|
|
@@ -5434,9 +5490,10 @@ var FecReleaseSequencer = class {
|
|
|
5434
5490
|
}
|
|
5435
5491
|
const headSbn = head.meta.fecSbn;
|
|
5436
5492
|
const from = stream.lastSbn ?? headSbn;
|
|
5437
|
-
const to = headSbn ?? stream.lastSbn;
|
|
5493
|
+
const to = head.meta.fecSbnFirst ?? headSbn ?? stream.lastSbn;
|
|
5438
5494
|
let lost = [];
|
|
5439
5495
|
const unanchored = from === void 0 && to === void 0;
|
|
5496
|
+
let unresolved = false;
|
|
5440
5497
|
if (from !== void 0 && to !== void 0) {
|
|
5441
5498
|
const resolved = this.#gate.resolvedLoss(
|
|
5442
5499
|
stream.packetId,
|
|
@@ -5445,7 +5502,8 @@ var FecReleaseSequencer = class {
|
|
|
5445
5502
|
Math.max(from, to),
|
|
5446
5503
|
from
|
|
5447
5504
|
);
|
|
5448
|
-
|
|
5505
|
+
unresolved = resolved === null;
|
|
5506
|
+
if (unresolved && !this.#cursorPassed(stream, asUnanchored)) {
|
|
5449
5507
|
const heldMs = performance.now() - head.arrivedAtMs;
|
|
5450
5508
|
if (heldMs <= this.#gate.holdLimitMs(stream.packetId, stream.catalogTrackName)) return;
|
|
5451
5509
|
this.#recordStat("forcedWindowFlushes");
|
|
@@ -5453,22 +5511,56 @@ var FecReleaseSequencer = class {
|
|
|
5453
5511
|
this.#release(stream, head, this.#gate.decide(last, head, [], true));
|
|
5454
5512
|
continue;
|
|
5455
5513
|
}
|
|
5456
|
-
lost = resolved;
|
|
5514
|
+
lost = resolved ?? [];
|
|
5457
5515
|
}
|
|
5458
5516
|
stream.buf.shift();
|
|
5459
5517
|
this.#release(
|
|
5460
5518
|
stream,
|
|
5461
5519
|
head,
|
|
5462
|
-
lost.length > 0 || unanchored || authoredGap(last.meta, head.meta) ? this.#gate.decide(last, head, lost, false) : void 0
|
|
5520
|
+
lost.length > 0 || unanchored || unresolved || authoredGap(last.meta, head.meta) ? this.#gate.decide(last, head, lost, false) : void 0
|
|
5463
5521
|
);
|
|
5464
5522
|
}
|
|
5465
5523
|
}
|
|
5524
|
+
/**
|
|
5525
|
+
* An overlay-rebuilt frame (fecSbnFirst) waits no longer than the BLO-53342
|
|
5526
|
+
* source cursor holds it unanchored, and neither does a later frame behind
|
|
5527
|
+
* it. Unanchored, a frame that waits on no block (fecSbnFirst set, or no
|
|
5528
|
+
* fecSbn) left the gate once every frame ahead of it had: mark it `passed`,
|
|
5529
|
+
* like each frame that arrived in front of it since (stale there). The head
|
|
5530
|
+
* then goes, decided as it would be unanchored, once a frame the base path
|
|
5531
|
+
* delivered (a source frame, or one base FEC recovered) is buffered after a
|
|
5532
|
+
* marked one: the base path has passed that one, so a frame still missing
|
|
5533
|
+
* before it can only come from a repair. It also goes while no source frame
|
|
5534
|
+
* has been released, when the direct path shows a recovered frame at once.
|
|
5535
|
+
* And it goes at once while a staged switch decides on when frames arrive
|
|
5536
|
+
* (FecReleaseGate.releaseUnanchored), and when unsource releases into a
|
|
5537
|
+
* sink being replaced: unanchored, it had already reached the sink.
|
|
5538
|
+
* The scan also writes: the `passed` marks it sets stay on the frames,
|
|
5539
|
+
* and push marks a frame it inserts in front of a marked one from them.
|
|
5540
|
+
*/
|
|
5541
|
+
#cursorPassed(stream, asUnanchored) {
|
|
5542
|
+
let at = -1;
|
|
5543
|
+
for (let i = 0; i < stream.buf.length; i++) {
|
|
5544
|
+
const frame = stream.buf[i];
|
|
5545
|
+
if (frame.meta.fecSbnFirst !== void 0 || frame.meta.fecSbn === void 0) {
|
|
5546
|
+
frame.passed = true;
|
|
5547
|
+
if (at < 0) at = i;
|
|
5548
|
+
} else if (frame.passed !== true) break;
|
|
5549
|
+
}
|
|
5550
|
+
if (at < 0) return false;
|
|
5551
|
+
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));
|
|
5552
|
+
}
|
|
5466
5553
|
#release(stream, frame, decision) {
|
|
5554
|
+
const stale = stream.last !== null && compareFrameOrder(frame, stream.last) <= 0;
|
|
5555
|
+
if (stale) this.#recordStat("droppedStale");
|
|
5467
5556
|
if (decision) frame.meta.gapBefore = decision;
|
|
5468
5557
|
stream.last = frame;
|
|
5469
|
-
if (frame.meta.fecSbn !== void 0
|
|
5558
|
+
if (frame.meta.fecSbn !== void 0 && (frame.meta.fecSbnFirst === void 0 || stream.lastSbn !== void 0)) {
|
|
5559
|
+
stream.lastSbn = frame.meta.fecSbn;
|
|
5560
|
+
}
|
|
5561
|
+
if (frame.meta.recovered !== true) stream.sourced = true;
|
|
5470
5562
|
this.#gate.onReleased?.(frame.data, frame.meta);
|
|
5471
|
-
this.#emit(frame.data, frame.meta);
|
|
5563
|
+
if (!stale) this.#emit(frame.data, frame.meta);
|
|
5472
5564
|
}
|
|
5473
5565
|
};
|
|
5474
5566
|
var FMPU_BOX_TYPES = /* @__PURE__ */ new Set(["ftyp", "moov", "moof"]);
|
|
@@ -5509,6 +5601,12 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5509
5601
|
this.#reclaimedTimingSamples = 0;
|
|
5510
5602
|
this.#evictedTimingSamples = 0;
|
|
5511
5603
|
this.#rejectedMovieFragments = 0;
|
|
5604
|
+
this.#recoveredHeadsAwaitingTiming = {
|
|
5605
|
+
held: 0,
|
|
5606
|
+
expired: 0,
|
|
5607
|
+
discarded: 0,
|
|
5608
|
+
superseded: 0
|
|
5609
|
+
};
|
|
5512
5610
|
this.#sequencers = /* @__PURE__ */ new Map();
|
|
5513
5611
|
this.#fecGate = null;
|
|
5514
5612
|
this.#fecSequencer = null;
|
|
@@ -5617,6 +5715,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5617
5715
|
#reclaimedTimingSamples;
|
|
5618
5716
|
#evictedTimingSamples;
|
|
5619
5717
|
#rejectedMovieFragments;
|
|
5718
|
+
#recoveredHeadsAwaitingTiming;
|
|
5620
5719
|
#sequencers;
|
|
5621
5720
|
#fecGate;
|
|
5622
5721
|
#fecSequencer;
|
|
@@ -5722,11 +5821,12 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5722
5821
|
/**
|
|
5723
5822
|
* Typed view of the ISO-BMFF timing-sample budget.
|
|
5724
5823
|
*
|
|
5725
|
-
*
|
|
5726
|
-
*
|
|
5727
|
-
*
|
|
5728
|
-
*
|
|
5729
|
-
*
|
|
5824
|
+
* Each stream admits timing against its own window of `capacity` slots
|
|
5825
|
+
* (BLO-52085). A stream at capacity displaces its own oldest timing to
|
|
5826
|
+
* admit the moof in hand, and `evicted` counts the slots so displaced:
|
|
5827
|
+
* timing a stream declared and never delivered shows up there. `pending`
|
|
5828
|
+
* sums every stream, so it can exceed `capacity`. Per repo policy this is
|
|
5829
|
+
* a producer-owned counter -- never infer budget state by parsing logs.
|
|
5730
5830
|
*/
|
|
5731
5831
|
get timingBudgetStats() {
|
|
5732
5832
|
return {
|
|
@@ -5737,6 +5837,14 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5737
5837
|
rejectedMovieFragments: this.#rejectedMovieFragments
|
|
5738
5838
|
};
|
|
5739
5839
|
}
|
|
5840
|
+
/** Recovered heads parked for FT=1 timing (BLO-53369). Survives dispose(). */
|
|
5841
|
+
get recoveredHeadsAwaitingTiming() {
|
|
5842
|
+
let pending = 0;
|
|
5843
|
+
for (const { awaitingTiming } of this.#timingStreams.values()) {
|
|
5844
|
+
for (const head of awaitingTiming) if (head.options?.recovered) pending++;
|
|
5845
|
+
}
|
|
5846
|
+
return { ...this.#recoveredHeadsAwaitingTiming, pending };
|
|
5847
|
+
}
|
|
5740
5848
|
get reorderStats() {
|
|
5741
5849
|
let bufferedFrames = this.#fecSequencer?.buffered ?? 0;
|
|
5742
5850
|
for (const { sequencer } of this.#sequencers.values()) bufferedFrames += sequencer.buffered;
|
|
@@ -5778,6 +5886,14 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5778
5886
|
fecReleaseRapAbove(packetId, catalogTrackName, ssId) {
|
|
5779
5887
|
return this.#fecSequencer?.rapAbove(packetId, catalogTrackName, ssId) ?? false;
|
|
5780
5888
|
}
|
|
5889
|
+
/** See FecReleaseSequencer.unsource. */
|
|
5890
|
+
unsourceFecRelease(packetId, catalogTrackName) {
|
|
5891
|
+
this.#fecSequencer?.unsource(packetId, catalogTrackName);
|
|
5892
|
+
}
|
|
5893
|
+
/** See FecReleaseSequencer.holdsRebuilt. */
|
|
5894
|
+
fecReleaseHoldsRebuilt(packetId, catalogTrackName) {
|
|
5895
|
+
return this.#fecSequencer?.holdsRebuilt(packetId, catalogTrackName) ?? false;
|
|
5896
|
+
}
|
|
5781
5897
|
/** Re-evaluate held gaps after FEC block state changed. */
|
|
5782
5898
|
pokeFecRelease(packetId, catalogTrackName) {
|
|
5783
5899
|
if (!this.#fecSequencer) return;
|
|
@@ -5910,7 +6026,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5910
6026
|
const now = Date.now();
|
|
5911
6027
|
for (const { awaitingTiming } of this.#timingStreams.values()) {
|
|
5912
6028
|
while (awaitingTiming.length > 0 && now - awaitingTiming[0].arrivedAt > timeoutMs) {
|
|
5913
|
-
awaitingTiming.shift();
|
|
6029
|
+
this.#leaveAwaitingTiming(awaitingTiming.shift(), "expired");
|
|
5914
6030
|
}
|
|
5915
6031
|
}
|
|
5916
6032
|
}
|
|
@@ -6031,7 +6147,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6031
6147
|
if (!resolver2?.initialized) return this.#drop("fragment-no-resolver");
|
|
6032
6148
|
const pendingBefore = resolver2.pendingSampleCount;
|
|
6033
6149
|
const evictedBefore = resolver2.evictedSampleCount;
|
|
6034
|
-
const remaining = this.#maxPendingTimingSamples -
|
|
6150
|
+
const remaining = this.#maxPendingTimingSamples - resolver2.pendingSampleCount;
|
|
6035
6151
|
const admitted = resolver2.addMovieFragment(
|
|
6036
6152
|
mpu.mpuSequenceNumber,
|
|
6037
6153
|
data,
|
|
@@ -6078,6 +6194,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6078
6194
|
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
6079
6195
|
movieFragmentSequenceNumber: mfuDuHeader.movieFragmentSequenceNumber,
|
|
6080
6196
|
sampleNumber: mfuDuHeader.sampleNumber,
|
|
6197
|
+
sequenceNumber: info.sequenceNumber,
|
|
6081
6198
|
arrivedAt: Date.now()
|
|
6082
6199
|
});
|
|
6083
6200
|
return this.#drop("mfu-sample-timing-missing");
|
|
@@ -6103,7 +6220,8 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6103
6220
|
info,
|
|
6104
6221
|
resolver,
|
|
6105
6222
|
options?.recovered === true,
|
|
6106
|
-
options?.fecSbn
|
|
6223
|
+
options?.fecSbn,
|
|
6224
|
+
options?.fecSbnFirst
|
|
6107
6225
|
);
|
|
6108
6226
|
if (deferred.record === void 0) this.#countDeferredOutcome(deferred.reason);
|
|
6109
6227
|
}
|
|
@@ -6196,7 +6314,8 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6196
6314
|
info,
|
|
6197
6315
|
resolver,
|
|
6198
6316
|
options?.recovered === true,
|
|
6199
|
-
options?.fecSbn
|
|
6317
|
+
options?.fecSbn,
|
|
6318
|
+
options?.fecSbnFirst
|
|
6200
6319
|
);
|
|
6201
6320
|
if (outcome.record !== void 0) return outcome.record;
|
|
6202
6321
|
return this.#drop(outcome.reason);
|
|
@@ -6216,7 +6335,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6216
6335
|
* attribution exists to keep readable. Leaving the choice at the call site
|
|
6217
6336
|
* is what keeps both true.
|
|
6218
6337
|
*/
|
|
6219
|
-
#emitCombinedSample(combined, info, resolver, recovered, fecSbn) {
|
|
6338
|
+
#emitCombinedSample(combined, info, resolver, recovered, fecSbn, fecSbnFirst) {
|
|
6220
6339
|
const timing = resolver.sampleTiming(
|
|
6221
6340
|
combined.mpuSequenceNumber,
|
|
6222
6341
|
combined.movieFragmentSequenceNumber,
|
|
@@ -6233,6 +6352,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6233
6352
|
);
|
|
6234
6353
|
if (!meta) return { reason: "combined-meta-build-failed" };
|
|
6235
6354
|
if (fecSbn !== void 0) meta.fecSbn = fecSbn;
|
|
6355
|
+
if (fecSbnFirst !== void 0) meta.fecSbnFirst = fecSbnFirst;
|
|
6236
6356
|
if (!resolver.consumeSample(
|
|
6237
6357
|
combined.mpuSequenceNumber,
|
|
6238
6358
|
combined.movieFragmentSequenceNumber,
|
|
@@ -6466,6 +6586,9 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6466
6586
|
for (const { sequencer } of this.#sequencers.values()) sequencer.discard();
|
|
6467
6587
|
this.#sequencers.clear();
|
|
6468
6588
|
this.#fecSequencer?.discard();
|
|
6589
|
+
for (const { awaitingTiming } of this.#timingStreams.values()) {
|
|
6590
|
+
for (const head of awaitingTiming) this.#leaveAwaitingTiming(head, "discarded");
|
|
6591
|
+
}
|
|
6469
6592
|
this.#timingStreams.clear();
|
|
6470
6593
|
this.#pendingTimingSamples = 0;
|
|
6471
6594
|
this.#reliableMoqStartupGate.clear();
|
|
@@ -6484,10 +6607,23 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6484
6607
|
return resolver;
|
|
6485
6608
|
}
|
|
6486
6609
|
#awaitTiming(streamKey, head) {
|
|
6487
|
-
const
|
|
6488
|
-
if (!
|
|
6610
|
+
const state = this.#timingStreams.get(streamKey);
|
|
6611
|
+
if (!state) return;
|
|
6612
|
+
if (!head.options?.recovered) {
|
|
6613
|
+
const kept = state.awaitingTiming.filter((queued) => !queued.options?.recovered || queued.sequenceNumber !== head.sequenceNumber);
|
|
6614
|
+
this.#recoveredHeadsAwaitingTiming.superseded += state.awaitingTiming.length - kept.length;
|
|
6615
|
+
state.awaitingTiming = kept;
|
|
6616
|
+
}
|
|
6617
|
+
const awaitingTiming = state.awaitingTiming;
|
|
6489
6618
|
awaitingTiming.push(head);
|
|
6490
|
-
if (
|
|
6619
|
+
if (head.options?.recovered) this.#recoveredHeadsAwaitingTiming.held++;
|
|
6620
|
+
if (awaitingTiming.length > MAX_AWAITING_TIMING_HEADS) {
|
|
6621
|
+
this.#leaveAwaitingTiming(awaitingTiming.shift(), "expired");
|
|
6622
|
+
}
|
|
6623
|
+
}
|
|
6624
|
+
/** Count a recovered head leaving the queue other than by replay or its source copy. */
|
|
6625
|
+
#leaveAwaitingTiming(head, outcome) {
|
|
6626
|
+
if (head.options?.recovered) this.#recoveredHeadsAwaitingTiming[outcome]++;
|
|
6491
6627
|
}
|
|
6492
6628
|
/**
|
|
6493
6629
|
* Feed again the heads whose timing the FT=1 just admitted declares. That
|
|
@@ -6515,6 +6651,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
6515
6651
|
const state = this.#timingStreams.get(streamKey);
|
|
6516
6652
|
if (!state) return;
|
|
6517
6653
|
this.#timingStreams.delete(streamKey);
|
|
6654
|
+
for (const head of state.awaitingTiming) this.#leaveAwaitingTiming(head, "discarded");
|
|
6518
6655
|
this.#pendingTimingSamples -= state.resolver.pendingSampleCount;
|
|
6519
6656
|
if (this.#pendingTimingSamples < 0) {
|
|
6520
6657
|
throw new Error("[MmtpContainerParser] pending timing sample accounting underflow");
|