@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
|
@@ -6005,7 +6005,10 @@ var BlockcastMmt = (() => {
|
|
|
6005
6005
|
function ssIdAfter(a, b) {
|
|
6006
6006
|
return (a - b | 0) > 0;
|
|
6007
6007
|
}
|
|
6008
|
-
|
|
6008
|
+
function holdsRebuilt(stream) {
|
|
6009
|
+
return stream.buf.some(({ meta }) => meta.fecSbnFirst !== void 0);
|
|
6010
|
+
}
|
|
6011
|
+
var _streams2, _gate, _emit2, _recordStat2, _deferDepth, _deferredStreams, _FecReleaseSequencer_instances, drainUnlessDeferred_fn, streamFor_fn2, drain_fn, drainLoop_fn, cursorPassed_fn, release_fn;
|
|
6009
6012
|
var FecReleaseSequencer = class {
|
|
6010
6013
|
constructor(gate, emit, recordStat) {
|
|
6011
6014
|
__privateAdd(this, _FecReleaseSequencer_instances);
|
|
@@ -6065,6 +6068,7 @@ var BlockcastMmt = (() => {
|
|
|
6065
6068
|
stream.lastSbn = void 0;
|
|
6066
6069
|
stream.discontinuity = false;
|
|
6067
6070
|
stream.rapSsId = void 0;
|
|
6071
|
+
stream.sourced = false;
|
|
6068
6072
|
}
|
|
6069
6073
|
if (stream.last !== null && compareFrameOrder(frame, stream.last) <= 0) {
|
|
6070
6074
|
__privateGet(this, _recordStat2).call(this, "droppedStale");
|
|
@@ -6091,6 +6095,7 @@ var BlockcastMmt = (() => {
|
|
|
6091
6095
|
if (compareFrameOrder(stream.buf[mid], frame) < 0) lo = mid + 1;
|
|
6092
6096
|
else hi = mid;
|
|
6093
6097
|
}
|
|
6098
|
+
if (stream.buf[lo]?.passed === true) frame.passed = true;
|
|
6094
6099
|
stream.buf.splice(lo, 0, frame);
|
|
6095
6100
|
__privateMethod(this, _FecReleaseSequencer_instances, drainUnlessDeferred_fn).call(this, stream);
|
|
6096
6101
|
}
|
|
@@ -6126,6 +6131,41 @@ var BlockcastMmt = (() => {
|
|
|
6126
6131
|
}
|
|
6127
6132
|
return false;
|
|
6128
6133
|
}
|
|
6134
|
+
/**
|
|
6135
|
+
* These streams' sink is being replaced by one that has seen no source
|
|
6136
|
+
* frame yet. First, from a stream that holds a frame the overlay rebuilt,
|
|
6137
|
+
* release to the sink being replaced the frames the unanchored path had
|
|
6138
|
+
* already released to it (#cursorPassed): there they waited in its queue,
|
|
6139
|
+
* which its replacement flushes. A stream that holds none is not drained:
|
|
6140
|
+
* it holds nothing the anchor kept back, and a drain would still force out
|
|
6141
|
+
* a frame held past the hold limit, which before the anchor waited for the
|
|
6142
|
+
* next push. Then treat the streams as unsourced until a source frame is
|
|
6143
|
+
* released.
|
|
6144
|
+
*/
|
|
6145
|
+
unsource(packetId, catalogTrackName) {
|
|
6146
|
+
for (const stream of __privateGet(this, _streams2).values()) {
|
|
6147
|
+
if (stream.packetId === packetId && (catalogTrackName === void 0 || stream.catalogTrackName === catalogTrackName)) {
|
|
6148
|
+
if (stream.draining === 0 && holdsRebuilt(stream)) {
|
|
6149
|
+
if (__privateGet(this, _deferDepth) > 0) __privateGet(this, _deferredStreams).add(stream);
|
|
6150
|
+
else __privateMethod(this, _FecReleaseSequencer_instances, drain_fn).call(this, stream, true);
|
|
6151
|
+
}
|
|
6152
|
+
stream.sourced = false;
|
|
6153
|
+
}
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
/**
|
|
6157
|
+
* Whether a stream of `packetId` holds a frame the keyframe overlay rebuilt
|
|
6158
|
+
* (FrameMeta.fecSbnFirst). Without `catalogTrackName`, every stream of the
|
|
6159
|
+
* packetId.
|
|
6160
|
+
*/
|
|
6161
|
+
holdsRebuilt(packetId, catalogTrackName) {
|
|
6162
|
+
for (const stream of __privateGet(this, _streams2).values()) {
|
|
6163
|
+
if (stream.packetId !== packetId) continue;
|
|
6164
|
+
if (catalogTrackName !== void 0 && stream.catalogTrackName !== catalogTrackName) continue;
|
|
6165
|
+
if (holdsRebuilt(stream)) return true;
|
|
6166
|
+
}
|
|
6167
|
+
return false;
|
|
6168
|
+
}
|
|
6129
6169
|
/** Re-evaluate held gaps after FEC state changed. */
|
|
6130
6170
|
poke(streamKey) {
|
|
6131
6171
|
if (streamKey !== void 0) {
|
|
@@ -6229,16 +6269,32 @@ var BlockcastMmt = (() => {
|
|
|
6229
6269
|
last: null,
|
|
6230
6270
|
lastSbn: void 0,
|
|
6231
6271
|
discontinuity: false,
|
|
6232
|
-
rapSsId: void 0
|
|
6272
|
+
rapSsId: void 0,
|
|
6273
|
+
sourced: false,
|
|
6274
|
+
draining: 0
|
|
6233
6275
|
};
|
|
6234
6276
|
__privateGet(this, _streams2).set(streamKey, stream);
|
|
6235
6277
|
}
|
|
6236
6278
|
return stream;
|
|
6237
6279
|
};
|
|
6238
|
-
|
|
6280
|
+
/** `asUnanchored`: release overlay-rebuilt frames when unanchored did (#cursorPassed). */
|
|
6281
|
+
drain_fn = function(stream, asUnanchored = false) {
|
|
6282
|
+
stream.draining++;
|
|
6283
|
+
try {
|
|
6284
|
+
__privateMethod(this, _FecReleaseSequencer_instances, drainLoop_fn).call(this, stream, asUnanchored);
|
|
6285
|
+
} finally {
|
|
6286
|
+
stream.draining--;
|
|
6287
|
+
}
|
|
6288
|
+
};
|
|
6289
|
+
drainLoop_fn = function(stream, asUnanchored) {
|
|
6239
6290
|
while (stream.buf.length > 0 && stream.last !== null) {
|
|
6240
6291
|
const head = stream.buf[0];
|
|
6241
6292
|
const last = stream.last;
|
|
6293
|
+
if (compareFrameOrder(head, last) <= 0) {
|
|
6294
|
+
stream.buf.shift();
|
|
6295
|
+
__privateMethod(this, _FecReleaseSequencer_instances, release_fn).call(this, stream, head, void 0);
|
|
6296
|
+
continue;
|
|
6297
|
+
}
|
|
6242
6298
|
if (stream.discontinuity) {
|
|
6243
6299
|
stream.discontinuity = false;
|
|
6244
6300
|
stream.buf.shift();
|
|
@@ -6252,9 +6308,10 @@ var BlockcastMmt = (() => {
|
|
|
6252
6308
|
}
|
|
6253
6309
|
const headSbn = head.meta.fecSbn;
|
|
6254
6310
|
const from = stream.lastSbn ?? headSbn;
|
|
6255
|
-
const to = headSbn ?? stream.lastSbn;
|
|
6311
|
+
const to = head.meta.fecSbnFirst ?? headSbn ?? stream.lastSbn;
|
|
6256
6312
|
let lost = [];
|
|
6257
6313
|
const unanchored = from === void 0 && to === void 0;
|
|
6314
|
+
let unresolved = false;
|
|
6258
6315
|
if (from !== void 0 && to !== void 0) {
|
|
6259
6316
|
const resolved = __privateGet(this, _gate).resolvedLoss(
|
|
6260
6317
|
stream.packetId,
|
|
@@ -6263,7 +6320,8 @@ var BlockcastMmt = (() => {
|
|
|
6263
6320
|
Math.max(from, to),
|
|
6264
6321
|
from
|
|
6265
6322
|
);
|
|
6266
|
-
|
|
6323
|
+
unresolved = resolved === null;
|
|
6324
|
+
if (unresolved && !__privateMethod(this, _FecReleaseSequencer_instances, cursorPassed_fn).call(this, stream, asUnanchored)) {
|
|
6267
6325
|
const heldMs = performance.now() - head.arrivedAtMs;
|
|
6268
6326
|
if (heldMs <= __privateGet(this, _gate).holdLimitMs(stream.packetId, stream.catalogTrackName)) return;
|
|
6269
6327
|
__privateGet(this, _recordStat2).call(this, "forcedWindowFlushes");
|
|
@@ -6271,18 +6329,52 @@ var BlockcastMmt = (() => {
|
|
|
6271
6329
|
__privateMethod(this, _FecReleaseSequencer_instances, release_fn).call(this, stream, head, __privateGet(this, _gate).decide(last, head, [], true));
|
|
6272
6330
|
continue;
|
|
6273
6331
|
}
|
|
6274
|
-
lost = resolved;
|
|
6332
|
+
lost = resolved ?? [];
|
|
6275
6333
|
}
|
|
6276
6334
|
stream.buf.shift();
|
|
6277
|
-
__privateMethod(this, _FecReleaseSequencer_instances, release_fn).call(this, stream, head, lost.length > 0 || unanchored || authoredGap(last.meta, head.meta) ? __privateGet(this, _gate).decide(last, head, lost, false) : void 0);
|
|
6335
|
+
__privateMethod(this, _FecReleaseSequencer_instances, release_fn).call(this, stream, head, lost.length > 0 || unanchored || unresolved || authoredGap(last.meta, head.meta) ? __privateGet(this, _gate).decide(last, head, lost, false) : void 0);
|
|
6278
6336
|
}
|
|
6279
6337
|
};
|
|
6338
|
+
/**
|
|
6339
|
+
* An overlay-rebuilt frame (fecSbnFirst) waits no longer than the BLO-53342
|
|
6340
|
+
* source cursor holds it unanchored, and neither does a later frame behind
|
|
6341
|
+
* it. Unanchored, a frame that waits on no block (fecSbnFirst set, or no
|
|
6342
|
+
* fecSbn) left the gate once every frame ahead of it had: mark it `passed`,
|
|
6343
|
+
* like each frame that arrived in front of it since (stale there). The head
|
|
6344
|
+
* then goes, decided as it would be unanchored, once a frame the base path
|
|
6345
|
+
* delivered (a source frame, or one base FEC recovered) is buffered after a
|
|
6346
|
+
* marked one: the base path has passed that one, so a frame still missing
|
|
6347
|
+
* before it can only come from a repair. It also goes while no source frame
|
|
6348
|
+
* has been released, when the direct path shows a recovered frame at once.
|
|
6349
|
+
* And it goes at once while a staged switch decides on when frames arrive
|
|
6350
|
+
* (FecReleaseGate.releaseUnanchored), and when unsource releases into a
|
|
6351
|
+
* sink being replaced: unanchored, it had already reached the sink.
|
|
6352
|
+
* The scan also writes: the `passed` marks it sets stay on the frames,
|
|
6353
|
+
* and push marks a frame it inserts in front of a marked one from them.
|
|
6354
|
+
*/
|
|
6355
|
+
cursorPassed_fn = function(stream, asUnanchored) {
|
|
6356
|
+
let at = -1;
|
|
6357
|
+
for (let i = 0; i < stream.buf.length; i++) {
|
|
6358
|
+
const frame = stream.buf[i];
|
|
6359
|
+
if (frame.meta.fecSbnFirst !== void 0 || frame.meta.fecSbn === void 0) {
|
|
6360
|
+
frame.passed = true;
|
|
6361
|
+
if (at < 0) at = i;
|
|
6362
|
+
} else if (frame.passed !== true) break;
|
|
6363
|
+
}
|
|
6364
|
+
if (at < 0) return false;
|
|
6365
|
+
return asUnanchored || !stream.sourced || __privateGet(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));
|
|
6366
|
+
};
|
|
6280
6367
|
release_fn = function(stream, frame, decision) {
|
|
6368
|
+
const stale = stream.last !== null && compareFrameOrder(frame, stream.last) <= 0;
|
|
6369
|
+
if (stale) __privateGet(this, _recordStat2).call(this, "droppedStale");
|
|
6281
6370
|
if (decision) frame.meta.gapBefore = decision;
|
|
6282
6371
|
stream.last = frame;
|
|
6283
|
-
if (frame.meta.fecSbn !== void 0
|
|
6372
|
+
if (frame.meta.fecSbn !== void 0 && (frame.meta.fecSbnFirst === void 0 || stream.lastSbn !== void 0)) {
|
|
6373
|
+
stream.lastSbn = frame.meta.fecSbn;
|
|
6374
|
+
}
|
|
6375
|
+
if (frame.meta.recovered !== true) stream.sourced = true;
|
|
6284
6376
|
__privateGet(this, _gate).onReleased?.(frame.data, frame.meta);
|
|
6285
|
-
__privateGet(this, _emit2).call(this, frame.data, frame.meta);
|
|
6377
|
+
if (!stale) __privateGet(this, _emit2).call(this, frame.data, frame.meta);
|
|
6286
6378
|
};
|
|
6287
6379
|
var FMPU_BOX_TYPES = /* @__PURE__ */ new Set(["ftyp", "moov", "moof"]);
|
|
6288
6380
|
function isFmp4Box(data) {
|
|
@@ -6291,7 +6383,7 @@ var BlockcastMmt = (() => {
|
|
|
6291
6383
|
return FMPU_BOX_TYPES.has(type);
|
|
6292
6384
|
}
|
|
6293
6385
|
var MAX_AWAITING_TIMING_HEADS = 8;
|
|
6294
|
-
var _tracks, _defaultTrack, _reassembler, _sampleCombiners, _sampleCombinerOptions, _retiredSampleCombinerStats, _timingStreams, _maxPendingTimingSamples, _pendingTimingSamples, _reclaimedTimingSamples, _evictedTimingSamples, _rejectedMovieFragments, _sequencers, _fecGate, _fecSequencer, _reorderWindow, _reassemblyPolicy, _frameCb, _initCb, _sourceSymbolCb, _trackFrameCbs, _reorderStats, _reliableMoqStartupGate, _disposed, _replayingAwaitingTiming, _fedObjects, _reassemblerFragmentsFed, _reassemblerDataUnitsReturned, _feedOutcomes, _deferredFeedOutcomes, _lastOutcome, _lastOutcomeCount, _MmtpContainerParser_instances, streamKey_fn, sampleCombinerFor_fn, releaseTimingSlot_fn, dropSampleCombiner_fn, countOutcome_fn, countDeferredOutcome_fn, drop_fn, feedCounted_fn, feed_fn, emitCombinedSample_fn, passReliableMoqStartupGate_fn, timingResolver_fn, awaitTiming_fn, replayAwaitingTiming_fn, dropTimingStream_fn, validateReassemblyPolicy_fn, buildFrameMeta_fn, sequencerFor_fn, flushSequencers_fn, emitFrame_fn2, _MmtpContainerParser_static, scanForKeyframe_fn, scanLengthPrefixedHevcForKeyframe_fn, scanAnnexBForKeyframe_fn;
|
|
6386
|
+
var _tracks, _defaultTrack, _reassembler, _sampleCombiners, _sampleCombinerOptions, _retiredSampleCombinerStats, _timingStreams, _maxPendingTimingSamples, _pendingTimingSamples, _reclaimedTimingSamples, _evictedTimingSamples, _rejectedMovieFragments, _recoveredHeadsAwaitingTiming, _sequencers, _fecGate, _fecSequencer, _reorderWindow, _reassemblyPolicy, _frameCb, _initCb, _sourceSymbolCb, _trackFrameCbs, _reorderStats, _reliableMoqStartupGate, _disposed, _replayingAwaitingTiming, _fedObjects, _reassemblerFragmentsFed, _reassemblerDataUnitsReturned, _feedOutcomes, _deferredFeedOutcomes, _lastOutcome, _lastOutcomeCount, _MmtpContainerParser_instances, streamKey_fn, sampleCombinerFor_fn, releaseTimingSlot_fn, dropSampleCombiner_fn, countOutcome_fn, countDeferredOutcome_fn, drop_fn, feedCounted_fn, feed_fn, emitCombinedSample_fn, passReliableMoqStartupGate_fn, timingResolver_fn, awaitTiming_fn, leaveAwaitingTiming_fn, replayAwaitingTiming_fn, dropTimingStream_fn, validateReassemblyPolicy_fn, buildFrameMeta_fn, sequencerFor_fn, flushSequencers_fn, emitFrame_fn2, _MmtpContainerParser_static, scanForKeyframe_fn, scanLengthPrefixedHevcForKeyframe_fn, scanAnnexBForKeyframe_fn;
|
|
6295
6387
|
var _MmtpContainerParser = class _MmtpContainerParser {
|
|
6296
6388
|
constructor(config) {
|
|
6297
6389
|
__privateAdd(this, _MmtpContainerParser_instances);
|
|
@@ -6327,6 +6419,12 @@ var BlockcastMmt = (() => {
|
|
|
6327
6419
|
__privateAdd(this, _reclaimedTimingSamples, 0);
|
|
6328
6420
|
__privateAdd(this, _evictedTimingSamples, 0);
|
|
6329
6421
|
__privateAdd(this, _rejectedMovieFragments, 0);
|
|
6422
|
+
__privateAdd(this, _recoveredHeadsAwaitingTiming, {
|
|
6423
|
+
held: 0,
|
|
6424
|
+
expired: 0,
|
|
6425
|
+
discarded: 0,
|
|
6426
|
+
superseded: 0
|
|
6427
|
+
});
|
|
6330
6428
|
__privateAdd(this, _sequencers, /* @__PURE__ */ new Map());
|
|
6331
6429
|
__privateAdd(this, _fecGate, null);
|
|
6332
6430
|
__privateAdd(this, _fecSequencer, null);
|
|
@@ -6454,11 +6552,12 @@ var BlockcastMmt = (() => {
|
|
|
6454
6552
|
/**
|
|
6455
6553
|
* Typed view of the ISO-BMFF timing-sample budget.
|
|
6456
6554
|
*
|
|
6457
|
-
*
|
|
6458
|
-
*
|
|
6459
|
-
*
|
|
6460
|
-
*
|
|
6461
|
-
*
|
|
6555
|
+
* Each stream admits timing against its own window of `capacity` slots
|
|
6556
|
+
* (BLO-52085). A stream at capacity displaces its own oldest timing to
|
|
6557
|
+
* admit the moof in hand, and `evicted` counts the slots so displaced:
|
|
6558
|
+
* timing a stream declared and never delivered shows up there. `pending`
|
|
6559
|
+
* sums every stream, so it can exceed `capacity`. Per repo policy this is
|
|
6560
|
+
* a producer-owned counter -- never infer budget state by parsing logs.
|
|
6462
6561
|
*/
|
|
6463
6562
|
get timingBudgetStats() {
|
|
6464
6563
|
return {
|
|
@@ -6469,6 +6568,14 @@ var BlockcastMmt = (() => {
|
|
|
6469
6568
|
rejectedMovieFragments: __privateGet(this, _rejectedMovieFragments)
|
|
6470
6569
|
};
|
|
6471
6570
|
}
|
|
6571
|
+
/** Recovered heads parked for FT=1 timing (BLO-53369). Survives dispose(). */
|
|
6572
|
+
get recoveredHeadsAwaitingTiming() {
|
|
6573
|
+
let pending = 0;
|
|
6574
|
+
for (const { awaitingTiming } of __privateGet(this, _timingStreams).values()) {
|
|
6575
|
+
for (const head of awaitingTiming) if (head.options?.recovered) pending++;
|
|
6576
|
+
}
|
|
6577
|
+
return { ...__privateGet(this, _recoveredHeadsAwaitingTiming), pending };
|
|
6578
|
+
}
|
|
6472
6579
|
get reorderStats() {
|
|
6473
6580
|
let bufferedFrames = __privateGet(this, _fecSequencer)?.buffered ?? 0;
|
|
6474
6581
|
for (const { sequencer } of __privateGet(this, _sequencers).values()) bufferedFrames += sequencer.buffered;
|
|
@@ -6510,6 +6617,14 @@ var BlockcastMmt = (() => {
|
|
|
6510
6617
|
fecReleaseRapAbove(packetId, catalogTrackName, ssId) {
|
|
6511
6618
|
return __privateGet(this, _fecSequencer)?.rapAbove(packetId, catalogTrackName, ssId) ?? false;
|
|
6512
6619
|
}
|
|
6620
|
+
/** See FecReleaseSequencer.unsource. */
|
|
6621
|
+
unsourceFecRelease(packetId, catalogTrackName) {
|
|
6622
|
+
__privateGet(this, _fecSequencer)?.unsource(packetId, catalogTrackName);
|
|
6623
|
+
}
|
|
6624
|
+
/** See FecReleaseSequencer.holdsRebuilt. */
|
|
6625
|
+
fecReleaseHoldsRebuilt(packetId, catalogTrackName) {
|
|
6626
|
+
return __privateGet(this, _fecSequencer)?.holdsRebuilt(packetId, catalogTrackName) ?? false;
|
|
6627
|
+
}
|
|
6513
6628
|
/** Re-evaluate held gaps after FEC block state changed. */
|
|
6514
6629
|
pokeFecRelease(packetId, catalogTrackName) {
|
|
6515
6630
|
if (!__privateGet(this, _fecSequencer)) return;
|
|
@@ -6620,7 +6735,7 @@ var BlockcastMmt = (() => {
|
|
|
6620
6735
|
const now = Date.now();
|
|
6621
6736
|
for (const { awaitingTiming } of __privateGet(this, _timingStreams).values()) {
|
|
6622
6737
|
while (awaitingTiming.length > 0 && now - awaitingTiming[0].arrivedAt > timeoutMs) {
|
|
6623
|
-
awaitingTiming.shift();
|
|
6738
|
+
__privateMethod(this, _MmtpContainerParser_instances, leaveAwaitingTiming_fn).call(this, awaitingTiming.shift(), "expired");
|
|
6624
6739
|
}
|
|
6625
6740
|
}
|
|
6626
6741
|
}
|
|
@@ -6873,6 +6988,9 @@ var BlockcastMmt = (() => {
|
|
|
6873
6988
|
for (const { sequencer } of __privateGet(this, _sequencers).values()) sequencer.discard();
|
|
6874
6989
|
__privateGet(this, _sequencers).clear();
|
|
6875
6990
|
__privateGet(this, _fecSequencer)?.discard();
|
|
6991
|
+
for (const { awaitingTiming } of __privateGet(this, _timingStreams).values()) {
|
|
6992
|
+
for (const head of awaitingTiming) __privateMethod(this, _MmtpContainerParser_instances, leaveAwaitingTiming_fn).call(this, head, "discarded");
|
|
6993
|
+
}
|
|
6876
6994
|
__privateGet(this, _timingStreams).clear();
|
|
6877
6995
|
__privateSet(this, _pendingTimingSamples, 0);
|
|
6878
6996
|
__privateGet(this, _reliableMoqStartupGate).clear();
|
|
@@ -6901,6 +7019,7 @@ var BlockcastMmt = (() => {
|
|
|
6901
7019
|
_reclaimedTimingSamples = new WeakMap();
|
|
6902
7020
|
_evictedTimingSamples = new WeakMap();
|
|
6903
7021
|
_rejectedMovieFragments = new WeakMap();
|
|
7022
|
+
_recoveredHeadsAwaitingTiming = new WeakMap();
|
|
6904
7023
|
_sequencers = new WeakMap();
|
|
6905
7024
|
_fecGate = new WeakMap();
|
|
6906
7025
|
_fecSequencer = new WeakMap();
|
|
@@ -7062,7 +7181,7 @@ var BlockcastMmt = (() => {
|
|
|
7062
7181
|
if (!resolver2?.initialized) return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "fragment-no-resolver");
|
|
7063
7182
|
const pendingBefore = resolver2.pendingSampleCount;
|
|
7064
7183
|
const evictedBefore = resolver2.evictedSampleCount;
|
|
7065
|
-
const remaining = __privateGet(this, _maxPendingTimingSamples) -
|
|
7184
|
+
const remaining = __privateGet(this, _maxPendingTimingSamples) - resolver2.pendingSampleCount;
|
|
7066
7185
|
const admitted = resolver2.addMovieFragment(
|
|
7067
7186
|
mpu.mpuSequenceNumber,
|
|
7068
7187
|
data,
|
|
@@ -7109,6 +7228,7 @@ var BlockcastMmt = (() => {
|
|
|
7109
7228
|
mpuSequenceNumber: mpu.mpuSequenceNumber,
|
|
7110
7229
|
movieFragmentSequenceNumber: mfuDuHeader.movieFragmentSequenceNumber,
|
|
7111
7230
|
sampleNumber: mfuDuHeader.sampleNumber,
|
|
7231
|
+
sequenceNumber: info.sequenceNumber,
|
|
7112
7232
|
arrivedAt: Date.now()
|
|
7113
7233
|
});
|
|
7114
7234
|
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, "mfu-sample-timing-missing");
|
|
@@ -7129,7 +7249,7 @@ var BlockcastMmt = (() => {
|
|
|
7129
7249
|
headTiming.size
|
|
7130
7250
|
);
|
|
7131
7251
|
if (readyOnRegister) {
|
|
7132
|
-
const deferred = __privateMethod(this, _MmtpContainerParser_instances, emitCombinedSample_fn).call(this, readyOnRegister, info, resolver, options?.recovered === true, options?.fecSbn);
|
|
7252
|
+
const deferred = __privateMethod(this, _MmtpContainerParser_instances, emitCombinedSample_fn).call(this, readyOnRegister, info, resolver, options?.recovered === true, options?.fecSbn, options?.fecSbnFirst);
|
|
7133
7253
|
if (deferred.record === void 0) __privateMethod(this, _MmtpContainerParser_instances, countDeferredOutcome_fn).call(this, deferred.reason);
|
|
7134
7254
|
}
|
|
7135
7255
|
}
|
|
@@ -7216,7 +7336,7 @@ var BlockcastMmt = (() => {
|
|
|
7216
7336
|
fragmentCounter: mpu.fragmentCounter
|
|
7217
7337
|
};
|
|
7218
7338
|
}
|
|
7219
|
-
const outcome = __privateMethod(this, _MmtpContainerParser_instances, emitCombinedSample_fn).call(this, combined, info, resolver, options?.recovered === true, options?.fecSbn);
|
|
7339
|
+
const outcome = __privateMethod(this, _MmtpContainerParser_instances, emitCombinedSample_fn).call(this, combined, info, resolver, options?.recovered === true, options?.fecSbn, options?.fecSbnFirst);
|
|
7220
7340
|
if (outcome.record !== void 0) return outcome.record;
|
|
7221
7341
|
return __privateMethod(this, _MmtpContainerParser_instances, drop_fn).call(this, outcome.reason);
|
|
7222
7342
|
};
|
|
@@ -7235,7 +7355,7 @@ var BlockcastMmt = (() => {
|
|
|
7235
7355
|
* attribution exists to keep readable. Leaving the choice at the call site
|
|
7236
7356
|
* is what keeps both true.
|
|
7237
7357
|
*/
|
|
7238
|
-
emitCombinedSample_fn = function(combined, info, resolver, recovered, fecSbn) {
|
|
7358
|
+
emitCombinedSample_fn = function(combined, info, resolver, recovered, fecSbn, fecSbnFirst) {
|
|
7239
7359
|
const timing = resolver.sampleTiming(
|
|
7240
7360
|
combined.mpuSequenceNumber,
|
|
7241
7361
|
combined.movieFragmentSequenceNumber,
|
|
@@ -7246,6 +7366,7 @@ var BlockcastMmt = (() => {
|
|
|
7246
7366
|
const meta = __privateMethod(this, _MmtpContainerParser_instances, buildFrameMeta_fn).call(this, combined, info.packetId, info.sequenceNumber, timing, recovered);
|
|
7247
7367
|
if (!meta) return { reason: "combined-meta-build-failed" };
|
|
7248
7368
|
if (fecSbn !== void 0) meta.fecSbn = fecSbn;
|
|
7369
|
+
if (fecSbnFirst !== void 0) meta.fecSbnFirst = fecSbnFirst;
|
|
7249
7370
|
if (!resolver.consumeSample(
|
|
7250
7371
|
combined.mpuSequenceNumber,
|
|
7251
7372
|
combined.movieFragmentSequenceNumber,
|
|
@@ -7290,10 +7411,23 @@ var BlockcastMmt = (() => {
|
|
|
7290
7411
|
return resolver;
|
|
7291
7412
|
};
|
|
7292
7413
|
awaitTiming_fn = function(streamKey, head) {
|
|
7293
|
-
const
|
|
7294
|
-
if (!
|
|
7414
|
+
const state = __privateGet(this, _timingStreams).get(streamKey);
|
|
7415
|
+
if (!state) return;
|
|
7416
|
+
if (!head.options?.recovered) {
|
|
7417
|
+
const kept = state.awaitingTiming.filter((queued) => !queued.options?.recovered || queued.sequenceNumber !== head.sequenceNumber);
|
|
7418
|
+
__privateGet(this, _recoveredHeadsAwaitingTiming).superseded += state.awaitingTiming.length - kept.length;
|
|
7419
|
+
state.awaitingTiming = kept;
|
|
7420
|
+
}
|
|
7421
|
+
const awaitingTiming = state.awaitingTiming;
|
|
7295
7422
|
awaitingTiming.push(head);
|
|
7296
|
-
if (
|
|
7423
|
+
if (head.options?.recovered) __privateGet(this, _recoveredHeadsAwaitingTiming).held++;
|
|
7424
|
+
if (awaitingTiming.length > MAX_AWAITING_TIMING_HEADS) {
|
|
7425
|
+
__privateMethod(this, _MmtpContainerParser_instances, leaveAwaitingTiming_fn).call(this, awaitingTiming.shift(), "expired");
|
|
7426
|
+
}
|
|
7427
|
+
};
|
|
7428
|
+
/** Count a recovered head leaving the queue other than by replay or its source copy. */
|
|
7429
|
+
leaveAwaitingTiming_fn = function(head, outcome) {
|
|
7430
|
+
if (head.options?.recovered) __privateGet(this, _recoveredHeadsAwaitingTiming)[outcome]++;
|
|
7297
7431
|
};
|
|
7298
7432
|
/**
|
|
7299
7433
|
* Feed again the heads whose timing the FT=1 just admitted declares. That
|
|
@@ -7321,6 +7455,7 @@ var BlockcastMmt = (() => {
|
|
|
7321
7455
|
const state = __privateGet(this, _timingStreams).get(streamKey);
|
|
7322
7456
|
if (!state) return;
|
|
7323
7457
|
__privateGet(this, _timingStreams).delete(streamKey);
|
|
7458
|
+
for (const head of state.awaitingTiming) __privateMethod(this, _MmtpContainerParser_instances, leaveAwaitingTiming_fn).call(this, head, "discarded");
|
|
7324
7459
|
__privateSet(this, _pendingTimingSamples, __privateGet(this, _pendingTimingSamples) - state.resolver.pendingSampleCount);
|
|
7325
7460
|
if (__privateGet(this, _pendingTimingSamples) < 0) {
|
|
7326
7461
|
throw new Error("[MmtpContainerParser] pending timing sample accounting underflow");
|