@blockcast/mmt-container 0.4.0-main.bb90ce9247fa → 0.4.0-main.bbd83cb48eff

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.
Files changed (89) hide show
  1. package/README.md +5 -3
  2. package/dist/browser-runtime.js +532 -333
  3. package/dist/browser-runtime.js.map +4 -4
  4. package/dist/carp-catalog.d.ts +5 -3
  5. package/dist/carp-catalog.d.ts.map +1 -1
  6. package/dist/carp-catalog.js +18 -5
  7. package/dist/carp-catalog.js.map +3 -3
  8. package/dist/catalog-fec-params.d.ts +5 -2
  9. package/dist/catalog-fec-params.d.ts.map +1 -1
  10. package/dist/catalog-fec-params.js +100 -36
  11. package/dist/catalog-fec-params.js.map +4 -4
  12. package/dist/catalog-network-source.js +3 -0
  13. package/dist/catalog-network-source.js.map +3 -3
  14. package/dist/delivery-catalog.js +84 -220
  15. package/dist/delivery-catalog.js.map +4 -4
  16. package/dist/fec-manager.d.ts +15 -0
  17. package/dist/fec-manager.d.ts.map +1 -1
  18. package/dist/fec-manager.js +99 -39
  19. package/dist/fec-manager.js.map +3 -3
  20. package/dist/fec-state.d.ts +3 -2
  21. package/dist/fec-state.d.ts.map +1 -1
  22. package/dist/fec-state.js +16 -9
  23. package/dist/fec-state.js.map +4 -4
  24. package/dist/fec-worker-setup.d.ts.map +1 -1
  25. package/dist/fec-worker-setup.js +13 -2
  26. package/dist/fec-worker-setup.js.map +3 -3
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +6 -0
  30. package/dist/index.js.map +2 -2
  31. package/dist/iso-block-locator.js +3 -0
  32. package/dist/iso-block-locator.js.map +3 -3
  33. package/dist/mfu-reassembler.js +24 -13
  34. package/dist/mfu-reassembler.js.map +3 -3
  35. package/dist/mmtp-container-parser.d.ts.map +1 -1
  36. package/dist/mmtp-container-parser.js +96 -22
  37. package/dist/mmtp-container-parser.js.map +3 -3
  38. package/dist/mmtp-container-parser.no-modules.js +124 -36
  39. package/dist/mmtp-container-parser.no-modules.js.map +4 -4
  40. package/dist/mmtp-decode-pipeline.js +96 -22
  41. package/dist/mmtp-decode-pipeline.js.map +3 -3
  42. package/dist/mmtp-router.d.ts +14 -4
  43. package/dist/mmtp-router.d.ts.map +1 -1
  44. package/dist/mmtp-router.js +139 -22
  45. package/dist/mmtp-router.js.map +3 -3
  46. package/dist/multicast-input.js +3 -0
  47. package/dist/multicast-input.js.map +3 -3
  48. package/dist/multicast-manager.d.ts +49 -0
  49. package/dist/multicast-manager.d.ts.map +1 -1
  50. package/dist/multicast-manager.js +437 -302
  51. package/dist/multicast-manager.js.map +4 -4
  52. package/dist/multicast-transport.d.ts +6 -2
  53. package/dist/multicast-transport.d.ts.map +1 -1
  54. package/dist/multicast-transport.js +93 -224
  55. package/dist/multicast-transport.js.map +4 -4
  56. package/dist/multicast-unwrap.js +24 -13
  57. package/dist/multicast-unwrap.js.map +3 -3
  58. package/dist/no-modules.js +123 -35
  59. package/dist/no-modules.js.map +4 -4
  60. package/dist/repair-fetch.js +3 -0
  61. package/dist/repair-fetch.js.map +3 -3
  62. package/dist/repair-layers.js +3 -0
  63. package/dist/repair-layers.js.map +3 -3
  64. package/dist/sample-combiner.d.ts +7 -1
  65. package/dist/sample-combiner.d.ts.map +1 -1
  66. package/dist/sample-combiner.js +14 -2
  67. package/dist/sample-combiner.js.map +2 -2
  68. package/dist/signaling.js +3 -0
  69. package/dist/signaling.js.map +3 -3
  70. package/dist/timestamp-codec.js +24 -13
  71. package/dist/timestamp-codec.js.map +3 -3
  72. package/dist/wasm-mfu-reassembler.js +3 -0
  73. package/dist/wasm-mfu-reassembler.js.map +3 -3
  74. package/dist/wasm-mmtp-container-parser.js +96 -22
  75. package/dist/wasm-mmtp-container-parser.js.map +3 -3
  76. package/package.json +5 -5
  77. package/src/carp-catalog.ts +33 -10
  78. package/src/catalog-fec-params.ts +38 -17
  79. package/src/fec-manager.ts +111 -49
  80. package/src/fec-state.ts +4 -9
  81. package/src/fec-worker-setup.ts +16 -1
  82. package/src/index.ts +5 -0
  83. package/src/mmtp-container-parser.ts +75 -7
  84. package/src/mmtp-router.ts +76 -5
  85. package/src/multicast-manager.ts +143 -7
  86. package/src/multicast-transport.ts +14 -3
  87. package/src/sample-combiner.ts +15 -2
  88. package/test-vectors/catalog/README.md +5 -1
  89. package/test-vectors/catalog-validation.json +95 -0
