@blockcast/mmt-container 0.1.0-main.ce3c8aeb7f68 → 0.1.0-main.cf0df54ddcf4
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 +44 -3
- package/dist/block-policy.d.ts +314 -0
- package/dist/block-policy.d.ts.map +1 -0
- package/dist/block-policy.js +466 -0
- package/dist/block-policy.js.map +7 -0
- package/dist/browser-runtime.js +2796 -573
- package/dist/browser-runtime.js.map +4 -4
- package/dist/catalog-fec-params.d.ts +28 -4
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +28 -1
- package/dist/catalog-fec-params.js.map +3 -3
- package/dist/cmaf-block-assembler.d.ts +25 -11
- package/dist/cmaf-block-assembler.d.ts.map +1 -1
- package/dist/cmaf-block-assembler.js +76 -177
- package/dist/cmaf-block-assembler.js.map +3 -3
- package/dist/cmaf-group-batcher.js.map +1 -1
- package/dist/cmcd-producer.d.ts.map +1 -1
- package/dist/cmcd-producer.js +0 -3
- package/dist/cmcd-producer.js.map +2 -2
- package/dist/conceal-timeline.d.ts +123 -0
- package/dist/conceal-timeline.d.ts.map +1 -0
- package/dist/conceal-timeline.js +122 -0
- package/dist/conceal-timeline.js.map +7 -0
- package/dist/duplicate-ledger.d.ts +197 -0
- package/dist/duplicate-ledger.d.ts.map +1 -0
- package/dist/duplicate-ledger.js +226 -0
- package/dist/duplicate-ledger.js.map +7 -0
- package/dist/fec-manager.d.ts +113 -23
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +879 -131
- package/dist/fec-manager.js.map +4 -4
- package/dist/fec-worker-setup.js +0 -8
- package/dist/fec-worker-setup.js.map +2 -2
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -3
- package/dist/index.js.map +2 -2
- package/dist/media-router.d.ts +5 -2
- package/dist/media-router.d.ts.map +1 -1
- package/dist/media-router.js +13 -1
- package/dist/media-router.js.map +2 -2
- package/dist/mmtp-container-parser.d.ts +85 -0
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +271 -4
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +273 -5
- package/dist/mmtp-container-parser.no-modules.js.map +3 -3
- package/dist/mmtp-decode-pipeline.d.ts +7 -1
- package/dist/mmtp-decode-pipeline.d.ts.map +1 -1
- package/dist/mmtp-decode-pipeline.js +279 -8
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-router.d.ts +88 -12
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +1031 -247
- package/dist/mmtp-router.js.map +3 -3
- package/dist/mmtp-to-cmaf.d.ts +0 -12
- package/dist/mmtp-to-cmaf.d.ts.map +1 -1
- package/dist/mmtp-to-cmaf.js +0 -62
- package/dist/mmtp-to-cmaf.js.map +2 -2
- package/dist/multicast-manager.d.ts +148 -16
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +2445 -477
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +119 -22
- package/dist/multicast-transport.js.map +3 -3
- package/dist/no-modules.js +271 -4
- package/dist/no-modules.js.map +2 -2
- package/dist/repair-fetch.d.ts +172 -23
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +235 -85
- package/dist/repair-fetch.js.map +4 -4
- package/dist/wasm-mmtp-container-parser.js +271 -4
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/node_modules/@blockcast/fec-worker/README.md +4 -4
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.d.ts +0 -2
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.d.ts.map +1 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.js +0 -8
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.js.map +1 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.d.ts +1 -7
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.d.ts.map +1 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker.js +4 -33
- package/node_modules/@blockcast/fec-worker/dist/fec-worker.js.map +2 -2
- package/node_modules/@blockcast/fec-worker/src/fec-worker-client.ts +0 -9
- package/node_modules/@blockcast/fec-worker/src/fec-worker-types.ts +1 -4
- package/node_modules/@blockcast/fec-worker/src/fec-worker.ts +15 -51
- package/package.json +14 -6
- package/schemas/catalog.schema.json +5 -0
- package/src/block-policy.ts +903 -0
- package/src/catalog-fec-params.ts +62 -5
- package/src/cmaf-block-assembler.ts +60 -151
- package/src/cmcd-producer.ts +0 -5
- package/src/conceal-timeline.ts +255 -0
- package/src/duplicate-ledger.ts +372 -0
- package/src/fec-manager.ts +742 -139
- package/src/index.ts +53 -1
- package/src/media-router.ts +22 -4
- package/src/mmtp-container-parser.ts +421 -1
- package/src/mmtp-decode-pipeline.ts +23 -6
- package/src/mmtp-router.ts +701 -93
- package/src/mmtp-to-cmaf.ts +1 -101
- package/src/multicast-manager.ts +587 -89
- package/src/multicast-transport.ts +108 -19
- package/src/repair-fetch.ts +491 -153
package/dist/no-modules.js
CHANGED
|
@@ -5108,6 +5108,199 @@ var FrameSequencer = class {
|
|
|
5108
5108
|
return true;
|
|
5109
5109
|
}
|
|
5110
5110
|
};
|
|
5111
|
+
function authoredAdjacent(before, after) {
|
|
5112
|
+
const a = before.authoredTiming;
|
|
5113
|
+
const b = after.authoredTiming;
|
|
5114
|
+
if (!a || !b || a.mediaTimescale !== b.mediaTimescale) return false;
|
|
5115
|
+
return b.decodeTime === a.decodeTime + BigInt(a.durationTicks);
|
|
5116
|
+
}
|
|
5117
|
+
function authoredGap(before, after) {
|
|
5118
|
+
const a = before.authoredTiming;
|
|
5119
|
+
const b = after.authoredTiming;
|
|
5120
|
+
if (!a || !b || a.mediaTimescale !== b.mediaTimescale) return false;
|
|
5121
|
+
return b.decodeTime > a.decodeTime + BigInt(a.durationTicks);
|
|
5122
|
+
}
|
|
5123
|
+
var FecReleaseSequencer = class {
|
|
5124
|
+
#streams = /* @__PURE__ */ new Map();
|
|
5125
|
+
#gate;
|
|
5126
|
+
#emit;
|
|
5127
|
+
#recordStat;
|
|
5128
|
+
constructor(gate, emit, recordStat) {
|
|
5129
|
+
this.#gate = gate;
|
|
5130
|
+
this.#emit = emit;
|
|
5131
|
+
this.#recordStat = recordStat;
|
|
5132
|
+
}
|
|
5133
|
+
get buffered() {
|
|
5134
|
+
let total = 0;
|
|
5135
|
+
for (const stream of this.#streams.values()) total += stream.buf.length;
|
|
5136
|
+
return total;
|
|
5137
|
+
}
|
|
5138
|
+
push(streamKey, data, meta, seq) {
|
|
5139
|
+
const frame = { data, meta: { ...meta }, seq, arrivedAtMs: performance.now() };
|
|
5140
|
+
const stream = this.#streamFor(streamKey, meta);
|
|
5141
|
+
if (meta.sourceDiscontinuity) {
|
|
5142
|
+
this.#recordStat("publisherResets");
|
|
5143
|
+
this.#recordStat("droppedOnPublisherReset", stream.buf.length);
|
|
5144
|
+
stream.buf = [];
|
|
5145
|
+
stream.last = null;
|
|
5146
|
+
stream.lastSbn = void 0;
|
|
5147
|
+
stream.discontinuity = false;
|
|
5148
|
+
}
|
|
5149
|
+
if (stream.last !== null && compareFrameOrder(frame, stream.last) <= 0) {
|
|
5150
|
+
this.#recordStat("droppedStale");
|
|
5151
|
+
return;
|
|
5152
|
+
}
|
|
5153
|
+
if (stream.last === null) {
|
|
5154
|
+
if (meta.trackType === "video" && !meta.keyframe) {
|
|
5155
|
+
this.#recordStat("droppedBeforeStartupKeyframe");
|
|
5156
|
+
return;
|
|
5157
|
+
}
|
|
5158
|
+
this.#release(stream, frame, void 0);
|
|
5159
|
+
this.#drain(stream);
|
|
5160
|
+
return;
|
|
5161
|
+
}
|
|
5162
|
+
let lo = 0;
|
|
5163
|
+
let hi = stream.buf.length;
|
|
5164
|
+
while (lo < hi) {
|
|
5165
|
+
const mid = lo + hi >>> 1;
|
|
5166
|
+
if (compareFrameOrder(stream.buf[mid], frame) < 0) lo = mid + 1;
|
|
5167
|
+
else hi = mid;
|
|
5168
|
+
}
|
|
5169
|
+
stream.buf.splice(lo, 0, frame);
|
|
5170
|
+
this.#drain(stream);
|
|
5171
|
+
}
|
|
5172
|
+
/** Re-evaluate held gaps after FEC state changed. */
|
|
5173
|
+
poke(streamKey) {
|
|
5174
|
+
if (streamKey !== void 0) {
|
|
5175
|
+
const stream = this.#streams.get(streamKey);
|
|
5176
|
+
if (stream) this.#drain(stream);
|
|
5177
|
+
return;
|
|
5178
|
+
}
|
|
5179
|
+
for (const stream of this.#streams.values()) this.#drain(stream);
|
|
5180
|
+
}
|
|
5181
|
+
/**
|
|
5182
|
+
* The source restarted: the next release stalls with `discontinuity`.
|
|
5183
|
+
* Only marks the stream. Frames held behind the restart are released by
|
|
5184
|
+
* the next `poke` (or push), so the caller decides when the drain runs; a
|
|
5185
|
+
* drain from inside FEC bookkeeping would re-enter it mid-update.
|
|
5186
|
+
*/
|
|
5187
|
+
markDiscontinuity(streamKey) {
|
|
5188
|
+
const stream = this.#streams.get(streamKey);
|
|
5189
|
+
if (!stream || stream.last === null) return;
|
|
5190
|
+
stream.discontinuity = true;
|
|
5191
|
+
}
|
|
5192
|
+
/** Release everything buffered, in order (finite inputs). */
|
|
5193
|
+
flush() {
|
|
5194
|
+
for (const stream of this.#streams.values()) {
|
|
5195
|
+
this.#drain(stream);
|
|
5196
|
+
while (stream.buf.length > 0) {
|
|
5197
|
+
const head = stream.buf[0];
|
|
5198
|
+
stream.buf.shift();
|
|
5199
|
+
this.#release(stream, head, void 0);
|
|
5200
|
+
}
|
|
5201
|
+
}
|
|
5202
|
+
}
|
|
5203
|
+
discardStream(streamKey) {
|
|
5204
|
+
const stream = this.#streams.get(streamKey);
|
|
5205
|
+
if (!stream) return;
|
|
5206
|
+
this.#recordStat("droppedOnLiveDispose", stream.buf.length);
|
|
5207
|
+
this.#streams.delete(streamKey);
|
|
5208
|
+
}
|
|
5209
|
+
/** Release one packet's buffered frames in order and forget its streams. */
|
|
5210
|
+
flushPacket(packetId) {
|
|
5211
|
+
for (const [key, stream] of this.#streams) {
|
|
5212
|
+
if (stream.packetId !== packetId) continue;
|
|
5213
|
+
this.#drain(stream);
|
|
5214
|
+
while (stream.buf.length > 0) {
|
|
5215
|
+
const head = stream.buf[0];
|
|
5216
|
+
stream.buf.shift();
|
|
5217
|
+
this.#release(stream, head, void 0);
|
|
5218
|
+
}
|
|
5219
|
+
this.#streams.delete(key);
|
|
5220
|
+
}
|
|
5221
|
+
}
|
|
5222
|
+
discardPacket(packetId) {
|
|
5223
|
+
for (const [key, stream] of this.#streams) {
|
|
5224
|
+
if (stream.packetId !== packetId) continue;
|
|
5225
|
+
this.#recordStat("droppedOnLiveDispose", stream.buf.length);
|
|
5226
|
+
this.#streams.delete(key);
|
|
5227
|
+
}
|
|
5228
|
+
}
|
|
5229
|
+
discard() {
|
|
5230
|
+
for (const stream of this.#streams.values()) {
|
|
5231
|
+
this.#recordStat("droppedOnLiveDispose", stream.buf.length);
|
|
5232
|
+
}
|
|
5233
|
+
this.#streams.clear();
|
|
5234
|
+
}
|
|
5235
|
+
#streamFor(streamKey, meta) {
|
|
5236
|
+
let stream = this.#streams.get(streamKey);
|
|
5237
|
+
if (!stream) {
|
|
5238
|
+
stream = {
|
|
5239
|
+
packetId: meta.packetId,
|
|
5240
|
+
...meta.catalogTrackName === void 0 ? {} : { catalogTrackName: meta.catalogTrackName },
|
|
5241
|
+
buf: [],
|
|
5242
|
+
last: null,
|
|
5243
|
+
lastSbn: void 0,
|
|
5244
|
+
discontinuity: false
|
|
5245
|
+
};
|
|
5246
|
+
this.#streams.set(streamKey, stream);
|
|
5247
|
+
}
|
|
5248
|
+
return stream;
|
|
5249
|
+
}
|
|
5250
|
+
#drain(stream) {
|
|
5251
|
+
while (stream.buf.length > 0 && stream.last !== null) {
|
|
5252
|
+
const head = stream.buf[0];
|
|
5253
|
+
const last = stream.last;
|
|
5254
|
+
if (stream.discontinuity) {
|
|
5255
|
+
stream.discontinuity = false;
|
|
5256
|
+
stream.buf.shift();
|
|
5257
|
+
this.#release(stream, head, this.#gate.decide(last, head, [], true));
|
|
5258
|
+
continue;
|
|
5259
|
+
}
|
|
5260
|
+
if (authoredAdjacent(last.meta, head.meta)) {
|
|
5261
|
+
stream.buf.shift();
|
|
5262
|
+
this.#release(stream, head, void 0);
|
|
5263
|
+
continue;
|
|
5264
|
+
}
|
|
5265
|
+
const headSbn = head.meta.fecSbn;
|
|
5266
|
+
const from = stream.lastSbn ?? headSbn;
|
|
5267
|
+
const to = headSbn ?? stream.lastSbn;
|
|
5268
|
+
let lost = [];
|
|
5269
|
+
const unanchored = from === void 0 && to === void 0;
|
|
5270
|
+
if (from !== void 0 && to !== void 0) {
|
|
5271
|
+
const resolved = this.#gate.resolvedLoss(
|
|
5272
|
+
stream.packetId,
|
|
5273
|
+
stream.catalogTrackName,
|
|
5274
|
+
Math.min(from, to),
|
|
5275
|
+
Math.max(from, to),
|
|
5276
|
+
from
|
|
5277
|
+
);
|
|
5278
|
+
if (resolved === null) {
|
|
5279
|
+
const heldMs = performance.now() - head.arrivedAtMs;
|
|
5280
|
+
if (heldMs <= this.#gate.holdLimitMs(stream.packetId, stream.catalogTrackName)) return;
|
|
5281
|
+
this.#recordStat("forcedWindowFlushes");
|
|
5282
|
+
stream.buf.shift();
|
|
5283
|
+
this.#release(stream, head, this.#gate.decide(last, head, [], true));
|
|
5284
|
+
continue;
|
|
5285
|
+
}
|
|
5286
|
+
lost = resolved;
|
|
5287
|
+
}
|
|
5288
|
+
stream.buf.shift();
|
|
5289
|
+
this.#release(
|
|
5290
|
+
stream,
|
|
5291
|
+
head,
|
|
5292
|
+
lost.length > 0 || unanchored || authoredGap(last.meta, head.meta) ? this.#gate.decide(last, head, lost, false) : void 0
|
|
5293
|
+
);
|
|
5294
|
+
}
|
|
5295
|
+
}
|
|
5296
|
+
#release(stream, frame, decision) {
|
|
5297
|
+
if (decision) frame.meta.gapBefore = decision;
|
|
5298
|
+
stream.last = frame;
|
|
5299
|
+
if (frame.meta.fecSbn !== void 0) stream.lastSbn = frame.meta.fecSbn;
|
|
5300
|
+
this.#gate.onReleased?.(frame.data, frame.meta);
|
|
5301
|
+
this.#emit(frame.data, frame.meta);
|
|
5302
|
+
}
|
|
5303
|
+
};
|
|
5111
5304
|
var FMPU_BOX_TYPES = /* @__PURE__ */ new Set(["ftyp", "moov", "moof"]);
|
|
5112
5305
|
function isFmp4Box(data) {
|
|
5113
5306
|
if (data.length < 8) return false;
|
|
@@ -5146,6 +5339,8 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5146
5339
|
this.#evictedTimingSamples = 0;
|
|
5147
5340
|
this.#rejectedMovieFragments = 0;
|
|
5148
5341
|
this.#sequencers = /* @__PURE__ */ new Map();
|
|
5342
|
+
this.#fecGate = null;
|
|
5343
|
+
this.#fecSequencer = null;
|
|
5149
5344
|
this.#reorderWindow = 0;
|
|
5150
5345
|
this.#reassemblyPolicy = null;
|
|
5151
5346
|
this.#frameCb = null;
|
|
@@ -5229,6 +5424,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5229
5424
|
maxSegmentsPerSample: maxSubsampleSegments
|
|
5230
5425
|
};
|
|
5231
5426
|
this.#defaultTrack = config?.defaultTrack ?? null;
|
|
5427
|
+
if (config?.fecReleaseGate) this.setFecReleaseGate(config.fecReleaseGate);
|
|
5232
5428
|
if (this.#defaultTrack) this.#validateReassemblyPolicy();
|
|
5233
5429
|
if (config?.tracks) {
|
|
5234
5430
|
for (const [id, info] of config.tracks) {
|
|
@@ -5250,6 +5446,8 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5250
5446
|
#evictedTimingSamples;
|
|
5251
5447
|
#rejectedMovieFragments;
|
|
5252
5448
|
#sequencers;
|
|
5449
|
+
#fecGate;
|
|
5450
|
+
#fecSequencer;
|
|
5253
5451
|
#reorderWindow;
|
|
5254
5452
|
#reassemblyPolicy;
|
|
5255
5453
|
#frameCb;
|
|
@@ -5367,10 +5565,63 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5367
5565
|
};
|
|
5368
5566
|
}
|
|
5369
5567
|
get reorderStats() {
|
|
5370
|
-
let bufferedFrames = 0;
|
|
5568
|
+
let bufferedFrames = this.#fecSequencer?.buffered ?? 0;
|
|
5371
5569
|
for (const { sequencer } of this.#sequencers.values()) bufferedFrames += sequencer.buffered;
|
|
5372
5570
|
return { ...this.#reorderStats, bufferedFrames };
|
|
5373
5571
|
}
|
|
5572
|
+
/**
|
|
5573
|
+
* Install (or remove) the in-order release policy for FEC-protected
|
|
5574
|
+
* streams. Streams the gate claims are released by block resolution; all
|
|
5575
|
+
* others keep the frame-count reorder window.
|
|
5576
|
+
*/
|
|
5577
|
+
setFecReleaseGate(gate) {
|
|
5578
|
+
this.#fecSequencer?.flush();
|
|
5579
|
+
this.#fecGate = gate;
|
|
5580
|
+
this.#fecSequencer = gate ? new FecReleaseSequencer(
|
|
5581
|
+
gate,
|
|
5582
|
+
(data, meta) => this.#emitFrame(data, meta),
|
|
5583
|
+
(stat, count = 1) => {
|
|
5584
|
+
this.#reorderStats[stat] += count;
|
|
5585
|
+
}
|
|
5586
|
+
) : null;
|
|
5587
|
+
}
|
|
5588
|
+
/** Re-evaluate held gaps after FEC block state changed. */
|
|
5589
|
+
pokeFecRelease(packetId, catalogTrackName) {
|
|
5590
|
+
if (!this.#fecSequencer) return;
|
|
5591
|
+
this.#fecSequencer.poke(
|
|
5592
|
+
packetId === void 0 ? void 0 : this.#streamKey(packetId, catalogTrackName)
|
|
5593
|
+
);
|
|
5594
|
+
}
|
|
5595
|
+
/**
|
|
5596
|
+
* The FEC source of a stream restarted: stall the next release. Marks
|
|
5597
|
+
* only; follow with `pokeFecRelease` to release frames held behind it.
|
|
5598
|
+
*/
|
|
5599
|
+
markFecDiscontinuity(packetId, catalogTrackName) {
|
|
5600
|
+
this.#fecSequencer?.markDiscontinuity(this.#streamKey(packetId, catalogTrackName));
|
|
5601
|
+
}
|
|
5602
|
+
/**
|
|
5603
|
+
* MPU and data-unit identity of one MMTP packet, parsed in place (no copy,
|
|
5604
|
+
* no reassembly). Null for non-MPU packets and packets that do not parse.
|
|
5605
|
+
* `header` is the packet's already-parsed MMTP header (parsePacket()), so
|
|
5606
|
+
* the header is not parsed a second time (BLO-36599).
|
|
5607
|
+
*/
|
|
5608
|
+
static sourcePacketIdentity(packet, header) {
|
|
5609
|
+
try {
|
|
5610
|
+
const extraction = extractMFUPayloadWithHeader(packet, header);
|
|
5611
|
+
if (!extraction) return null;
|
|
5612
|
+
const identity = {
|
|
5613
|
+
mpuSequenceNumber: extraction.mpu.mpuSequenceNumber
|
|
5614
|
+
};
|
|
5615
|
+
if (extraction.mfuDuHeader) {
|
|
5616
|
+
identity.sampleNumber = extraction.mfuDuHeader.sampleNumber;
|
|
5617
|
+
identity.movieFragmentSequenceNumber = extraction.mfuDuHeader.movieFragmentSequenceNumber;
|
|
5618
|
+
identity.offset = extraction.mfuDuHeader.offset;
|
|
5619
|
+
}
|
|
5620
|
+
return identity;
|
|
5621
|
+
} catch {
|
|
5622
|
+
return null;
|
|
5623
|
+
}
|
|
5624
|
+
}
|
|
5374
5625
|
/**
|
|
5375
5626
|
* Feed tallies for this parser. A fresh snapshot per call, not a live view,
|
|
5376
5627
|
* so a caller can hold one and compare it against a later read.
|
|
@@ -5629,7 +5880,8 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5629
5880
|
readyOnRegister,
|
|
5630
5881
|
info,
|
|
5631
5882
|
resolver,
|
|
5632
|
-
options?.recovered === true
|
|
5883
|
+
options?.recovered === true,
|
|
5884
|
+
options?.fecSbn
|
|
5633
5885
|
);
|
|
5634
5886
|
if (deferred.record === void 0) this.#countDeferredOutcome(deferred.reason);
|
|
5635
5887
|
}
|
|
@@ -5720,7 +5972,8 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5720
5972
|
combined,
|
|
5721
5973
|
info,
|
|
5722
5974
|
resolver,
|
|
5723
|
-
options?.recovered === true
|
|
5975
|
+
options?.recovered === true,
|
|
5976
|
+
options?.fecSbn
|
|
5724
5977
|
);
|
|
5725
5978
|
if (outcome.record !== void 0) return outcome.record;
|
|
5726
5979
|
return this.#drop(outcome.reason);
|
|
@@ -5740,7 +5993,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5740
5993
|
* attribution exists to keep readable. Leaving the choice at the call site
|
|
5741
5994
|
* is what keeps both true.
|
|
5742
5995
|
*/
|
|
5743
|
-
#emitCombinedSample(combined, info, resolver, recovered) {
|
|
5996
|
+
#emitCombinedSample(combined, info, resolver, recovered, fecSbn) {
|
|
5744
5997
|
const timing = resolver.sampleTiming(
|
|
5745
5998
|
combined.mpuSequenceNumber,
|
|
5746
5999
|
combined.movieFragmentSequenceNumber,
|
|
@@ -5756,6 +6009,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5756
6009
|
recovered
|
|
5757
6010
|
);
|
|
5758
6011
|
if (!meta) return { reason: "combined-meta-build-failed" };
|
|
6012
|
+
if (fecSbn !== void 0) meta.fecSbn = fecSbn;
|
|
5759
6013
|
if (!resolver.consumeSample(
|
|
5760
6014
|
combined.mpuSequenceNumber,
|
|
5761
6015
|
combined.movieFragmentSequenceNumber,
|
|
@@ -5809,6 +6063,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5809
6063
|
entry.sequencer.flush();
|
|
5810
6064
|
this.#sequencers.delete(key);
|
|
5811
6065
|
}
|
|
6066
|
+
this.#fecSequencer?.flushPacket(packetId);
|
|
5812
6067
|
for (const [key, state] of this.#timingStreams) {
|
|
5813
6068
|
if (state.packetId === packetId) this.#dropTimingStream(key);
|
|
5814
6069
|
}
|
|
@@ -5833,6 +6088,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5833
6088
|
this.#sequencers.delete(key);
|
|
5834
6089
|
}
|
|
5835
6090
|
const streamKey = this.#streamKey(packetId, catalogTrackName);
|
|
6091
|
+
this.#fecSequencer?.discardStream(streamKey);
|
|
5836
6092
|
this.#dropTimingStream(streamKey);
|
|
5837
6093
|
this.#reliableMoqStartupGate.delete(streamKey);
|
|
5838
6094
|
this.#reassembler.resetStream(catalogTrackName);
|
|
@@ -5865,6 +6121,15 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5865
6121
|
* with direct source frames before the decoder sees them. */
|
|
5866
6122
|
routeFrame(data, meta) {
|
|
5867
6123
|
const seq = meta.packetSequenceNumber;
|
|
6124
|
+
if (this.#fecSequencer && this.#fecGate?.gates(meta.packetId, meta.catalogTrackName)) {
|
|
6125
|
+
this.#fecSequencer.push(
|
|
6126
|
+
this.#streamKey(meta.packetId, meta.catalogTrackName),
|
|
6127
|
+
data,
|
|
6128
|
+
meta,
|
|
6129
|
+
seq !== void 0 && Number.isFinite(seq) ? seq : 0
|
|
6130
|
+
);
|
|
6131
|
+
return;
|
|
6132
|
+
}
|
|
5868
6133
|
const sequencer = this.#sequencerFor(meta.packetId, meta.trackType, meta.catalogTrackName);
|
|
5869
6134
|
if (sequencer && seq !== void 0 && Number.isFinite(seq)) {
|
|
5870
6135
|
sequencer.push(data, meta, seq);
|
|
@@ -5929,11 +6194,13 @@ var MmtpContainerParser = class _MmtpContainerParser {
|
|
|
5929
6194
|
flush() {
|
|
5930
6195
|
if (this.#disposed) return;
|
|
5931
6196
|
this.#flushSequencers();
|
|
6197
|
+
this.#fecSequencer?.flush();
|
|
5932
6198
|
}
|
|
5933
6199
|
dispose() {
|
|
5934
6200
|
this.#disposed = true;
|
|
5935
6201
|
for (const { sequencer } of this.#sequencers.values()) sequencer.discard();
|
|
5936
6202
|
this.#sequencers.clear();
|
|
6203
|
+
this.#fecSequencer?.discard();
|
|
5937
6204
|
this.#timingStreams.clear();
|
|
5938
6205
|
this.#pendingTimingSamples = 0;
|
|
5939
6206
|
this.#reliableMoqStartupGate.clear();
|