@blockcast/mmt-container 0.1.0-main.f2d8d03d6809 → 0.1.0-main.fc44423f1ff9

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 (78) hide show
  1. package/dist/browser-runtime.js +73 -18
  2. package/dist/browser-runtime.js.map +2 -2
  3. package/dist/catalog-fec-params.d.ts +15 -0
  4. package/dist/catalog-fec-params.d.ts.map +1 -1
  5. package/dist/catalog-fec-params.js +11 -0
  6. package/dist/catalog-fec-params.js.map +2 -2
  7. package/dist/cmaf-block-assembler.js.map +1 -1
  8. package/dist/cmaf-group-batcher.js.map +1 -1
  9. package/dist/cmcd-producer.d.ts.map +1 -1
  10. package/dist/cmcd-producer.js.map +2 -2
  11. package/dist/fec-manager.d.ts +1 -1
  12. package/dist/fec-manager.d.ts.map +1 -1
  13. package/dist/fec-manager.js +1 -1
  14. package/dist/fec-manager.js.map +2 -2
  15. package/dist/fec-worker-setup.d.ts +8 -0
  16. package/dist/fec-worker-setup.d.ts.map +1 -1
  17. package/dist/fec-worker-setup.js +3 -1
  18. package/dist/fec-worker-setup.js.map +2 -2
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +2 -0
  22. package/dist/index.js.map +2 -2
  23. package/dist/manifest-auth-plan.js +29 -11
  24. package/dist/manifest-auth-plan.js.map +2 -2
  25. package/dist/media-router.js.map +2 -2
  26. package/dist/mmtp-container-parser.no-modules.js +44 -15
  27. package/dist/mmtp-container-parser.no-modules.js.map +2 -2
  28. package/dist/mmtp-router.d.ts.map +1 -1
  29. package/dist/mmtp-router.js +5 -1
  30. package/dist/mmtp-router.js.map +2 -2
  31. package/dist/mmtp-to-cmaf.d.ts +11 -2
  32. package/dist/mmtp-to-cmaf.d.ts.map +1 -1
  33. package/dist/mmtp-to-cmaf.js +15 -4
  34. package/dist/mmtp-to-cmaf.js.map +2 -2
  35. package/dist/multicast-manager.d.ts +12 -0
  36. package/dist/multicast-manager.d.ts.map +1 -1
  37. package/dist/multicast-manager.js +44 -13
  38. package/dist/multicast-manager.js.map +2 -2
  39. package/dist/multicast-transport.js +9 -5
  40. package/dist/multicast-transport.js.map +2 -2
  41. package/dist/no-modules.js +44 -15
  42. package/dist/no-modules.js.map +2 -2
  43. package/dist/source-auth.js +29 -11
  44. package/dist/source-auth.js.map +2 -2
  45. package/dist/track-session.d.ts +17 -1
  46. package/dist/track-session.d.ts.map +1 -1
  47. package/dist/track-session.js.map +2 -2
  48. package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.d.ts +1 -1
  49. package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.d.ts.map +1 -1
  50. package/node_modules/@blockcast/fec-worker/src/fec-worker-types.ts +1 -1
  51. package/node_modules/@blockcast/mmt-fec/dist/block-manager.d.ts +3 -1
  52. package/node_modules/@blockcast/mmt-fec/dist/block-manager.d.ts.map +1 -1
  53. package/node_modules/@blockcast/mmt-fec/dist/block-manager.js +3 -1
  54. package/node_modules/@blockcast/mmt-fec/dist/block-manager.js.map +1 -1
  55. package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.d.ts +2 -2
  56. package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.js +2 -2
  57. package/node_modules/@blockcast/mmt-fec/dist/oti.d.ts +5 -7
  58. package/node_modules/@blockcast/mmt-fec/dist/oti.d.ts.map +1 -1
  59. package/node_modules/@blockcast/mmt-fec/dist/oti.js +4 -6
  60. package/node_modules/@blockcast/mmt-fec/dist/oti.js.map +1 -1
  61. package/node_modules/@blockcast/mmt-fec/src/block-manager.ts +3 -1
  62. package/node_modules/@blockcast/mmt-fec/src/fec-block-mapper.ts +2 -2
  63. package/node_modules/@blockcast/mmt-fec/src/oti.ts +5 -7
  64. package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.d.ts +10 -1
  65. package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.d.ts.map +1 -1
  66. package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.js +40 -10
  67. package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.js.map +1 -1
  68. package/node_modules/@blockcast/mmt-manifest-verify/src/verifier.ts +41 -8
  69. package/package.json +6 -6
  70. package/src/catalog-fec-params.ts +28 -0
  71. package/src/cmcd-producer.ts +5 -0
  72. package/src/fec-manager.ts +1 -1
  73. package/src/fec-worker-setup.ts +11 -1
  74. package/src/index.ts +1 -0
  75. package/src/mmtp-router.ts +5 -1
  76. package/src/mmtp-to-cmaf.ts +24 -2
  77. package/src/multicast-manager.ts +74 -10
  78. package/src/track-session.ts +17 -1