@@ -150,26 +150,30 @@ function isEmptyOrExactLegacyTrailer(payload, start, end) {
150
150
  const authLength = view2.getUint16(2, false);
151
151
  return start + LEGACY_TRAILER_HEADER_SIZE + authLength === end;
152
152
  }
153
- function resolveDeclaredTrailers(payload, declaredEnd, fecType, options) {
153
+ function resolveDeclaredTrailers(payload, declaredEnd, fecType, options, rapFlag = false) {
154
154
  if (declaredEnd > payload.length)
155
155
  return null;
156
156
  if (options?.skipFecId) {
157
- return isEmptyOrExactLegacyTrailer(payload, declaredEnd, payload.length) ? { hasFecId: false } : null;
157
+ return isEmptyOrExactLegacyTrailer(payload, declaredEnd, payload.length) ? { hasFecId: false, hasOverlayFecId: false } : null;
158
158
  }
159
+ const overlay = options?.overlayDeclared === true && rapFlag;
159
160
  if (fecType === 1) {
160
- const fecStart = payload.length - SOURCE_FEC_PAYLOAD_ID_SIZE;
161
+ const fecStart = payload.length - sourceFecTrailerSize(overlay);
161
162
  if (fecStart < declaredEnd || !isEmptyOrExactLegacyTrailer(payload, declaredEnd, fecStart)) {
162
163
  return null;
163
164
  }
164
- return { hasFecId: true };
165
+ return { hasFecId: true, hasOverlayFecId: overlay };
165
166
  }
166
- if (fecType !== 0)
167
+ if (fecType !== 0 || overlay)
167
168
  return null;
168
169
  if (isEmptyOrExactLegacyTrailer(payload, declaredEnd, payload.length)) {
169
- return { hasFecId: false };
170
+ return { hasFecId: false, hasOverlayFecId: false };
170
171
  }
171
172
  return null;
172
173
  }
174
+ function sourceFecTrailerSize(overlay) {
175
+ return overlay ? 2 * SOURCE_FEC_PAYLOAD_ID_SIZE : SOURCE_FEC_PAYLOAD_ID_SIZE;
176
+ }
173
177
  function planMfuExtraction(mmtpPacket, options, parsedHeader) {
174
178
  if (mmtpPacket.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE) {
175
179
  return {
@@ -222,15 +226,16 @@ function planMfuExtraction(mmtpPacket, options, parsedHeader) {
222
226
  if ("rejection" in layoutResult)
223
227
  return layoutResult;
224
228
  const { layout } = layoutResult;
225
- const trailerLayout = resolveDeclaredTrailers(payload, layout.dataEnd, header.fecType, options);
229
+ const trailerLayout = resolveDeclaredTrailers(payload, layout.dataEnd, header.fecType, options, header.rapFlag);
226
230
  if (!trailerLayout) {
227
231
  if (!options?.skipFecId && header.fecType === 1) {
228
232
  const observed = payload.length - layout.dataEnd;
229
- if (observed !== SOURCE_FEC_PAYLOAD_ID_SIZE) {
233
+ const expected = sourceFecTrailerSize(options?.overlayDeclared === true && header.rapFlag);
234
+ if (observed !== expected) {
230
235
  return {
231
236
  rejection: {
232
237
  gate: "source-fec-payload-id-width-mismatch",
233
- detail: `producer wrote a ${observed}-byte Source FEC Payload ID, ISO/IEC 23008-1 \xA7C.5.2 requires ${SOURCE_FEC_PAYLOAD_ID_SIZE} (payload=${payload.length}, declaredEnd=${layout.dataEnd})`
238
+ detail: `producer wrote a ${observed}-byte Source FEC Payload ID, ISO/IEC 23008-1 \xA7C.5.2 requires ${expected} (payload=${payload.length}, declaredEnd=${layout.dataEnd})`
234
239
  }
235
240
  };
236
241
  }
@@ -257,10 +262,13 @@ function extractPlannedMfu(mmtpPacket, result) {
257
262
  const mfuDuHeader = mfuDuHeaderPresent && mpu.timedFlag === 1 ? parseTimedMfuDuHeader(payload, MPU_HEADER_SIZE) : null;
258
263
  const itemId = mfuDuHeaderPresent && mpu.timedFlag === 0 ? new DataView(payload.buffer, payload.byteOffset + MPU_HEADER_SIZE, 4).getUint32(0, false) : null;
259
264
  const data = payload.subarray(mfuOffset, dataEnd);
260
- const fecPayloadId = trailerLayout.hasFecId ? {
261
- ssId: new DataView(mmtpPacket.buffer, mmtpPacket.byteOffset + mmtpPacket.length - SOURCE_FEC_PAYLOAD_ID_SIZE, SOURCE_FEC_PAYLOAD_ID_SIZE).getUint32(0, false)
262
- } : null;
263
- return { header, mpu, fragmentType, data, mfuDuHeader, itemId, fecPayloadId };
265
+ const trailerStart = mmtpPacket.length - sourceFecTrailerSize(trailerLayout.hasOverlayFecId);
266
+ const ssIdAt = (offset) => ({
267
+ ssId: new DataView(mmtpPacket.buffer, mmtpPacket.byteOffset + offset, 4).getUint32(0, false)
268
+ });
269
+ const fecPayloadId = trailerLayout.hasFecId ? ssIdAt(trailerStart) : null;
270
+ const overlayFecPayloadId = trailerLayout.hasOverlayFecId ? ssIdAt(trailerStart + SOURCE_FEC_PAYLOAD_ID_SIZE) : null;
271
+ return { header, mpu, fragmentType, data, mfuDuHeader, itemId, fecPayloadId, overlayFecPayloadId };
264
272
  }
265
273
  function sourceFecPayloadIdOf(mmtpPacket, header) {
266
274
  if (mmtpPacket.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE)
@@ -303,6 +311,19 @@ function parseFecBlockProfile(value, where) {
303
311
  throw new Error(`${where} must be "iso-ssbg1-v1" (got ${JSON.stringify(value)})`);
304
312
  }
305
313
 
314
+ // ../mmt-base/dist/catalog-fec-source.js
315
+ var ALL_ROLES = Object.freeze(["video", "audio"]);
316
+ function recordOf(value) {
317
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
318
+ }
319
+ function isoBlockSpanUsable(fec) {
320
+ const block = recordOf(fec);
321
+ if (block === void 0 || block["blockProfile"] !== "iso-ssbg1-v1")
322
+ return true;
323
+ const ms = block["interleaveDepthMs"];
324
+ return ms === void 0 || typeof ms === "number" && Number.isSafeInteger(ms) && ms >= 0;
325
+ }
326
+
306
327
  // src/mfu-reassembler.ts
307
328
  function fragmentProvenance(fragment) {
308
329
  if (fragment.deliveryProvenance !== void 0) return fragment.deliveryProvenance;
@@ -3148,8 +3169,14 @@ var SampleCombiner = class {
3148
3169
  /**
3149
3170
  * Add one reassembled data unit. Returns the combined sample once every
3150
3171
  * constituent data unit has arrived and totals the authored size.
3172
+ *
3173
+ * `sampleSize` is the authored size the host resolves for the sample as the
3174
+ * data unit completes. It stands in only when no size was registered, which
3175
+ * happens when the data unit's FI=0/FI=1 reached the reassembler without the
3176
+ * host's own FT=2 parse: an FEC-recovered first fragment completed by source
3177
+ * fragments, or one decoded before its source copy arrived.
3151
3178
  */
3152
- addMfu(mfu) {
3179
+ addMfu(mfu, sampleSize) {
3153
3180
  if (mfu.movieFragmentSequenceNumber === void 0 || mfu.sampleNumber === void 0) {
3154
3181
  this.#stats.passthroughSamples++;
3155
3182
  return fromPassthrough(mfu);
@@ -3165,7 +3192,7 @@ var SampleCombiner = class {
3165
3192
  return null;
3166
3193
  }
3167
3194
  const dataLen = mfu.data.byteLength;
3168
- const authoredSize = this.#authoredSizes.get(key);
3195
+ const authoredSize = this.#authoredSizes.get(key) ?? sampleSize;
3169
3196
  if (offset === 0 && !this.#pending.has(key)) {
3170
3197
  const passesThrough = authoredSize === void 0 ? !this.#requireAuthoredSize : dataLen === authoredSize;
3171
3198
  if (passesThrough) {
@@ -3459,6 +3486,12 @@ if (void 0) {
3459
3486
  const out = c.addMfu(mfu(1, 9, 17, 5, [6, 7, 8, 9, 10], 1001n, false));
3460
3487
  expect(out?.data).toEqual(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]));
3461
3488
  });
3489
+ test("a size handed with the data unit completes a sample no head registered", () => {
3490
+ const c = combiner({ requireAuthoredSize: true });
3491
+ const out = c.addMfu(mfu(1, 9, 17, 0, [1, 2, 3, 4, 5], 1000n, true), 5);
3492
+ expect(out?.data).toEqual(new Uint8Array([1, 2, 3, 4, 5]));
3493
+ expect(c.addMfu(mfu(1, 9, 17, 0, [1, 2, 3, 4, 5], 1000n, true), 5)).toBeNull();
3494
+ });
3462
3495
  test("duplicate offset is rejected", () => {
3463
3496
  const c = combiner();
3464
3497
  c.registerAuthoredSize(void 0, 1, 9, 17, 10);
@@ -5426,6 +5459,7 @@ function isFmp4Box(data) {
5426
5459
  const type = String.fromCharCode(data[4], data[5], data[6], data[7]);
5427
5460
  return FMPU_BOX_TYPES.has(type);
5428
5461
  }
5462
+ var MAX_AWAITING_TIMING_HEADS = 8;
5429
5463
  var MmtpContainerParser = class _MmtpContainerParser {
5430
5464
  constructor(config) {
5431
5465
  this.#tracks = /* @__PURE__ */ new Map();
@@ -5484,6 +5518,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
5484
5518
  * reordering into the parser. */
5485
5519
  this.#reliableMoqStartupGate = /* @__PURE__ */ new Map();
5486
5520
  this.#disposed = false;
5521
+ this.#replayingAwaitingTiming = false;
5487
5522
  this.#fedObjects = 0;
5488
5523
  this.#reassemblerFragmentsFed = 0;
5489
5524
  this.#reassemblerDataUnitsReturned = 0;
@@ -5576,6 +5611,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
5576
5611
  #reorderStats;
5577
5612
  #reliableMoqStartupGate;
5578
5613
  #disposed;
5614
+ #replayingAwaitingTiming;
5579
5615
  #fedObjects;
5580
5616
  #reassemblerFragmentsFed;
5581
5617
  #reassemblerDataUnitsReturned;
@@ -5825,7 +5861,8 @@ var MmtpContainerParser = class _MmtpContainerParser {
5825
5861
  * a single failure bucket. Returns null so call sites stay `return this.#drop(...)`.
5826
5862
  */
5827
5863
  #drop(reason) {
5828
- this.#countOutcome(`drop:${reason}`);
5864
+ if (this.#replayingAwaitingTiming) this.#countDeferredOutcome(reason);
5865
+ else this.#countOutcome(`drop:${reason}`);
5829
5866
  return null;
5830
5867
  }
5831
5868
  get reorderDiagnostics() {
@@ -5848,6 +5885,12 @@ var MmtpContainerParser = class _MmtpContainerParser {
5848
5885
  for (const combiner of this.#sampleCombiners.values()) {
5849
5886
  combiner.cleanupTimeouts(timeoutMs);
5850
5887
  }
5888
+ const now = Date.now();
5889
+ for (const { awaitingTiming } of this.#timingStreams.values()) {
5890
+ while (awaitingTiming.length > 0 && now - awaitingTiming[0].arrivedAt > timeoutMs) {
5891
+ awaitingTiming.shift();
5892
+ }
5893
+ }
5851
5894
  }
5852
5895
  /**
5853
5896
  * Phase 1 of two-phase parsing. Returns structured header info for FEC feeding.
@@ -5928,7 +5971,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
5928
5971
  byteLength: packet.byteLength
5929
5972
  };
5930
5973
  }
5931
- if (info.fecPayloadId !== null && this.#sourceSymbolCb) {
5974
+ if (info.fecPayloadId !== null && this.#sourceSymbolCb && !this.#replayingAwaitingTiming) {
5932
5975
  const rawSymbol = packet.subarray(0, packet.length - 4);
5933
5976
  try {
5934
5977
  this.#sourceSymbolCb(info.packetId, info.fecPayloadId.ssId, rawSymbol);
@@ -5976,6 +6019,7 @@ var MmtpContainerParser = class _MmtpContainerParser {
5976
6019
  }
5977
6020
  return this.#drop("fragment-timing-refused");
5978
6021
  }
6022
+ this.#replayAwaitingTiming(streamKey, resolver2);
5979
6023
  return {
5980
6024
  kind: "fragment",
5981
6025
  packet: info,
@@ -5999,7 +6043,18 @@ var MmtpContainerParser = class _MmtpContainerParser {
5999
6043
  mfuDuHeader.movieFragmentSequenceNumber,
6000
6044
  mfuDuHeader.sampleNumber
6001
6045
  );
6002
- if (!headTiming) return this.#drop("mfu-sample-timing-missing");
6046
+ if (!headTiming) {
6047
+ this.#awaitTiming(streamKey, {
6048
+ packet,
6049
+ options,
6050
+ parsed,
6051
+ mpuSequenceNumber: mpu.mpuSequenceNumber,
6052
+ movieFragmentSequenceNumber: mfuDuHeader.movieFragmentSequenceNumber,
6053
+ sampleNumber: mfuDuHeader.sampleNumber,
6054
+ arrivedAt: Date.now()
6055
+ });
6056
+ return this.#drop("mfu-sample-timing-missing");
6057
+ }
6003
6058
  const offset = mfuDuHeader.offset;
6004
6059
  if (!Number.isSafeInteger(offset) || offset < 0 || offset >= headTiming.size)
6005
6060
  return this.#drop("mfu-offset-out-of-range");
@@ -6075,16 +6130,17 @@ var MmtpContainerParser = class _MmtpContainerParser {
6075
6130
  const sampleNumber = assembled.sampleNumber;
6076
6131
  if (movieFragmentSequenceNumber === void 0 || sampleNumber === void 0)
6077
6132
  return this.#drop("assembled-identity-missing");
6078
- if (!resolver.sampleTiming(
6133
+ const assembledTiming = resolver.sampleTiming(
6079
6134
  assembled.mpuSequenceNumber,
6080
6135
  movieFragmentSequenceNumber,
6081
6136
  sampleNumber
6082
- )) return this.#drop("assembled-timing-missing");
6137
+ );
6138
+ if (!assembledTiming) return this.#drop("assembled-timing-missing");
6083
6139
  if (assembled.mpuSequenceNumber !== mpu.mpuSequenceNumber)
6084
6140
  return this.#drop("assembled-mpu-mismatch");
6085
6141
  let combined;
6086
6142
  try {
6087
- combined = this.#sampleCombinerFor(streamKey).addMfu(assembled);
6143
+ combined = this.#sampleCombinerFor(streamKey).addMfu(assembled, assembledTiming.size);
6088
6144
  } catch (error) {
6089
6145
  if (!(error instanceof SampleCombineError)) throw error;
6090
6146
  console.warn(
@@ -6393,9 +6449,37 @@ var MmtpContainerParser = class _MmtpContainerParser {
6393
6449
  if (existing) return existing.resolver;
6394
6450
  if (!create) return null;
6395
6451
  const resolver = new IsoBmffTimingResolver(this.#maxPendingTimingSamples);
6396
- this.#timingStreams.set(streamKey, { packetId, resolver });
6452
+ this.#timingStreams.set(streamKey, { packetId, resolver, awaitingTiming: [] });
6397
6453
  return resolver;
6398
6454
  }
6455
+ #awaitTiming(streamKey, head) {
6456
+ const awaitingTiming = this.#timingStreams.get(streamKey)?.awaitingTiming;
6457
+ if (!awaitingTiming) return;
6458
+ awaitingTiming.push(head);
6459
+ if (awaitingTiming.length > MAX_AWAITING_TIMING_HEADS) awaitingTiming.shift();
6460
+ }
6461
+ /**
6462
+ * Feed again the heads whose timing the FT=1 just admitted declares. That
6463
+ * FT=1 can be an FEC recovery landing after its sample's FI=1, and neither
6464
+ * FEC path routes a source symbol that already arrived a second time.
6465
+ */
6466
+ #replayAwaitingTiming(streamKey, resolver) {
6467
+ const state = this.#timingStreams.get(streamKey);
6468
+ if (!state || state.awaitingTiming.length === 0) return;
6469
+ const ready = state.awaitingTiming.filter((head) => resolver.sampleTiming(
6470
+ head.mpuSequenceNumber,
6471
+ head.movieFragmentSequenceNumber,
6472
+ head.sampleNumber
6473
+ ));
6474
+ if (ready.length === 0) return;
6475
+ state.awaitingTiming = state.awaitingTiming.filter((head) => !ready.includes(head));
6476
+ this.#replayingAwaitingTiming = true;
6477
+ try {
6478
+ for (const head of ready) this.#feed(head.packet, head.options, head.parsed);
6479
+ } finally {
6480
+ this.#replayingAwaitingTiming = false;
6481
+ }
6482
+ }
6399
6483
  #dropTimingStream(streamKey) {
6400
6484
  const state = this.#timingStreams.get(streamKey);
6401
6485
  if (!state) return;
@@ -7642,11 +7726,21 @@ function validateCmsfMmtpCatalog(value) {
7642
7726
  const timescale = BigInt(track["timescale"]);
7643
7727
  const durationTicks = track["groupDurationTicks"];
7644
7728
  const ticks = durationTicks !== void 0 ? BigInt(durationTicks) : BigInt(track["groupDurationMs"]) * timescale / 1000n;
7645
- const anchor = switchingSets.get(altGroup);
7646
- if (anchor && ticks * anchor.timescale !== anchor.ticks * timescale) {
7647
- catalogError("track_switching_set", `$.tracks[${index}]`, `group duration does not match ${JSON.stringify(anchor.name)} in altGroup ${altGroup}`);
7729
+ const framerate = track["framerate"];
7730
+ const intraOnly = positiveNumber(framerate) && Math.abs(Number(ticks) * framerate - Number(timescale)) <= Number(timescale) * 1e-3;
7731
+ const members = switchingSets.get(altGroup) ?? [];
7732
+ members.push({ index, name: track["name"], ticks, timescale, intraOnly });
7733
+ switchingSets.set(altGroup, members);
7734
+ }
7735
+ for (const [altGroup, members] of switchingSets) {
7736
+ const anchor = members.find((member) => !member.intraOnly) ?? members[0];
7737
+ for (const member of members) {
7738
+ if (member === anchor || member.ticks * anchor.timescale === anchor.ticks * member.timescale) continue;
7739
+ const nests = member.intraOnly && !anchor.intraOnly && anchor.ticks * member.timescale % (member.ticks * anchor.timescale) === 0n;
7740
+ if (!nests) {
7741
+ catalogError("track_switching_set", `$.tracks[${member.index}]`, `group duration does not match ${JSON.stringify(anchor.name)} in altGroup ${altGroup}`);
7742
+ }
7648
7743
  }
7649
- if (!anchor) switchingSets.set(altGroup, { name: track["name"], ticks, timescale });
7650
7744
  }
7651
7745
  const multicast = catalog["multicast"];
7652
7746
  if (typeof multicast === "object" && multicast !== null && !Array.isArray(multicast)) {
@@ -7722,23 +7816,17 @@ var INACTIVE = Object.freeze({
7722
7816
  "reliable-moq": Object.freeze({ state: "inactive", reason: "reliable-moq" }),
7723
7817
  "no-multicast-bridge": Object.freeze({ state: "inactive", reason: "no-multicast-bridge" })
7724
7818
  });
7725
- function recordOf(value) {
7819
+ function recordOf2(value) {
7726
7820
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
7727
7821
  }
7728
7822
  function isPositiveSafeInteger(value) {
7729
7823
  return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
7730
7824
  }
7731
7825
  function catalogDeclaresFec(fec) {
7732
- const block = recordOf(fec);
7826
+ const block = recordOf2(fec);
7733
7827
  if (block === void 0 || block["algorithm"] === "none") return false;
7734
7828
  return isPositiveSafeInteger(block["sourceSymbols"]) && isPositiveSafeInteger(block["symbolSize"]) && isFecBlockProfile(block["blockProfile"]) && isoBlockSpanUsable(block);
7735
7829
  }
7736
- function isoBlockSpanUsable(fec) {
7737
- const block = recordOf(fec);
7738
- if (block === void 0 || block["blockProfile"] !== "iso-ssbg1-v1") return true;
7739
- const ms = block["interleaveDepthMs"];
7740
- return ms === void 0 || typeof ms === "number" && Number.isSafeInteger(ms) && ms >= 0;
7741
- }
7742
7830
  function requireBoolean(value, field) {
7743
7831
  if (typeof value !== "boolean") {
7744
7832
  throw new TypeError(`resolveFecState: ${field} must be a boolean, got ${typeof value}`);
@@ -7753,7 +7841,7 @@ function resolveFecState(evidence) {
7753
7841
  if (typeof transportPolicy !== "string" || !TRANSPORT_POLICIES.has(transportPolicy)) {
7754
7842
  throw new TypeError(`resolveFecState: unsupported transportPolicy ${JSON.stringify(transportPolicy)}`);
7755
7843
  }
7756
- if (stats !== null && stats !== void 0 && recordOf(stats) === void 0) {
7844
+ if (stats !== null && stats !== void 0 && recordOf2(stats) === void 0) {
7757
7845
  throw new TypeError("resolveFecState: stats must be a plain object, null or undefined");
7758
7846
  }
7759
7847
  if (!catalogFec) return INACTIVE["no-catalog-fec"];