@blockcast/mmt-container 2.2.0-main.c3a95413582c → 2.2.0-main.da2e7cd1dd5d

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockcast/mmt-container",
3
- "version": "2.2.0-main.c3a95413582c",
3
+ "version": "2.2.0-main.da2e7cd1dd5d",
4
4
  "description": "MMTP/LOC container parsing for MMT over MoQ and SSM",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -169,10 +169,10 @@
169
169
  "test:watch": "vitest"
170
170
  },
171
171
  "dependencies": {
172
- "@blockcast/fec-worker": "2.2.0-main.c3a95413582c",
173
- "@blockcast/mmt-base": "2.2.0-main.c3a95413582c",
174
- "@blockcast/mmt-fec": "2.2.0-main.c3a95413582c",
175
- "@blockcast/mmt-manifest-verify": "2.2.0-main.c3a95413582c",
172
+ "@blockcast/fec-worker": "2.2.0-main.da2e7cd1dd5d",
173
+ "@blockcast/mmt-base": "2.2.0-main.da2e7cd1dd5d",
174
+ "@blockcast/mmt-fec": "2.2.0-main.da2e7cd1dd5d",
175
+ "@blockcast/mmt-manifest-verify": "2.2.0-main.da2e7cd1dd5d",
176
176
  "@noble/curves": "^1.9.7",
177
177
  "@noble/hashes": "^1.8.0",
178
178
  "ajv": "^8.17.1",
@@ -644,6 +644,10 @@ export class FECManager {
644
644
  // ── Keyframe-protected repair policy (block-policy.ts) ──
645
645
  // One classifier per physical stream, built from that stream's geometry.
646
646
  #classifiers = new Map<string, BlockClassifier>()
647
+ // A stream without catalog timing has no classifier, so the last RAP it
648
+ // released stands in for one: "an MPU boundary bounds its RAPs" holds until
649
+ // a second RAP is released inside one MPU (BLO-52085).
650
+ #noSpanRaps = new Map<string, { mpu: number; presentationTime: bigint; inside: boolean }>()
647
651
  // Geometry a stream-scoped configuration gave one stream (streamKey). ABR
648
652
  // rungs can share a packetId with a different framerate or GOP, so the
649
653
  // packet-level geometry is only the geometry of a packet whose streams
@@ -1706,6 +1710,7 @@ export class FECManager {
1706
1710
  // The classifier compares authored order with SBN order only within
1707
1711
  // one continuous SBN sequence.
1708
1712
  this.#classifiers.get(streamKey)?.noteSourceDiscontinuity()
1713
+ this.#noSpanRaps.delete(streamKey)
1709
1714
  this.#highestSbn.set(streamKey, { sbn, atMs: now })
1710
1715
  this.#sourceFrontiers.set(streamKey, { sbn, atMs: now })
1711
1716
  if (psn === undefined) this.#sourceAnchors.delete(streamKey)
@@ -2289,6 +2294,9 @@ export class FECManager {
2289
2294
  // sibling's change, but the first stream-scoped geometry on a packet
2290
2295
  // does change the siblings that have none (stream-geometry-absent).
2291
2296
  this.#bumpEpoch(packetId)
2297
+ for (const key of [...this.#noSpanRaps.keys()]) {
2298
+ if (this.#belongsToPacket(key, packetId)) this.#noSpanRaps.delete(key)
2299
+ }
2292
2300
  for (const [key, classifier] of [...this.#classifiers]) {
2293
2301
  if (!this.#belongsToPacket(key, packetId)) continue
2294
2302
  const stream = this.#parseStreamKey(key)
@@ -2565,6 +2573,7 @@ export class FECManager {
2565
2573
  resetMap(this.#isoLocators)
2566
2574
  resetMap(this.#sourceAnchors)
2567
2575
  this.#classifiers.delete(this.#streamKey(packetId, catalogTrackName))
2576
+ this.#noSpanRaps.delete(this.#streamKey(packetId, catalogTrackName))
2568
2577
  this.#bumpEpoch(packetId)
2569
2578
  for (const [sbn, keys] of this.#blockKeysBySbn) {
2570
2579
  for (const key of keys.keys()) {
@@ -2679,6 +2688,7 @@ export class FECManager {
2679
2688
  dropMap(this.#isoLocators)
2680
2689
  dropMap(this.#sourceAnchors)
2681
2690
  dropMap(this.#classifiers)
2691
+ dropMap(this.#noSpanRaps)
2682
2692
  dropMap(this.#streamGeometries)
2683
2693
  dropSet(this.#pendingWorkerCleanups)
2684
2694
  dropSet(this.#completedBlocks)
@@ -3470,11 +3480,14 @@ export class FECManager {
3470
3480
  /**
3471
3481
  * Whether an MPU boundary still bounds this stream's RAPs (see
3472
3482
  * `BlockClassifier.mpuBoundsRaps`). Gap decisions drop MPU evidence once
3473
- * it does not. A stream with no classifier yet has shown nothing against it.
3483
+ * it does not. A stream with no classifier yet has shown nothing against it,
3484
+ * and neither has a stream without catalog timing until it releases two
3485
+ * RAPs inside one MPU.
3474
3486
  */
3475
3487
  mpuBoundsRapsFor(packetId: number, catalogTrackName?: string): boolean {
3476
- if (!this.#hasCatalogTimingForPacket(packetId)) return false
3477
- return this.#classifiers.get(this.#streamKey(packetId, catalogTrackName))?.mpuBoundsRaps ?? true
3488
+ const streamKey = this.#streamKey(packetId, catalogTrackName)
3489
+ if (!this.#hasCatalogTimingForPacket(packetId)) return this.#noSpanRaps.get(streamKey)?.inside !== true
3490
+ return this.#classifiers.get(streamKey)?.mpuBoundsRaps ?? true
3478
3491
  }
3479
3492
 
3480
3493
  /** A block's class now, or frozen at its resolution. */
@@ -3510,7 +3523,15 @@ export class FECManager {
3510
3523
  presentationTime: bigint,
3511
3524
  mediaTimescale: number,
3512
3525
  ): void {
3513
- if (!this.#trackConfigs.has(packetId) || !this.#hasCatalogTimingForPacket(packetId)) return
3526
+ if (!this.#trackConfigs.has(packetId)) return
3527
+ if (!this.#hasCatalogTimingForPacket(packetId)) {
3528
+ const streamKey = this.#streamKey(packetId, catalogTrackName)
3529
+ const last = this.#noSpanRaps.get(streamKey)
3530
+ const inside = last?.inside === true ||
3531
+ (last?.mpu === mpu && last.presentationTime !== presentationTime)
3532
+ this.#noSpanRaps.set(streamKey, { mpu, presentationTime, inside })
3533
+ return
3534
+ }
3514
3535
  this.#applyClassifierChanges(
3515
3536
  packetId,
3516
3537
  catalogTrackName,
@@ -4883,6 +4904,7 @@ export class FECManager {
4883
4904
  this.#blockAnchorsMs.clear()
4884
4905
  this.#blockCatalogTrackNames.clear()
4885
4906
  this.#classifiers.clear()
4907
+ this.#noSpanRaps.clear()
4886
4908
  this.#streamGeometries.clear()
4887
4909
  this.#failedBlocks.clear()
4888
4910
  this.#resolvedBlockClasses.clear()
@@ -2146,6 +2146,18 @@ export class MmtpContainerParser {
2146
2146
  this.#emitFrame(data, meta)
2147
2147
  }
2148
2148
 
2149
+ /** Whether FT=1 metadata already names this sample, without claiming it. */
2150
+ hasAuthoredTimingFor(
2151
+ packetId: number,
2152
+ mpuSequenceNumber: number,
2153
+ movieFragmentSequenceNumber: number,
2154
+ sampleNumber: number,
2155
+ catalogTrackName?: string,
2156
+ ): boolean {
2157
+ return this.#timingResolver(this.#streamKey(packetId, catalogTrackName), packetId, false)
2158
+ ?.sampleTiming(mpuSequenceNumber, movieFragmentSequenceNumber, sampleNumber) != null
2159
+ }
2160
+
2149
2161
  /**
2150
2162
  * Claim and return the authored timing for a recovered sample. Recovery does
2151
2163
  * not pass through the ordinary `feed()` completion path, so it must retire
@@ -5206,6 +5206,27 @@ export class MmtpRouter {
5206
5206
  );
5207
5207
  }
5208
5208
 
5209
+ // A recovered head whose sample FT=1 has not named yet (an overlay that
5210
+ // outran the source path) would complete its data unit untimed: the unit
5211
+ // is dropped, marked completed, and the timed source copy is then refused
5212
+ // (BLO-53342). Leave it out; its recovered continuations park and complete
5213
+ // with the source head. A head that is truly lost ends as it did before.
5214
+ result = {
5215
+ ...result,
5216
+ symbols: result.symbols.filter((sym) =>
5217
+ sym.fragmentType !== 2 ||
5218
+ sym.fragment.fragmentationIndicator !== 1 ||
5219
+ sym.fragment.movieFragmentSequenceNumber === undefined ||
5220
+ sym.fragment.sampleNumber === undefined ||
5221
+ this.#parser.hasAuthoredTimingFor(
5222
+ ownerPacketId,
5223
+ sym.fragment.mpuSequenceNumber,
5224
+ sym.fragment.movieFragmentSequenceNumber,
5225
+ sym.fragment.sampleNumber,
5226
+ catalogTrackName,
5227
+ )),
5228
+ };
5229
+
5209
5230
  // MSE assembler path: route recovered block as pre-assembled frames (skip FT=0)
5210
5231
  // BLO-3035 layer 3: recovered symbols are RAW MFU fragments, not complete
5211
5232
  // frames. A keyframe can span multiple packets (FI=1/2/3); pushing each