@blockcast/mmt-container 0.5.0-main.ed11aec88d91 → 0.5.0

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 (43) hide show
  1. package/dist/browser-runtime.js +150 -21
  2. package/dist/browser-runtime.js.map +2 -2
  3. package/dist/fec-manager.d.ts.map +1 -1
  4. package/dist/fec-manager.js.map +2 -2
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js.map +2 -2
  8. package/dist/mmtp-container-parser.d.ts +10 -0
  9. package/dist/mmtp-container-parser.d.ts.map +1 -1
  10. package/dist/mmtp-container-parser.js +31 -1
  11. package/dist/mmtp-container-parser.js.map +2 -2
  12. package/dist/mmtp-container-parser.no-modules.js +31 -1
  13. package/dist/mmtp-container-parser.no-modules.js.map +2 -2
  14. package/dist/mmtp-decode-pipeline.js +31 -1
  15. package/dist/mmtp-decode-pipeline.js.map +2 -2
  16. package/dist/mmtp-router.d.ts +11 -0
  17. package/dist/mmtp-router.d.ts.map +1 -1
  18. package/dist/mmtp-router.js +54 -1
  19. package/dist/mmtp-router.js.map +2 -2
  20. package/dist/multicast-manager.d.ts +25 -1
  21. package/dist/multicast-manager.d.ts.map +1 -1
  22. package/dist/multicast-manager.js +92 -2
  23. package/dist/multicast-manager.js.map +2 -2
  24. package/dist/no-modules.js +31 -1
  25. package/dist/no-modules.js.map +2 -2
  26. package/dist/repair-fetch.d.ts +41 -10
  27. package/dist/repair-fetch.d.ts.map +1 -1
  28. package/dist/repair-fetch.js +58 -19
  29. package/dist/repair-fetch.js.map +2 -2
  30. package/dist/wasm-mmtp-container-parser.js +31 -1
  31. package/dist/wasm-mmtp-container-parser.js.map +2 -2
  32. package/package.json +7 -6
  33. package/src/fec-manager.ts +3 -0
  34. package/src/index.ts +1 -0
  35. package/src/mmtp-container-parser.ts +48 -0
  36. package/src/mmtp-router.ts +27 -0
  37. package/src/multicast-manager.ts +68 -0
  38. package/src/repair-fetch.ts +131 -31
  39. package/test-vectors/catalog/negative/multicast-auth-padded-key.json +0 -1
  40. package/test-vectors/catalog/negative/multicast-auth-reused-track-format.json +0 -1
  41. package/test-vectors/catalog/negative/multicast-auth-root-dotted-key.json +0 -1
  42. package/test-vectors/catalog/negative/multicast-auth-trailing-pad-bits.json +0 -1
  43. package/test-vectors/repair-policy-v1.json +113 -0
@@ -5657,6 +5657,9 @@ var BlockcastMmt = (() => {
5657
5657
  if (!a || !b || a.mediaTimescale !== b.mediaTimescale) return false;
5658
5658
  return b.decodeTime > a.decodeTime + BigInt(a.durationTicks);
5659
5659
  }
5660
+ function ssIdAfter(a, b) {
5661
+ return (a - b | 0) > 0;
5662
+ }
5660
5663
  var _streams2, _gate, _emit2, _recordStat2, _deferDepth, _deferredStreams, _FecReleaseSequencer_instances, drainUnlessDeferred_fn, streamFor_fn2, drain_fn, release_fn;
5661
5664
  var FecReleaseSequencer = class {
5662
5665
  constructor(gate, emit, recordStat) {
@@ -5716,11 +5719,17 @@ var BlockcastMmt = (() => {
5716
5719
  stream.last = null;
5717
5720
  stream.lastSbn = void 0;
5718
5721
  stream.discontinuity = false;
5722
+ stream.rapSsId = void 0;
5719
5723
  }
5720
5724
  if (stream.last !== null && compareFrameOrder(frame, stream.last) <= 0) {
5721
5725
  __privateGet(this, _recordStat2).call(this, "droppedStale");
5722
5726
  return;
5723
5727
  }
5728
+ const ssId = meta.fecSbn;
5729
+ if (meta.trackType === "video" && ssId !== void 0 && __privateGet(this, _gate).isRap?.(data, meta) === true) {
5730
+ if (stream.rapSsId === void 0 || ssIdAfter(ssId, stream.rapSsId)) stream.rapSsId = ssId;
5731
+ __privateGet(this, _gate).onRap?.(stream.packetId, stream.catalogTrackName, ssId);
5732
+ }
5724
5733
  if (stream.last === null) {
5725
5734
  if (meta.trackType === "video" && !meta.keyframe) {
5726
5735
  __privateGet(this, _recordStat2).call(this, "droppedBeforeStartupKeyframe");
@@ -5756,6 +5765,22 @@ var BlockcastMmt = (() => {
5756
5765
  }
5757
5766
  return earliest;
5758
5767
  }
5768
+ /**
5769
+ * Whether a complete RAP above SS_ID `ssId` entered the gate of a stream of
5770
+ * `packetId` (draft-ramadan-moq-fec 11.4.2: repair of a block below it is
5771
+ * moot). Its SS_ID is the one its frame completed in; a frame's packets
5772
+ * hold consecutive SS_IDs in authored order, so a complete RAP with a
5773
+ * packet above `ssId` has every packet of it at or above the first SS_ID
5774
+ * any loss at or below `ssId` could have taken.
5775
+ */
5776
+ rapAbove(packetId, catalogTrackName, ssId) {
5777
+ for (const stream of __privateGet(this, _streams2).values()) {
5778
+ if (stream.packetId !== packetId) continue;
5779
+ if (catalogTrackName !== void 0 && stream.catalogTrackName !== catalogTrackName) continue;
5780
+ if (stream.rapSsId !== void 0 && ssIdAfter(stream.rapSsId, ssId)) return true;
5781
+ }
5782
+ return false;
5783
+ }
5759
5784
  /** Re-evaluate held gaps after FEC state changed. */
5760
5785
  poke(streamKey) {
5761
5786
  if (streamKey !== void 0) {
@@ -5858,7 +5883,8 @@ var BlockcastMmt = (() => {
5858
5883
  buf: [],
5859
5884
  last: null,
5860
5885
  lastSbn: void 0,
5861
- discontinuity: false
5886
+ discontinuity: false,
5887
+ rapSsId: void 0
5862
5888
  };
5863
5889
  __privateGet(this, _streams2).set(streamKey, stream);
5864
5890
  }
@@ -6135,6 +6161,10 @@ var BlockcastMmt = (() => {
6135
6161
  fecReleaseEarliestHeldAtMs(packetId, catalogTrackName) {
6136
6162
  return __privateGet(this, _fecSequencer)?.earliestHeldArrivalMs(packetId, catalogTrackName);
6137
6163
  }
6164
+ /** See FecReleaseSequencer.rapAbove; false when no stream is FEC-gated. */
6165
+ fecReleaseRapAbove(packetId, catalogTrackName, ssId) {
6166
+ return __privateGet(this, _fecSequencer)?.rapAbove(packetId, catalogTrackName, ssId) ?? false;
6167
+ }
6138
6168
  /** Re-evaluate held gaps after FEC block state changed. */
6139
6169
  pokeFecRelease(packetId, catalogTrackName) {
6140
6170
  if (!__privateGet(this, _fecSequencer)) return;