@@ -7719,16 +7719,26 @@ var MmtpToCmaf = class {
7719
7719
  return __privateGet(this, _audioInitSegment);
7720
7720
  }
7721
7721
  /** Convert a raw video sample to an fMP4 moof+mdat segment. */
7722
- wrapVideoSample(data, timestamp, keyframe, duration) {
7723
- return this.wrapVideoSampleWithTiming(data, timestamp, keyframe, duration).segment;
7722
+ wrapVideoSample(data, timestamp, keyframe, duration, compositionTimeOffset) {
7723
+ return this.wrapVideoSampleWithTiming(data, timestamp, keyframe, duration, compositionTimeOffset).segment;
7724
7724
  }
7725
7725
  /**
7726
7726
  * Convert a raw video sample and return the exact browser media interval
7727
7727
  * encoded into tfdt/trun. Consumers that correlate SourceBuffer appends with
7728
7728
  * requestVideoFrameCallback must use this rebased timestamp, not the wire or
7729
7729
  * caller-owned timestamp passed above.
7730
+ *
7731
+ * `compositionTimeOffset` is the signed authored PTS-DTS delta, in the same
7732
+ * #videoTimescale units as `timestamp` and `duration` — unlike wrapAudioSample,
7733
+ * which takes microseconds and rescales, because every other quantity on this
7734
+ * path is already denominated in #videoTimescale (see setVideoTrackParams).
7735
+ * Passing it therefore needs no conversion here; rescaling would double-convert.
7736
+ * Absent leaves the trun at version 0 with no offset field; a declared 0 is an
7737
+ * authored value and still promotes to version 1. Never reconstruct it from
7738
+ * arrival time.
7730
7739
  */
7731
- wrapVideoSampleWithTiming(data, timestamp, keyframe, duration) {
7740
+ wrapVideoSampleWithTiming(data, timestamp, keyframe, duration, compositionTimeOffset) {
7741
+ assertCompositionTimeOffsets([{ compositionTimeOffset }]);
7732
7742
  if (duration !== void 0 && Number.isFinite(duration) && duration > 0) {
7733
7743
  __privateSet(this, _frameDuration, Math.round(duration));
7734
7744
  } else if (__privateGet(this, _lastVideoTimestamp) > 0 && timestamp > __privateGet(this, _lastVideoTimestamp)) {
@@ -7746,7 +7756,8 @@ var MmtpToCmaf = class {
7746
7756
  frameDuration,
7747
7757
  keyframe,
7748
7758
  __privateWrapper(this, _videoSeq)._++,
7749
- __privateGet(this, _videoTrackId)
7759
+ __privateGet(this, _videoTrackId),
7760
+ compositionTimeOffset
7750
7761
  ),
7751
7762
  mediaTimestamp: relTs,
7752
7763
  duration: frameDuration
@@ -10017,7 +10028,7 @@ var FECManager = class {
10017
10028
  symbolSizeForPacket(packetId) {
10018
10029
  return __privateMethod(this, _FECManager_instances, resolveTrackConfig_fn).call(this, packetId).symbolSize;
10019
10030
  }
10020
- /** FEC interleave window in milliseconds (0 = no interleaving). */
10031
+ /** FEC block span in milliseconds (0 = no interleaving). */
10021
10032
  get interleaveDepthMs() {
10022
10033
  return __privateGet(this, _fecInterleaveDepthMs);
10023
10034
  }
@@ -14452,7 +14463,11 @@ admitRecoveredResult_fn = function(blockId, result, ownerPacketId, catalogTrackN
14452
14463
  __privateMethod(this, _MmtpRouter_instances, routeProcessedFecSymbols_fn).call(this, blockId, { ...result, symbols: [symbol] }, ownerPacketId, catalogTrackName);
14453
14464
  }
14454
14465
  admitNext(index + 1);
14455
- }
14466
+ },
14467
+ // A stalled symbol that is later discarded instead of played must still
14468
+ // advance this loop; enforce mode never calls the release callback for
14469
+ // it (BLO-30095).
14470
+ () => admitNext(index + 1)
14456
14471
  );
14457
14472
  if (admission.action === "drop") admitNext(index + 1);
14458
14473
  };
@@ -15225,12 +15240,16 @@ var driadDiscovery = new DRIADDiscovery();
15225
15240
  function endpointKey(endpoint) {
15226
15241
  return `${endpoint.sourceAddress ?? ""}|${endpoint.groupAddress}|${endpoint.port}`;
15227
15242
  }
15243
+ function carriesMedia(endpoint) {
15244
+ return endpoint.carriesMedia !== false;
15245
+ }
15228
15246
  function selectMulticastTier(endpoints, estimate) {
15229
- if (endpoints.length <= 1)
15230
- return endpoints[0];
15231
- const ranked = endpoints.filter((endpoint) => typeof endpoint.bandwidth === "number" && endpoint.bandwidth > 0).sort((a, b) => a.bandwidth - b.bandwidth);
15247
+ const media = endpoints.filter(carriesMedia);
15248
+ if (media.length <= 1)
15249
+ return media[0];
15250
+ const ranked = media.filter((endpoint) => typeof endpoint.bandwidth === "number" && endpoint.bandwidth > 0).sort((a, b) => a.bandwidth - b.bandwidth);
15232
15251
  if (ranked.length < 2)
15233
- return endpoints[0];
15252
+ return media[0];
15234
15253
  if (estimate === void 0)
15235
15254
  return ranked[0];
15236
15255
  const budget = estimate * 0.8;
@@ -15479,7 +15498,7 @@ var MulticastOrchestrator = class {
15479
15498
  const currentBandwidth = __privateGet(this, _current).bandwidth;
15480
15499
  if (typeof currentBandwidth !== "number")
15481
15500
  return void 0;
15482
- const desired = this.options.endpoints.filter((endpoint) => typeof endpoint.bandwidth === "number" && endpoint.bandwidth > currentBandwidth).sort((a, b) => a.bandwidth - b.bandwidth)[0];
15501
+ const desired = this.options.endpoints.filter((endpoint) => carriesMedia(endpoint) && typeof endpoint.bandwidth === "number" && endpoint.bandwidth > currentBandwidth).sort((a, b) => a.bandwidth - b.bandwidth)[0];
15483
15502
  if (!desired) {
15484
15503
  __privateSet(this, _favored, void 0);
15485
15504
  return void 0;
@@ -16785,6 +16804,24 @@ function publishFecDiagnostics(packetId, stats) {
16785
16804
  function altGroupKey(track) {
16786
16805
  return track.altGroup === void 0 ? DEFAULT_ALT_GROUP : String(track.altGroup);
16787
16806
  }
16807
+ function repairTrackNamesBySource(tracks) {
16808
+ const bySource = /* @__PURE__ */ new Map();
16809
+ const add = (source, repair) => {
16810
+ if (!source || !repair) return;
16811
+ const names = bySource.get(source) ?? /* @__PURE__ */ new Set();
16812
+ names.add(repair);
16813
+ bySource.set(source, names);
16814
+ };
16815
+ for (const track of tracks) {
16816
+ if (track.fec !== void 0 && isFecCatalogConfig(track.fec) && track.fec.repairTrack) {
16817
+ add(track.name, track.fec.repairTrack);
16818
+ }
16819
+ if (track.packaging === "fec-repair" && Array.isArray(track.depends) && track.depends.length === 1) {
16820
+ add(track.depends[0], track.name);
16821
+ }
16822
+ }
16823
+ return bySource;
16824
+ }
16788
16825
  var _fec, _router, _transport, _reportedFecDiagnosticsFailure, _streamFecBaseline, _trackFecTiming, _switchingSets, _repairPacketIds, _repairInFlight, _repairLifecycleObservers, _trackResetObservers, _onRepairSubscribeCb, _MulticastManager_instances, configureTrackMapper_fn, applyStreamGlobalFecTiming_fn, _onTrackTypeDiscovered, emitRepairLifecycle_fn;
16789
16826
  var MulticastManager = class {
16790
16827
  constructor(options) {
@@ -17245,12 +17282,13 @@ var MulticastManager = class {
17245
17282
  * a factory returning a distinct decoder per stream.
17246
17283
  */
17247
17284
  configureMultiTrack(catalog, wasmDecoderSource) {
17285
+ const repairNamesBySource = repairTrackNamesBySource(catalog.tracks);
17248
17286
  const repairOwnerGroup = /* @__PURE__ */ new Map();
17249
17287
  const repairOwnerAltGroup = /* @__PURE__ */ new Map();
17250
17288
  for (const track of catalog.tracks) {
17251
- if (track.fec !== void 0 && isFecCatalogConfig(track.fec) && track.fec.repairTrack) {
17252
- repairOwnerGroup.set(track.fec.repairTrack, altGroupKey(track));
17253
- repairOwnerAltGroup.set(track.fec.repairTrack, track.altGroup);
17289
+ for (const repairName of repairNamesBySource.get(track.name) ?? []) {
17290
+ repairOwnerGroup.set(repairName, altGroupKey(track));
17291
+ repairOwnerAltGroup.set(repairName, track.altGroup);
17254
17292
  }
17255
17293
  }
17256
17294
  const groupKeyFor = (track) => repairOwnerGroup.get(track.name) ?? altGroupKey(track);
@@ -17353,9 +17391,13 @@ var MulticastManager = class {
17353
17391
  }
17354
17392
  if (track.fec !== void 0) {
17355
17393
  const fecCfg = track.fec;
17356
- const repairTrack = catalogTracksByName.get(fecCfg.repairTrack);
17357
- if (track.packetId !== void 0 && repairTrack?.packetId !== void 0) {
17358
- __privateGet(this, _router).setRepairPacketIdOwner(repairTrack.packetId, track.packetId);
17394
+ if (track.packetId !== void 0) {
17395
+ for (const repairName of repairNamesBySource.get(track.name) ?? []) {
17396
+ const repairTrack = catalogTracksByName.get(repairName);
17397
+ if (repairTrack?.packetId !== void 0) {
17398
+ __privateGet(this, _router).setRepairPacketIdOwner(repairTrack.packetId, track.packetId);
17399
+ }
17400
+ }
17359
17401
  }
17360
17402
  const wasmDecoder = fecDecoders.get(i);
17361
17403
  if (track.packetId !== void 0 && wasmDecoder !== void 0) {
@@ -17645,7 +17687,9 @@ async function setupFecWorkerForTrack(opts) {
17645
17687
  sampleRate: opts.sampleRate,
17646
17688
  algorithm: "raptor",
17647
17689
  k: opts.fecK,
17648
- repairCount: opts.fecRepairCount,
17690
+ // P as this receiver joined it, not the catalog total: the worker snapshot
17691
+ // and CMCD `x-bc-fec-p` are read from this. Identity on a single layer.
17692
+ repairCount: opts.joinedRepairCount ?? opts.fecRepairCount,
17649
17693
  symbolSize: opts.fecSymbolSize,
17650
17694
  interleaveDepth: interleaveDepthBlocks,
17651
17695
  interleaveMs: opts.fecInterleaveMs,
@@ -19507,6 +19551,16 @@ var NO_FEC = {
19507
19551
  fecSymbolSize: 0,
19508
19552
  fecInterleaveMs: 0
19509
19553
  };
19554
+ function joinedRepairSymbolCount(params, joinedRepairTrackNames) {
19555
+ const layers = params.repairLayers;
19556
+ if (layers === void 0 || layers.length === 0) return params.fecRepairCount;
19557
+ const joined = new Set(joinedRepairTrackNames);
19558
+ let total = 0;
19559
+ for (const layer of layers) {
19560
+ if (joined.has(layer.repairTrackName)) total += layer.repairSymbols;
19561
+ }
19562
+ return total;
19563
+ }
19510
19564
  function recordOf(value) {
19511
19565
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
19512
19566
  }
@@ -19936,6 +19990,7 @@ export {
19936
19990
  isSignalingPacket,
19937
19991
  isSourcePacket,
19938
19992
  isTrackTimingConfig,
19993
+ joinedRepairSymbolCount,
19939
19994
  mergeOverrideIntoCmsfTracks,
19940
19995
  mergeOverrideIntoHangRenditions,
19941
19996
  mfuReassemblyTimeoutMs,