@blockcast/mmt-container 2.2.0-main.f480a7ede8b1 → 2.2.0-main.fde7aee36726

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 (137) hide show
  1. package/README.md +5 -2
  2. package/dist/block-policy.d.ts +88 -16
  3. package/dist/block-policy.d.ts.map +1 -1
  4. package/dist/block-policy.js +164 -56
  5. package/dist/block-policy.js.map +3 -3
  6. package/dist/browser-runtime.js +2163 -303
  7. package/dist/browser-runtime.js.map +4 -4
  8. package/dist/carp-catalog.d.ts +40 -1
  9. package/dist/carp-catalog.d.ts.map +1 -1
  10. package/dist/carp-catalog.js +163 -10
  11. package/dist/carp-catalog.js.map +4 -4
  12. package/dist/catalog-fec-params.d.ts +1 -1
  13. package/dist/catalog-fec-params.d.ts.map +1 -1
  14. package/dist/catalog-fec-params.js +48 -1
  15. package/dist/catalog-fec-params.js.map +3 -3
  16. package/dist/catalog-network-source.js +34 -0
  17. package/dist/catalog-network-source.js.map +3 -3
  18. package/dist/cmaf-block-assembler.js +92 -1
  19. package/dist/cmaf-block-assembler.js.map +2 -2
  20. package/dist/codec-utils.d.ts.map +1 -1
  21. package/dist/codec-utils.js +92 -1
  22. package/dist/codec-utils.js.map +2 -2
  23. package/dist/delivery-catalog.js +68 -0
  24. package/dist/delivery-catalog.js.map +4 -4
  25. package/dist/delta-fallback-config.js +39 -1
  26. package/dist/delta-fallback-config.js.map +4 -4
  27. package/dist/fec-manager.d.ts +222 -21
  28. package/dist/fec-manager.d.ts.map +1 -1
  29. package/dist/fec-manager.js +875 -131
  30. package/dist/fec-manager.js.map +4 -4
  31. package/dist/fec-state.d.ts +17 -5
  32. package/dist/fec-state.d.ts.map +1 -1
  33. package/dist/fec-state.js +41 -1
  34. package/dist/fec-state.js.map +3 -3
  35. package/dist/fec-worker-setup.js +34 -0
  36. package/dist/fec-worker-setup.js.map +3 -3
  37. package/dist/held-layer-admission.js +34 -0
  38. package/dist/held-layer-admission.js.map +3 -3
  39. package/dist/index.d.ts +6 -5
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +9 -1
  42. package/dist/index.js.map +2 -2
  43. package/dist/iso-block-locator.d.ts +55 -13
  44. package/dist/iso-block-locator.d.ts.map +1 -1
  45. package/dist/iso-block-locator.js +142 -25
  46. package/dist/iso-block-locator.js.map +3 -3
  47. package/dist/media-router.js.map +1 -1
  48. package/dist/mfu-reassembler.js +34 -0
  49. package/dist/mfu-reassembler.js.map +3 -3
  50. package/dist/mmtp-container-parser.d.ts +72 -10
  51. package/dist/mmtp-container-parser.d.ts.map +1 -1
  52. package/dist/mmtp-container-parser.js +260 -18
  53. package/dist/mmtp-container-parser.js.map +3 -3
  54. package/dist/mmtp-container-parser.no-modules.js +411 -34
  55. package/dist/mmtp-container-parser.no-modules.js.map +4 -4
  56. package/dist/mmtp-decode-pipeline.js +260 -18
  57. package/dist/mmtp-decode-pipeline.js.map +3 -3
  58. package/dist/mmtp-fec-session.js +34 -0
  59. package/dist/mmtp-fec-session.js.map +3 -3
  60. package/dist/mmtp-mode-selection.d.ts +48 -0
  61. package/dist/mmtp-mode-selection.d.ts.map +1 -0
  62. package/dist/mmtp-mode-selection.js +79 -0
  63. package/dist/mmtp-mode-selection.js.map +7 -0
  64. package/dist/mmtp-router.d.ts +94 -16
  65. package/dist/mmtp-router.d.ts.map +1 -1
  66. package/dist/mmtp-router.js +754 -78
  67. package/dist/mmtp-router.js.map +4 -4
  68. package/dist/multicast-auth-catalog.js +42 -2
  69. package/dist/multicast-auth-catalog.js.map +3 -3
  70. package/dist/multicast-input.js +42 -2
  71. package/dist/multicast-input.js.map +3 -3
  72. package/dist/multicast-manager.d.ts +121 -4
  73. package/dist/multicast-manager.d.ts.map +1 -1
  74. package/dist/multicast-manager.js +1774 -248
  75. package/dist/multicast-manager.js.map +4 -4
  76. package/dist/multicast-transport.js +70 -2
  77. package/dist/multicast-transport.js.map +4 -4
  78. package/dist/multicast-unwrap.js +34 -0
  79. package/dist/multicast-unwrap.js.map +3 -3
  80. package/dist/no-modules.d.ts +1 -0
  81. package/dist/no-modules.d.ts.map +1 -1
  82. package/dist/no-modules.js +415 -35
  83. package/dist/no-modules.js.map +4 -4
  84. package/dist/phase14-catalog-override.d.ts +2 -1
  85. package/dist/phase14-catalog-override.d.ts.map +1 -1
  86. package/dist/phase14-catalog-override.js +69 -2
  87. package/dist/phase14-catalog-override.js.map +3 -3
  88. package/dist/repair-fetch.d.ts +38 -8
  89. package/dist/repair-fetch.d.ts.map +1 -1
  90. package/dist/repair-fetch.js +336 -27
  91. package/dist/repair-fetch.js.map +3 -3
  92. package/dist/repair-layer-subscriptions.js +34 -0
  93. package/dist/repair-layer-subscriptions.js.map +3 -3
  94. package/dist/signaling.js +34 -0
  95. package/dist/signaling.js.map +3 -3
  96. package/dist/timestamp-codec.js +34 -0
  97. package/dist/timestamp-codec.js.map +3 -3
  98. package/dist/track-session.d.ts.map +1 -1
  99. package/dist/track-session.js +1 -0
  100. package/dist/track-session.js.map +2 -2
  101. package/dist/wasm-mfu-reassembler.js +34 -0
  102. package/dist/wasm-mfu-reassembler.js.map +3 -3
  103. package/dist/wasm-mmtp-container-parser.js +260 -18
  104. package/dist/wasm-mmtp-container-parser.js.map +3 -3
  105. package/package.json +5 -5
  106. package/schemas/catalog.schema.json +2 -2
  107. package/src/block-policy.ts +324 -83
  108. package/src/carp-catalog.ts +165 -5
  109. package/src/catalog-fec-params.ts +1 -0
  110. package/src/codec-utils.ts +121 -1
  111. package/src/fec-manager.ts +835 -66
  112. package/src/fec-state.ts +21 -5
  113. package/src/index.ts +25 -0
  114. package/src/iso-block-locator.ts +148 -31
  115. package/src/mmtp-container-parser.ts +259 -24
  116. package/src/mmtp-mode-selection.ts +80 -0
  117. package/src/mmtp-router.ts +774 -86
  118. package/src/multicast-manager.ts +262 -16
  119. package/src/no-modules.ts +3 -0
  120. package/src/phase14-catalog-override.ts +14 -3
  121. package/src/repair-fetch.ts +389 -50
  122. package/src/track-session.ts +3 -0
  123. package/test-vectors/catalog/README.md +36 -2
  124. package/test-vectors/catalog/mmtp-siblings/ambiguous-sibling.json +158 -0
  125. package/test-vectors/catalog/mmtp-siblings/ladder-bitrate-only.json +231 -0
  126. package/test-vectors/catalog/mmtp-siblings/ladder-four-rungs.json +405 -0
  127. package/test-vectors/catalog/mmtp-siblings/ladder-other-names.json +231 -0
  128. package/test-vectors/catalog/mmtp-siblings/mmtp-mode-unknown.json +143 -0
  129. package/test-vectors/catalog/mmtp-siblings/multicast-endpoint-lists-datagram-track.json +143 -0
  130. package/test-vectors/catalog/mmtp-siblings/no-sibling.json +79 -0
  131. package/test-vectors/catalog/mmtp-siblings/rendition-mismatch.json +143 -0
  132. package/test-vectors/catalog/mmtp-siblings/stream-delivery-mode.json +143 -0
  133. package/test-vectors/catalog/mmtp-siblings/timescale-mismatch.json +143 -0
  134. package/test-vectors/catalog/mmtp-siblings/valid-pair.json +142 -0
  135. package/test-vectors/catalog/section-codes.json +3 -3
  136. package/test-vectors/catalog-validation.json +266 -7
  137. package/test-vectors/moq/mmtp-mode-selection.json +259 -0
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * @mmt/container - MMTP/LOC Container Parsing\n *\n * Shared container parsing library for MMT over MoQ and SSM.\n *\n * @packageDocumentation\n */\n\nexport type { AuthoredTiming } from './authored-timing.js'\n\n// MFU Reassembler\nexport {\n type MFUFragment,\n type ReassembledMFU,\n type ReassemblerStats,\n type MFUReassemblerOptions,\n type MfuReassemblerBackend,\n type MmtpSourcePath,\n MFUReassembler,\n isMfuReassemblyError,\n MfuReassemblyError,\n type MfuReassemblyErrorCode,\n createFragment,\n processMMTPWithReassembly,\n} from './mfu-reassembler.js'\n\n// Sample combiner: combines subsample data units (moqcast #37) of one\n// timed sample, each already reassembled by MFUReassembler, back into one\n// contiguous sample.\nexport {\n type CombinedSample,\n type SampleCombinerStats,\n SampleCombiner,\n SampleCombineError,\n type SampleCombineErrorCode,\n} from './sample-combiner.js'\n\n// fMP4 data-unit completion policy (BLO-13291)\nexport { isCompleteFmp4DataUnit } from './fmp4-completion.js'\n\n\n// The bc-provenance v2 surface (@blockcast/mmt-manifest-verify) is intentionally\n// NOT re-exported from the eager index barrel: it imports @noble/curves and\n// @noble/hashes, bare specifiers the moq-lib / shred / moqtail players (which\n// load the barrel as raw ESM via an import map) cannot resolve. Import it from\n// that package directly. The router's provenance hooks take it by type only.\n\n// H.264/AVC + H.265/HEVC Codec Utilities\nexport {\n type AvcCInfo,\n type AacAscInfo,\n type SpsPps,\n type FallbackAvcCOptions,\n type HevcParameterSets,\n type H264KeyframeDetectionOptions,\n type H264AvccSample,\n type H264SampleFormat,\n type H264NalUnitFormat,\n type H264NalUnitSample,\n extractAvcCFromInitSegment,\n extractAacAscFromInitSegment,\n normalizeMmtpInitSegment,\n generateFallbackAvcC,\n extractSpsPpsFromAvcC,\n avccToAnnexB,\n extractCodecDescriptionFromAnnexB,\n codecStringFromAvcC,\n isAnnexB,\n isCompleteAvccSample,\n findAnnexBStartCode,\n splitAnnexBNalUnits,\n annexBToAvcc,\n normalizeH264SampleToAvcc,\n splitH264SampleNalUnits,\n classifyH264Keyframe,\n detectH264Keyframe,\n mmtpTimestampToMicros,\n isFmp4InitSegment,\n wrapAdtsFrame,\n // HEVC (BLO-7764): build the hvcC description WebCodecs requires for length-prefixed H.265.\n isHevcCodec,\n removeEmulationPrevention,\n splitAvccNalUnits,\n extractHevcParameterSets,\n generateHvcCFromParameterSets,\n extractHevcCodecDescription,\n hevcVclOnly,\n // HEVC receive path (BLO-35597): catalog-selected family, IRAP keyframes,\n // SPS-derived codec string, MSE sample normalization.\n type VideoSampleEntry,\n type VideoCodecFamily,\n type HevcSpsInfo,\n type HevcCmafSample,\n videoSampleEntryFromCodecString,\n videoCodecFamily,\n HEVC_NAL_UNIT_TYPE,\n HEVC_NAL_HEADER_LENGTH,\n hevcNalUnitType,\n isHevcIrapNalUnitType,\n parseHevcSps,\n hevcCodecStringFromSps,\n classifyHevcKeyframe,\n detectHevcKeyframe,\n normalizeHevcSampleToLengthPrefixed,\n prepareHevcCmafSample,\n} from './codec-utils.js'\n\n// LOC FEC Extensions (draft-ramadan-moq-fec \u00A75.3, object extension 0x11)\nexport {\n LOCHeaderExtensionId,\n FEC_SS_ID_MAX,\n FEC_SOURCE_INFO_LEN,\n encodeFecSourceInfo,\n decodeFecSourceInfo,\n FecSourceInfo,\n AuthTag,\n} from './loc.js'\n\n// CARP Catalog Extensions (draft-law-ramadan-moq-carp-reliability \u00A73-4)\n// + Track Timing (draft-ramadan-moq-mmt-01 \u00A74.4.2)\nexport {\n type FecCatalogConfig,\n type FecInstanceConfig,\n type MulticastProtocol,\n type MulticastTrack,\n type MulticastTrackObject,\n type MulticastEndpoint,\n type AmtDiscovery,\n type MulticastCatalogConfig,\n type NetworkSource,\n isMulticastTrackObject,\n isMulticastEndpoint,\n isMulticastCatalogConfig,\n type TrackTimingConfig,\n isTrackTimingConfig,\n resolveGroupDurationTicks,\n resolveGroupDurationMs,\n validateSwitchingSetTiming,\n type CmsfCatalog,\n type CmsfCatalogErrorCode,\n CmsfCatalogValidationError,\n validateCmsfMmtpCatalog,\n type ArchiveConfig,\n archiveOrigin,\n} from './carp-catalog.js'\n\n// Strict v2 multicast delivery catalog (DASH/HLS/MMTP routes), moved from\n// moqtail-private so players share one contract (BLO-47003).\nexport {\n normalizeDeliveryCatalog,\n type DeliveryPackaging,\n type DeliveryContentType,\n type DeliveryEndpoint,\n type DeliveryPolicy,\n type DeliveryObjectMapping,\n type DeliveryFec,\n type DeliveryRouteBase,\n type DashDeliveryRoute,\n type HlsDeliveryRoute,\n type MmtpDeliveryRoute,\n type DashDeliveryConfig,\n type HlsDeliveryConfig,\n type MmtpDeliveryConfig,\n type DeliveryMulticastBase,\n type DeliveryMulticastV2,\n type DeliveryCatalogV2,\n} from './delivery-catalog.js'\n\n// Multicast input contract \u2014 validator + builder for publisher-emitted\n// catalogs (draft-ramadan-moq-multicast-01 \u00A74.1, BLO-3323 A.1).\n// `multicastFromEnv` is the env-var helper used by FFmpeg and the\n// cast bridge (BLO-3337).\nexport {\n type MulticastInput,\n type MulticastEndpointInput,\n type MulticastInputErrorKind,\n MulticastInputError,\n multicastFromConfig,\n multicastFromEnv,\n} from './multicast-input.js'\n\n// Phase 14 catalog override hook (test harness injects\n// globalThis.__PHASE14_CATALOG_OVERRIDE; see 7point-validation.test.mjs)\nexport {\n type Phase14OverrideTrack,\n type Phase14CatalogOverride,\n getPhase14CatalogOverride,\n mergeOverrideIntoHangRenditions,\n mergeOverrideIntoCmsfTracks,\n} from './phase14-catalog-override.js'\n\n// Multicast Unwrap (container-aware MMTP dispatch)\nexport {\n type MulticastContainerContract,\n type MulticastContainerErrorCode,\n type FecPayloadId as MulticastFecPayloadId,\n type MulticastFrame,\n MulticastContainerContractError,\n validateMulticastContainerContract,\n unwrapMulticastPacket,\n} from './multicast-unwrap.js'\n\n// Timestamp Codec \u2014 container-format-agnostic timestamp encoding/decoding\nexport {\n type ContainerFormat,\n type LocHeader,\n encodeTimestamp,\n decodeTimestamp,\n getTimestampSize,\n decodeLocHeader,\n decodeLocTimestamp,\n encodeLocTimestamp,\n} from './timestamp-codec.js'\n\n// MMTP \u2192 CMAF conversion (draft-ramadan-moq-mmt \u00A75.3)\nexport {\n MmtpToCmaf,\n encodeDataSegment,\n encodeMultiSampleSegment,\n buildVideoInitSegment,\n buildHevcVideoInitSegment,\n buildAudioInitSegment,\n generateSilenceFrame,\n} from './mmtp-to-cmaf.js'\n\n// MMTP Signaling \u2014 packet type detection and classification\nexport {\n type PacketClass,\n getPacketType,\n isSignalingPacket,\n isSourcePacket,\n classifyPacket,\n} from './signaling.js'\n\n// FEC Block \u2192 CMAF Segment Assembler\nexport {\n CmafBlockAssembler,\n type CmafBlockSample,\n type CmafSampleOrderPolicy,\n type CmafSampleOrderStats,\n type CmafEmitStats,\n type CmafAudioConcealStats,\n type BlockAssemblerConfig,\n} from './cmaf-block-assembler.js'\n\n// MoQ Group \u2192 CMAF Segment Batcher\nexport {\n CmafGroupBatcher,\n type CmafGroupBatcherConfig,\n} from './cmaf-group-batcher.js'\n\n// FEC Manager (codec-agnostic FEC decode service)\nexport {\n FECManager,\n type FECManagerConfig,\n type FecDecoderUnavailableEvent,\n type FecDecoderUnavailableReason,\n type FecFallbackDecoder,\n type WasmFecDecoder,\n type FecStats,\n type MulticastSymbolDelivery,\n type UndelimitedIsoLoss,\n type FecBlockResolution,\n type RepairVia,\n type FecRepairLayer,\n type FecFailClosedReason,\n type FecFailClosedEvent,\n} from './fec-manager.js'\n\n// MMTP Router (packet processing + frame routing)\nexport {\n MmtpRouter,\n KEYFRAME_LOST_TIMEOUT_SLACK,\n type FrameCallback,\n type FECManagerLike,\n type MmtpIngressContext,\n type KeyframeOverlayLeg,\n type KeyframeOverlayFec,\n type KeyframeOverlayStats,\n KEYFRAME_OVERLAY_EXTENSION_TYPE,\n keyframeOverlaySsId,\n type MmtpStreamIdentity,\n type RoutedPacketMeta,\n type StagedStreamSwitch,\n type StreamSwitchCommit,\n type StreamSwitchCommitReason,\n type StreamSwitchOptions,\n type StreamSwitchPosition,\n type TrackPacketCallback,\n} from './mmtp-router.js'\n\n// MmtpContainerParser (unified, transport-agnostic)\nexport {\n MmtpContainerParser,\n type MmtpParserConfig,\n type MmtpParserRecord,\n type MmtpParserFeedStats,\n type MmtpFeedDropReason,\n type MmtpFeedOutcomeKey,\n type TrackInfo,\n type MmtpReorderStats,\n type MmtpRecoveredHeadTimingStats,\n type MmtpReorderFrameDiagnostics,\n type MmtpReorderStreamDiagnostics,\n type FrameMeta as ParserFrameMeta,\n type PacketInfo,\n type ParsedMmtpPacket,\n} from './mmtp-container-parser.js'\n\nexport {\n datagramMfuReassembly,\n reliableMoqMfuReassembly,\n mmtpFrameReorderWindowFrames,\n mfuReassemblyTimeoutMs,\n type MfuReassemblyPolicy,\n type MmtpTrackType,\n type ReliableMoqReassemblyOptions,\n} from './mfu-reassembly-policy.js'\n\nexport {\n WasmMfuReassembler,\n resolveGlobalMmtWasmBindings,\n type MmtWasmBindings,\n type WasmMfuReassemblerOptions,\n} from './wasm-mfu-reassembler.js'\n\nexport {\n createWasmMmtpContainerParser,\n type WasmMmtpParserConfig,\n} from './wasm-mmtp-container-parser.js'\n\n// Multicast Transport (SSM join/socket/watchdog)\nexport {\n MulticastTransport,\n type MulticastFailbackReason,\n type MulticastJoinDeclineReason,\n type MulticastJoinOutcome,\n type MulticastJoinProviderError,\n type MulticastJoinStats,\n type MulticastTransportConfig,\n type ResolvedMulticastTransport,\n} from './multicast-transport.js'\n\n// Multicast Manager (backwards-compat facade composing all three)\nexport {\n MulticastManager,\n forwardRepairLifecycleEvents,\n isRepairLifecycleEvent,\n REPAIR_LIFECYCLE_EVENT_TYPE,\n REPAIR_LIFECYCLE_LOG_PREFIX,\n type MulticastEndpointConfig,\n type MultiTrackCatalog,\n type MultiTrackCatalogTrack,\n type WasmFecDecoderFactory,\n type RepairBlockIdentity,\n type RepairLifecycleApplicationEvent,\n type RepairLifecycleEventOptions,\n type RepairLifecycleEventFactory,\n type RepairLifecycleEventTarget,\n type RepairLifecycleSource,\n type RepairLifecycleEvent,\n type RepairLifecycleObserver,\n type RepairStreamIdentity,\n type BlockPolicyStats,\n type RenditionSwitch,\n type RenditionSwitchCancel,\n type RenditionSwitchRequest,\n type RenditionSwitchState,\n} from './multicast-manager.js'\n\n// Keyframe-protected FEC repair policy: block classification, repair\n// priority, and the stall/conceal decision every player applies.\nexport {\n BlockClassifier,\n decideGap,\n deriveBlockClassifierGeometry,\n keyframeIntervalMediaTicks,\n repairPriorityForClass,\n type BlockClass,\n type BlockClassifierGeometry,\n type BlockClassifierGeometryInput,\n type ClassifierChange,\n type ClassifierMode,\n type ClassifierReason,\n type DecideGapInput,\n type FrameGapAction,\n type FrameGapDecision,\n type FrameGapReason,\n type GapFrameEvidence,\n type GapStreamIdentity,\n type KeyframeInterval,\n type ReclassificationEvidence,\n type RepairPriority,\n type SourceSymbolEvidence,\n type TrackKind,\n} from './block-policy.js'\n\n// Sink-side concealment: hold last good frame, exact audio gap sizing.\nexport {\n AudioGapConcealer,\n HoldLastTimeline,\n videoConcealModeForCodec,\n type AudioAccessUnit,\n type AudioGapConcealerStats,\n type AudioGapPlan,\n type HoldLastTimelineOptions,\n type HoldLastTimelineStats,\n type TimelineEmit,\n type TimelineSample,\n type VideoConcealMode,\n} from './conceal-timeline.js'\n\n// FEC Worker Setup (shared fec-setup helper)\nexport {\n setupFecWorkerForTrack,\n type FecWorkerAssetUrls,\n type FecWorkerSetupOptions,\n type FecWorkerSetupResult,\n} from './fec-worker-setup.js'\n\n// Media Router (shared MoQ \u2194 multicast source arbitration)\nexport {\n MediaRouter,\n TrackSourceConflictError,\n type MediaRouterOptions,\n type TrackSource,\n type SetTrackSourceOptions,\n type MigrationPolicy,\n type FrameMeta as RouterFrameMeta,\n type FrameKind,\n type SourceKind,\n type DeltaFallbackConfig,\n} from './media-router.js'\nexport {\n resolveDeltaFallback,\n type ResolvedDeltaFallback,\n} from './delta-fallback-config.js'\n\n// Group-alignment primitive \u2014 shared with Go sender + Rust relay.\n// See align.ts docstring for cross-language contract. Authoritative form\n// is integer-ticks (groupIdForTicks); seconds-form is the legacy ramp.\nexport {\n groupIdForTicks,\n groupIdFor,\n secondsFromTicks,\n asSeconds,\n driftCheck,\n type Seconds,\n type DriftCheckResult,\n} from './align.js'\n\n// Audio Ring Buffer \u2014 DEPRECATED: canonical location is @blockcast/mmt-render/audio.\n// Kept here for backwards compat with consumers not yet migrated to mmt-render.\n// The mmt-render version includes warmup-delayed clock recovery + adaptive target fill.\nexport {\n AudioRingBuffer,\n type AudioRingBufferConfig,\n} from './audio-ring-buffer.js'\n\n// MMTP Decode Pipeline (MoQ + multicast unified decode path)\nexport {\n MmtpDecodePipeline,\n type PipelineFecClient,\n type PipelineConfig,\n type MmtpFeedStats,\n} from './mmtp-decode-pipeline.js'\n\n// Track Pipeline (per-track transport promotion + ABR)\nexport {\n TrackPipeline,\n type TrackTransport,\n type TrackTransportPreference,\n type TransportCapabilityReport,\n type TrackTransportResolution,\n type TrackSourceFactory,\n} from './track-pipeline.js'\n\n// Track Pipeline Setup (shared wiring helper for both players)\nexport {\n setupTrackPipeline,\n type TrackDescriptor,\n type SetupTrackPipelineOptions,\n type SetupTrackPipelineResult,\n} from './track-pipeline-setup.js'\n\n// Audio Init Data Parser (spec-compliant frame samples from initData)\nexport {\n parseAacFrameSamples,\n parseAacSampleRate,\n parseOpusFrameSamples,\n frameSamplesFromInit,\n} from './audio-init-parser.js'\n\n// Transport Pool (ref-counted subscription lifecycle, PIM)\nexport {\n TransportPool,\n type SubscriptionMode,\n type DirectSocketHealth,\n type Subscription,\n type SubscriptionStats,\n type AcquireOptions,\n type TransportPoolOptions,\n} from './transport-pool.js'\n\n// Track Session + Session Manager (per-track state machine, Patent Claim 9)\nexport {\n TrackSession,\n SessionManager,\n MAX_TAKEOVER_DEADLINE_MS,\n JOIN_DEFER_WARN_MS,\n computeFecDeliveryWindowMs,\n computeFecDeliveryWindowMediaUnits,\n computeFecLossWindowMs,\n type FecDeliveryWindowConfig,\n type TrackState,\n type TrackSessionConfig,\n type SessionManagerCallbacks,\n type MmtpTrackEvent,\n type MmtpSessionCallbacks,\n} from './track-session.js'\n\n// FEC starvation detector (post-cutover repair-only/no-progress detection,\n// drives TrackSession lossDetected/lossRecovered \u2014 BLO-9413/D4)\nexport {\n FecStarvationDetector,\n type FecStarvationSnapshot,\n type FecStarvationDetectorConfig,\n} from './fec-starvation-detector.js'\n\n// CMCD v2 Event-mode producer (CTA-5004-B, com.blockcast-* custom keys)\nexport {\n CmcdProducer,\n encodeCmcdRecord,\n type CmcdRecord,\n type CmcdToken,\n type CmcdValue,\n type CmcdProducerOptions,\n type SnapshotData,\n type TransportSnapshot,\n type TransportTransitionEvent,\n} from './cmcd-producer.js'\n\nexport {\n\tcatalogFecInterleaveMs,\n\tresolveCatalogTrackFec,\n\ttype CatalogTrackRef,\n\ttype FecInterleaveCatalog,\n\ttype GroupDurationCatalog,\n\ttype KeyframeCadenceCatalog,\n\ttype TrackFecParams,\n\ttype TrackFecUnavailable,\n\tcatalogTrackFecUnavailable,\n\tcatalogTrackDeliveryMode,\n\tcatalogGroupDurationMs,\n\tcatalogKeyframeCadenceMs,\n\tcatalogFecMediaUnitsPerSecond,\n\ttype GroupDurationRendition,\n\tresolveCatalogTrackGroupDurationMs,\n\tjoinedRepairSymbolCount,\n\tFEC_BLOCK_PROFILES,\n\tisFecBlockProfile,\n\tparseFecBlockProfile,\n\ttype FecBlockProfile,\n\tresolveRepairLayers,\n\tcatalogRepairTarget,\n\tDEFAULT_REPAIR_PRIORITY,\n\tMAX_ENCODING_SYMBOL_ID,\n\tMAX_RAPTORQ_SOURCE_SYMBOLS,\n\tMAX_REPAIR_SYMBOLS,\n\tREPAIR_PRIORITY_MAX,\n\tREPAIR_PRIORITY_MIN,\n\ttype RepairLayerCatalog,\n\ttype RepairLayerParams,\n\ttype RepairLayersResolution,\n\ttype RepairOverlayParams,\n\t// FEC catalog binding, draft-ramadan-moq-fec-catalog-00 array shape (BLO-50171).\n\tvalidateFecCatalog,\n\ttype FecCatalogCode,\n\ttype FecCatalogInstance,\n\ttype FecCatalogIssue,\n\ttype FecCatalogOutcome,\n\ttype FecCatalogReceiver,\n\ttype FecCatalogReport,\n} from \"./catalog-fec-params.js\";\n\n// Typed FEC state (active with counters, or inactive with a reason) shared by\n// every player, resolved from catalog, transport policy, bridge and\n// subscription state rather than from counters.\nexport {\n\tFEC_INACTIVE_REASONS,\n\tcatalogDeclaresFec,\n\tresolveFecState,\n\ttype FecActiveState,\n\ttype FecInactiveReason,\n\ttype FecInactiveState,\n\ttype FecState,\n\ttype FecStateEvidence,\n\ttype FecTransportPolicy,\n\ttype NoFecCounters,\n} from \"./fec-state.js\";\n\n// In-band AL-FEC for one MMTP asset over a MoQT subscription, for a player\n// that owns its own parser (the Shaka MSF MMTP packaging).\nexport {\n\tMmtpFecSession,\n\ttype MmtpFecSessionCatalogFec,\n\ttype MmtpFecSessionConfig,\n\ttype MmtpFecSessionDecoder,\n\ttype MmtpFecSessionDecoderConstructor,\n\ttype MmtpFecSessionMessageConfig,\n\ttype MmtpFecSessionMessageUpdate,\n\ttype MmtpFecSessionMixedPathStats,\n\ttype MmtpFecSessionPath,\n\ttype MmtpFecSessionPathCounts,\n\ttype MmtpFecSessionStats,\n} from \"./mmtp-fec-session.js\";\n// MoQ repair-layer subscriptions by measured loss (BLO-35456)\nexport {\n\tRepairLayerSubscriptions,\n\ttype MoqRepairDelivery,\n\ttype RepairLayerSource,\n\ttype RepairLayerSubscriptionsOptions,\n\ttype RepairLayerSubscriptionsSnapshot,\n\ttype RepairTrackSubscription,\n} from \"./repair-layer-subscriptions.js\";\n\nexport {\n\tcatalogAmtNetworkSource,\n\tcatalogAtsc3NetworkSource,\n\tDEFAULT_AMT_RELAY_PORT,\n\ttype AmtNetworkSource,\n\ttype Atsc3NetworkSource,\n\ttype CatalogNetworkSource,\n} from \"./catalog-network-source.js\";\n\n// D-28 shared repair-fetch shell (per-SBN on-demand MoQ FEC repair backfill)\nexport {\n wireRepairFetch,\n repairFetchSubscriberPriority,\n SOURCE_MEDIA_PRIORITY_MAX,\n type ResolveRepairTarget,\n type RepairTarget,\n type RepairFetchHost,\n type RepairFetchPriority,\n type RepairFetchRequest,\n type RepairFetchTransport,\n type RepairRangeFetchRequest,\n type RepairRangeFetchTransport,\n type RepairDeadlineBound,\n type RepairPriorityReason,\n type RepairSendMeasurement,\n type RepairSkipReason,\n type RepairStopReason,\n type RepairSubscribeCallback,\n type WireRepairFetchOptions,\n} from './repair-fetch.js'\n// MoQ repair group ids for iso-ssbg1-v1 blocks (BLO-35597): the 62-bit\n// wrap-epoch-extended SS_Start and the repair FETCH range for a lost SS_ID.\nexport {\n extSsStart,\n extendSsId,\n repairFetchRange,\n type RepairFetchRange,\n} from '@blockcast/mmt-fec'\nexport { DeliveryGapEstimator } from './delivery-gap.js'\n"],
5
- "mappings": ";AAWA;AAAA,EAOE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAKP;AAAA,EAGE;AAAA,EACA;AAAA,OAEK;AAGP,SAAS,8BAA8B;AAUvC;AAAA,EAWE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAOA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP;AAAA,EAUE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAIP;AAAA,EACE;AAAA,OAiBK;AAMP;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EA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AA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAMA;AAAA,OAOM;AAKP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAQM;AAIP;AAAA,EACC;AAAA,OAWM;AAEP;AAAA,EACC;AAAA,OAMM;AAEP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAIM;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAgBK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,4BAA4B;",
4
+ "sourcesContent": ["/**\n * @mmt/container - MMTP/LOC Container Parsing\n *\n * Shared container parsing library for MMT over MoQ and SSM.\n *\n * @packageDocumentation\n */\n\nexport type { AuthoredTiming } from './authored-timing.js'\n\n// MFU Reassembler\nexport {\n type MFUFragment,\n type ReassembledMFU,\n type ReassemblerStats,\n type MFUReassemblerOptions,\n type MfuReassemblerBackend,\n type MmtpSourcePath,\n MFUReassembler,\n isMfuReassemblyError,\n MfuReassemblyError,\n type MfuReassemblyErrorCode,\n createFragment,\n processMMTPWithReassembly,\n} from './mfu-reassembler.js'\n\n// Sample combiner: combines subsample data units (moqcast #37) of one\n// timed sample, each already reassembled by MFUReassembler, back into one\n// contiguous sample.\nexport {\n type CombinedSample,\n type SampleCombinerStats,\n SampleCombiner,\n SampleCombineError,\n type SampleCombineErrorCode,\n} from './sample-combiner.js'\n\n// fMP4 data-unit completion policy (BLO-13291)\nexport { isCompleteFmp4DataUnit } from './fmp4-completion.js'\n\n\n// The bc-provenance v2 surface (@blockcast/mmt-manifest-verify) is intentionally\n// NOT re-exported from the eager index barrel: it imports @noble/curves and\n// @noble/hashes, bare specifiers the moq-lib / shred / moqtail players (which\n// load the barrel as raw ESM via an import map) cannot resolve. Import it from\n// that package directly. The router's provenance hooks take it by type only.\n\n// H.264/AVC + H.265/HEVC Codec Utilities\nexport {\n type AvcCInfo,\n type AacAscInfo,\n type SpsPps,\n type FallbackAvcCOptions,\n type HevcParameterSets,\n type H264KeyframeDetectionOptions,\n type H264AvccSample,\n type H264SampleFormat,\n type H264NalUnitFormat,\n type H264NalUnitSample,\n extractAvcCFromInitSegment,\n extractAacAscFromInitSegment,\n normalizeMmtpInitSegment,\n generateFallbackAvcC,\n extractSpsPpsFromAvcC,\n avccToAnnexB,\n extractCodecDescriptionFromAnnexB,\n codecStringFromAvcC,\n isAnnexB,\n isCompleteAvccSample,\n findAnnexBStartCode,\n splitAnnexBNalUnits,\n annexBToAvcc,\n normalizeH264SampleToAvcc,\n splitH264SampleNalUnits,\n classifyH264Keyframe,\n detectH264Keyframe,\n mmtpTimestampToMicros,\n isFmp4InitSegment,\n wrapAdtsFrame,\n // HEVC (BLO-7764): build the hvcC description WebCodecs requires for length-prefixed H.265.\n isHevcCodec,\n removeEmulationPrevention,\n splitAvccNalUnits,\n extractHevcParameterSets,\n generateHvcCFromParameterSets,\n extractHevcCodecDescription,\n hevcVclOnly,\n // HEVC receive path (BLO-35597): catalog-selected family, IRAP keyframes,\n // SPS-derived codec string, MSE sample normalization.\n type VideoSampleEntry,\n type VideoCodecFamily,\n type HevcSpsInfo,\n type HevcCmafSample,\n videoSampleEntryFromCodecString,\n videoCodecFamily,\n HEVC_NAL_UNIT_TYPE,\n HEVC_NAL_HEADER_LENGTH,\n hevcNalUnitType,\n isHevcIrapNalUnitType,\n parseHevcSps,\n hevcCodecStringFromSps,\n classifyHevcKeyframe,\n detectHevcKeyframe,\n normalizeHevcSampleToLengthPrefixed,\n prepareHevcCmafSample,\n} from './codec-utils.js'\n\n// LOC FEC Extensions (draft-ramadan-moq-fec \u00A75.3, object extension 0x11)\nexport {\n LOCHeaderExtensionId,\n FEC_SS_ID_MAX,\n FEC_SOURCE_INFO_LEN,\n encodeFecSourceInfo,\n decodeFecSourceInfo,\n FecSourceInfo,\n AuthTag,\n} from './loc.js'\n\n// CARP Catalog Extensions (draft-law-ramadan-moq-carp-reliability \u00A73-4)\n// + Track Timing (draft-ramadan-moq-mmt-01 \u00A74.4.2)\nexport {\n type FecCatalogConfig,\n type FecInstanceConfig,\n type MulticastProtocol,\n type MulticastTrack,\n type MulticastTrackObject,\n type MulticastEndpoint,\n type AmtDiscovery,\n type MulticastCatalogConfig,\n type NetworkSource,\n isMulticastTrackObject,\n isMulticastEndpoint,\n isMulticastCatalogConfig,\n type TrackTimingConfig,\n isTrackTimingConfig,\n resolveGroupDurationTicks,\n resolveGroupDurationMs,\n validateSwitchingSetTiming,\n type CmsfCatalog,\n type CmsfCatalogErrorCode,\n CmsfCatalogValidationError,\n validateCmsfMmtpCatalog,\n type MmtpTrackIssue,\n type MmtpTrackIssueCode,\n mmtpTrackIssues,\n type ArchiveConfig,\n archiveOrigin,\n} from './carp-catalog.js'\n\n// Strict v2 multicast delivery catalog (DASH/HLS/MMTP routes), moved from\n// moqtail-private so players share one contract (BLO-47003).\nexport {\n normalizeDeliveryCatalog,\n type DeliveryPackaging,\n type DeliveryContentType,\n type DeliveryEndpoint,\n type DeliveryPolicy,\n type DeliveryObjectMapping,\n type DeliveryFec,\n type DeliveryRouteBase,\n type DashDeliveryRoute,\n type HlsDeliveryRoute,\n type MmtpDeliveryRoute,\n type DashDeliveryConfig,\n type HlsDeliveryConfig,\n type MmtpDeliveryConfig,\n type DeliveryMulticastBase,\n type DeliveryMulticastV2,\n type DeliveryCatalogV2,\n} from './delivery-catalog.js'\n\n// Multicast input contract \u2014 validator + builder for publisher-emitted\n// catalogs (draft-ramadan-moq-multicast-01 \u00A74.1, BLO-3323 A.1).\n// `multicastFromEnv` is the env-var helper used by FFmpeg and the\n// cast bridge (BLO-3337).\nexport {\n type MulticastInput,\n type MulticastEndpointInput,\n type MulticastInputErrorKind,\n MulticastInputError,\n multicastFromConfig,\n multicastFromEnv,\n} from './multicast-input.js'\n\n// Phase 14 catalog override hook (test harness injects\n// globalThis.__PHASE14_CATALOG_OVERRIDE; see 7point-validation.test.mjs)\nexport {\n type Phase14OverrideTrack,\n type Phase14CatalogOverride,\n getPhase14CatalogOverride,\n mergeOverrideIntoHangRenditions,\n mergeOverrideIntoCmsfTracks,\n} from './phase14-catalog-override.js'\n\n// Multicast Unwrap (container-aware MMTP dispatch)\nexport {\n type MulticastContainerContract,\n type MulticastContainerErrorCode,\n type FecPayloadId as MulticastFecPayloadId,\n type MulticastFrame,\n MulticastContainerContractError,\n validateMulticastContainerContract,\n unwrapMulticastPacket,\n} from './multicast-unwrap.js'\n\n// Timestamp Codec \u2014 container-format-agnostic timestamp encoding/decoding\nexport {\n type ContainerFormat,\n type LocHeader,\n encodeTimestamp,\n decodeTimestamp,\n getTimestampSize,\n decodeLocHeader,\n decodeLocTimestamp,\n encodeLocTimestamp,\n} from './timestamp-codec.js'\n\n// MMTP \u2192 CMAF conversion (draft-ramadan-moq-mmt \u00A75.3)\nexport {\n MmtpToCmaf,\n encodeDataSegment,\n encodeMultiSampleSegment,\n buildVideoInitSegment,\n buildHevcVideoInitSegment,\n buildAudioInitSegment,\n generateSilenceFrame,\n} from './mmtp-to-cmaf.js'\n\n// MMTP Signaling \u2014 packet type detection and classification\nexport {\n type PacketClass,\n getPacketType,\n isSignalingPacket,\n isSourcePacket,\n classifyPacket,\n} from './signaling.js'\n\n// FEC Block \u2192 CMAF Segment Assembler\nexport {\n CmafBlockAssembler,\n type CmafBlockSample,\n type CmafSampleOrderPolicy,\n type CmafSampleOrderStats,\n type CmafEmitStats,\n type CmafAudioConcealStats,\n type BlockAssemblerConfig,\n} from './cmaf-block-assembler.js'\n\n// MoQ Group \u2192 CMAF Segment Batcher\nexport {\n CmafGroupBatcher,\n type CmafGroupBatcherConfig,\n} from './cmaf-group-batcher.js'\n\n// FEC Manager (codec-agnostic FEC decode service)\nexport {\n FECManager,\n type FECManagerConfig,\n type FecDecoderUnavailableEvent,\n type FecDecoderUnavailableReason,\n type FecFallbackDecoder,\n type WasmFecDecoder,\n type FecStats,\n type FecSymbolSource,\n type DeliveryGapPath,\n type UnresolvedRepairOwnerDrops,\n type UnresolvedRepairOwnerReason,\n type MulticastSymbolDelivery,\n type UndelimitedIsoLoss,\n type ExpiredIsoHole,\n type IsoSpanFailure,\n type FecBlockResolution,\n type RepairVia,\n type FecRepairLayer,\n type FecFailClosedReason,\n type FecFailClosedEvent,\n} from './fec-manager.js'\n\n// MMTP Router (packet processing + frame routing)\nexport {\n MmtpRouter,\n KEYFRAME_LOST_TIMEOUT_SLACK,\n type FrameCallback,\n type FECManagerLike,\n type MmtpIngestSource,\n type MmtpIngressContext,\n type KeyframeOverlayLeg,\n type KeyframeOverlayFec,\n type KeyframeOverlayStats,\n KEYFRAME_OVERLAY_EXTENSION_TYPE,\n keyframeOverlaySsId,\n type MmtpStreamIdentity,\n type RoutedPacketMeta,\n type StagedStreamSwitch,\n type StreamSwitchCommit,\n type StreamSwitchCommitReason,\n type StreamSwitchOptions,\n type StreamSwitchPosition,\n type TrackPacketCallback,\n} from './mmtp-router.js'\n\n// MmtpContainerParser (unified, transport-agnostic)\nexport {\n MmtpContainerParser,\n type MmtpParserConfig,\n type MmtpParserRecord,\n type MmtpParserFeedStats,\n type MmtpFeedDropReason,\n type MmtpFeedOutcomeKey,\n type TrackInfo,\n type MmtpReorderStats,\n type MmtpRecoveredHeadTimingStats,\n type MmtpReorderFrameDiagnostics,\n type MmtpReorderStreamDiagnostics,\n type FrameMeta as ParserFrameMeta,\n type PacketInfo,\n type ParsedMmtpPacket,\n} from './mmtp-container-parser.js'\n\nexport {\n datagramMfuReassembly,\n reliableMoqMfuReassembly,\n mmtpFrameReorderWindowFrames,\n mfuReassemblyTimeoutMs,\n type MfuReassemblyPolicy,\n type MmtpTrackType,\n type ReliableMoqReassemblyOptions,\n} from './mfu-reassembly-policy.js'\n\nexport {\n WasmMfuReassembler,\n resolveGlobalMmtWasmBindings,\n type MmtWasmBindings,\n type WasmMfuReassemblerOptions,\n} from './wasm-mfu-reassembler.js'\n\nexport {\n createWasmMmtpContainerParser,\n type WasmMmtpParserConfig,\n} from './wasm-mmtp-container-parser.js'\n\n// Multicast Transport (SSM join/socket/watchdog)\nexport {\n MulticastTransport,\n type MulticastFailbackReason,\n type MulticastJoinDeclineReason,\n type MulticastJoinOutcome,\n type MulticastJoinProviderError,\n type MulticastJoinStats,\n type MulticastTransportConfig,\n type ResolvedMulticastTransport,\n} from './multicast-transport.js'\n\n// Multicast Manager (backwards-compat facade composing all three)\nexport {\n MulticastManager,\n forwardRepairLifecycleEvents,\n isRepairLifecycleEvent,\n REPAIR_LIFECYCLE_EVENT_TYPE,\n REPAIR_LIFECYCLE_LOG_PREFIX,\n type MulticastEndpointConfig,\n type DatagramLegDiagnostics,\n type DatagramLegPlayerCounters,\n type MultiTrackCatalog,\n type MultiTrackCatalogTrack,\n type WasmFecDecoderFactory,\n type RepairBlockIdentity,\n type RepairLifecycleApplicationEvent,\n type RepairLifecycleEventOptions,\n type RepairLifecycleEventFactory,\n type RepairLifecycleEventTarget,\n type RepairLifecycleSource,\n type RepairLifecycleEvent,\n type RepairLifecycleObserver,\n type RepairStreamIdentity,\n type BlockPolicyStats,\n type RenditionSwitch,\n type RenditionSwitchCancel,\n type RenditionSwitchRequest,\n type RenditionSwitchState,\n} from './multicast-manager.js'\n\n// Keyframe-protected FEC repair policy: block classification, repair\n// priority, and the stall/conceal decision every player applies.\nexport {\n BlockClassifier,\n decideGap,\n deriveBlockClassifierGeometry,\n keyframeIntervalMediaTicks,\n repairPriorityForClass,\n type BlockClass,\n type BlockClassifierGeometry,\n type BlockClassifierGeometryInput,\n type ClassifierChange,\n type ClassifierMode,\n type ClassifierReason,\n type DecideGapInput,\n type FrameGapAction,\n type FrameGapDecision,\n type FrameGapReason,\n type GapFrameEvidence,\n type GapStreamIdentity,\n type KeyframeInterval,\n type ReclassificationEvidence,\n type RepairPriority,\n type SourceSymbolEvidence,\n type TrackKind,\n} from './block-policy.js'\n\n// Sink-side concealment: hold last good frame, exact audio gap sizing.\nexport {\n AudioGapConcealer,\n HoldLastTimeline,\n videoConcealModeForCodec,\n type AudioAccessUnit,\n type AudioGapConcealerStats,\n type AudioGapPlan,\n type HoldLastTimelineOptions,\n type HoldLastTimelineStats,\n type TimelineEmit,\n type TimelineSample,\n type VideoConcealMode,\n} from './conceal-timeline.js'\n\n// FEC Worker Setup (shared fec-setup helper)\nexport {\n setupFecWorkerForTrack,\n type FecWorkerAssetUrls,\n type FecWorkerSetupOptions,\n type FecWorkerSetupResult,\n} from './fec-worker-setup.js'\n\n// Media Router (shared MoQ \u2194 multicast source arbitration)\nexport {\n MediaRouter,\n TrackSourceConflictError,\n type MediaRouterOptions,\n type TrackSource,\n type SetTrackSourceOptions,\n type MigrationPolicy,\n type FrameMeta as RouterFrameMeta,\n type FrameKind,\n type SourceKind,\n type DeltaFallbackConfig,\n} from './media-router.js'\nexport {\n resolveDeltaFallback,\n type ResolvedDeltaFallback,\n} from './delta-fallback-config.js'\n\n// Group-alignment primitive \u2014 shared with Go sender + Rust relay.\n// See align.ts docstring for cross-language contract. Authoritative form\n// is integer-ticks (groupIdForTicks); seconds-form is the legacy ramp.\nexport {\n groupIdForTicks,\n groupIdFor,\n secondsFromTicks,\n asSeconds,\n driftCheck,\n type Seconds,\n type DriftCheckResult,\n} from './align.js'\n\n// Audio Ring Buffer \u2014 DEPRECATED: canonical location is @blockcast/mmt-render/audio.\n// Kept here for backwards compat with consumers not yet migrated to mmt-render.\n// The mmt-render version includes warmup-delayed clock recovery + adaptive target fill.\nexport {\n AudioRingBuffer,\n type AudioRingBufferConfig,\n} from './audio-ring-buffer.js'\n\n// MMTP Decode Pipeline (MoQ + multicast unified decode path)\nexport {\n MmtpDecodePipeline,\n type PipelineFecClient,\n type PipelineConfig,\n type MmtpFeedStats,\n} from './mmtp-decode-pipeline.js'\n\n// Track Pipeline (per-track transport promotion + ABR)\nexport {\n TrackPipeline,\n type TrackTransport,\n type TrackTransportPreference,\n type TransportCapabilityReport,\n type TrackTransportResolution,\n type TrackSourceFactory,\n} from './track-pipeline.js'\n\n// Track Pipeline Setup (shared wiring helper for both players)\nexport {\n setupTrackPipeline,\n type TrackDescriptor,\n type SetupTrackPipelineOptions,\n type SetupTrackPipelineResult,\n} from './track-pipeline-setup.js'\n\n// Audio Init Data Parser (spec-compliant frame samples from initData)\nexport {\n parseAacFrameSamples,\n parseAacSampleRate,\n parseOpusFrameSamples,\n frameSamplesFromInit,\n} from './audio-init-parser.js'\n\n// Transport Pool (ref-counted subscription lifecycle, PIM)\nexport {\n TransportPool,\n type SubscriptionMode,\n type DirectSocketHealth,\n type Subscription,\n type SubscriptionStats,\n type AcquireOptions,\n type TransportPoolOptions,\n} from './transport-pool.js'\n\n// Track Session + Session Manager (per-track state machine, Patent Claim 9)\nexport {\n TrackSession,\n SessionManager,\n MAX_TAKEOVER_DEADLINE_MS,\n JOIN_DEFER_WARN_MS,\n computeFecDeliveryWindowMs,\n computeFecDeliveryWindowMediaUnits,\n computeFecLossWindowMs,\n type FecDeliveryWindowConfig,\n type TrackState,\n type TrackSessionConfig,\n type SessionManagerCallbacks,\n type MmtpTrackEvent,\n type MmtpSessionCallbacks,\n} from './track-session.js'\n\n// FEC starvation detector (post-cutover repair-only/no-progress detection,\n// drives TrackSession lossDetected/lossRecovered \u2014 BLO-9413/D4)\nexport {\n FecStarvationDetector,\n type FecStarvationSnapshot,\n type FecStarvationDetectorConfig,\n} from './fec-starvation-detector.js'\n\n// CMCD v2 Event-mode producer (CTA-5004-B, com.blockcast-* custom keys)\nexport {\n CmcdProducer,\n encodeCmcdRecord,\n type CmcdRecord,\n type CmcdToken,\n type CmcdValue,\n type CmcdProducerOptions,\n type SnapshotData,\n type TransportSnapshot,\n type TransportTransitionEvent,\n} from './cmcd-producer.js'\n\nexport {\n\tcatalogFecInterleaveMs,\n\tresolveCatalogTrackFec,\n\ttype CatalogTrackRef,\n\ttype FecInterleaveCatalog,\n\ttype GroupDurationCatalog,\n\ttype KeyframeCadenceCatalog,\n\ttype TrackFecParams,\n\ttype TrackFecUnavailable,\n\tcatalogTrackFecUnavailable,\n\tcatalogTrackDeliveryMode,\n\tcatalogGroupDurationMs,\n\tcatalogKeyframeCadenceMs,\n\tcatalogFecMediaUnitsPerSecond,\n\ttype GroupDurationRendition,\n\tresolveCatalogTrackGroupDurationMs,\n\tjoinedRepairSymbolCount,\n\tFEC_BLOCK_PROFILES,\n\tisFecBlockProfile,\n\tparseFecBlockProfile,\n\ttype FecBlockProfile,\n\tresolveRepairLayers,\n\tcatalogRepairTarget,\n\tDEFAULT_REPAIR_PRIORITY,\n\tMAX_ENCODING_SYMBOL_ID,\n\tMAX_RAPTORQ_SOURCE_SYMBOLS,\n\tMAX_REPAIR_SYMBOLS,\n\tREPAIR_PRIORITY_MAX,\n\tREPAIR_PRIORITY_MIN,\n\ttype RepairLayerCatalog,\n\ttype RepairLayerParams,\n\ttype RepairLayersResolution,\n\ttype RepairOverlayParams,\n\t// FEC catalog binding, draft-ramadan-moq-fec-catalog-00 array shape (BLO-50171).\n\tvalidateFecCatalog,\n\t// The report the runtime acts on, for hosts that publish it (BLO-55242).\n\truntimeFecCatalogReport,\n\ttype FecCatalogCode,\n\ttype FecCatalogInstance,\n\ttype FecCatalogIssue,\n\ttype FecCatalogOutcome,\n\ttype FecCatalogReceiver,\n\ttype FecCatalogReport,\n} from \"./catalog-fec-params.js\";\n\n// Typed FEC state (active with counters, or inactive with a reason) shared by\n// every player, resolved from catalog, transport policy, bridge and\n// subscription state rather than from counters.\nexport {\n\tFEC_INACTIVE_REASONS,\n\tcatalogDeclaresFec,\n\tresolveFecState,\n\ttype FecActiveState,\n\ttype FecInactiveReason,\n\ttype FecInactiveState,\n\ttype FecState,\n\ttype FecStateEvidence,\n\ttype FecTransportPolicy,\n\ttype NoFecCounters,\n} from \"./fec-state.js\";\n\n// Which mmtp sibling to subscribe (mmt-02 4.3.1), one implementation for every\n// player; vectors in test-vectors/moq/mmtp-mode-selection.json.\nexport {\n\tselectMmtpMode,\n\ttype MmtpModeChoice,\n\ttype MmtpModeOverride,\n\ttype MmtpModeReason,\n\ttype MmtpModeSelection,\n\ttype MmtpModeSelectionInput,\n} from \"./mmtp-mode-selection.js\";\n\n// In-band AL-FEC for one MMTP asset over a MoQT subscription, for a player\n// that owns its own parser (the Shaka MSF MMTP packaging).\nexport {\n\tMmtpFecSession,\n\ttype MmtpFecSessionCatalogFec,\n\ttype MmtpFecSessionConfig,\n\ttype MmtpFecSessionDecoder,\n\ttype MmtpFecSessionDecoderConstructor,\n\ttype MmtpFecSessionMessageConfig,\n\ttype MmtpFecSessionMessageUpdate,\n\ttype MmtpFecSessionMixedPathStats,\n\ttype MmtpFecSessionPath,\n\ttype MmtpFecSessionPathCounts,\n\ttype MmtpFecSessionStats,\n} from \"./mmtp-fec-session.js\";\n// MoQ repair-layer subscriptions by measured loss (BLO-35456)\nexport {\n\tRepairLayerSubscriptions,\n\ttype MoqRepairDelivery,\n\ttype RepairLayerSource,\n\ttype RepairLayerSubscriptionsOptions,\n\ttype RepairLayerSubscriptionsSnapshot,\n\ttype RepairTrackSubscription,\n} from \"./repair-layer-subscriptions.js\";\n\nexport {\n\tcatalogAmtNetworkSource,\n\tcatalogAtsc3NetworkSource,\n\tDEFAULT_AMT_RELAY_PORT,\n\ttype AmtNetworkSource,\n\ttype Atsc3NetworkSource,\n\ttype CatalogNetworkSource,\n} from \"./catalog-network-source.js\";\n\n// D-28 shared repair-fetch shell (per-SBN on-demand MoQ FEC repair backfill)\nexport {\n wireRepairFetch,\n repairFetchSubscriberPriority,\n SOURCE_MEDIA_PRIORITY_MAX,\n type ResolveRepairTarget,\n type RepairTarget,\n type RepairFetchHost,\n type RepairFetchPriority,\n type RepairFetchRequest,\n type RepairFetchTransport,\n type RepairRangeFetchRequest,\n type RepairRangeFetchTransport,\n type RepairDeadlineBound,\n type RepairPriorityReason,\n type RepairSendMeasurement,\n type RepairSkipReason,\n type RepairStopReason,\n type RepairSubscribeCallback,\n type WireRepairFetchOptions,\n} from './repair-fetch.js'\n// MoQ repair group ids for iso-ssbg1-v1 blocks (BLO-35597): the 62-bit\n// wrap-epoch-extended SS_Start and the repair FETCH range for a lost SS_ID.\nexport {\n extSsStart,\n extendSsId,\n repairFetchRange,\n type RepairFetchRange,\n} from '@blockcast/mmt-fec'\nexport { DeliveryGapEstimator } from './delivery-gap.js'\n"],
5
+ "mappings": ";AAWA;AAAA,EAOE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAKP;AAAA,EAGE;AAAA,EACA;AAAA,OAEK;AAGP,SAAS,8BAA8B;AAUvC;AAAA,EAWE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAOA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP;AAAA,EAUE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAGA;AAAA,EAEA;AAAA,OACK;AAIP;AAAA,EACE;AAAA,OAiBK;AAMP;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EAGE;AAAA,EACA;AA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;AAGP;AAAA,EACE;AAAA,EACA;AAAA,OAQK;AAEP;AAAA,EACC;AAAA,EACA;AAAA,EAOA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAMA;AAAA,EAEA;AAAA,OAOM;AAKP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAQM;AAIP;AAAA,EACC;AAAA,OAMM;AAIP;AAAA,EACC;AAAA,OAWM;AAEP;AAAA,EACC;AAAA,OAMM;AAEP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAIM;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAgBK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,4BAA4B;",
6
6
  "names": []
7
7
  }
@@ -32,16 +32,28 @@ export type IsoRepairPlacement<T> = {
32
32
  readonly lostSsId: number;
33
33
  };
34
34
  }
35
- /** Not a block this stream can use; the repair symbol is dropped. */
35
+ /**
36
+ * Not a block this stream can use; the repair symbol is dropped. `ofSpan` is
37
+ * set when the repair stated only the first block of that repair-less span:
38
+ * the span holds more than one block, so no single repair group completes it.
39
+ */
36
40
  | {
37
41
  readonly status: 'conflict' | 'overlap' | 'stale' | 'ahead';
38
42
  readonly reason: string;
43
+ readonly ofSpan?: IsoBlockRange;
39
44
  };
40
45
  /**
41
46
  * Retention: the locator is never without one. Every call that can grow it
42
47
  * (`hold`, `placeRepair`) retires, behind the position it just saw, every
43
48
  * block, span and held source more than `retentionBlocks` blocks back, by the
44
- * one ISO horizon metric (`isoBlocksBehindLowerBound`). A block is measured
49
+ * one ISO horizon metric (`isoBlocksBehindLowerBound`). A held source stays
50
+ * while a pending hole holding it does: the hole's repair FETCH may still
51
+ * state its block, and closing the hole places it, so the span it leaves
52
+ * counts every source it received (BLO-52085). A pending hole the horizon
53
+ * passes stops being pending (its blocks can no longer be stated, and the
54
+ * release gate no longer waits for it), but keeps its sources until its
55
+ * owner closes it (`takeExpiredHoles`), so it still fails as the span it
56
+ * is. A block is measured
45
57
  * from its last SS_ID, so it stays while any SS_ID of it is inside the
46
58
  * horizon: a repair-less span has no length bound, and one measured from its
47
59
  * start could be retired the moment it is created, before the sources it
@@ -104,8 +116,16 @@ export declare class IsoBlockLocator<T> {
104
116
  block: IsoBlockRange;
105
117
  esi: number;
106
118
  } | null;
107
- /** Number of pending holes. */
119
+ /** Number of holes not closed yet, pending or past the horizon. */
108
120
  get holeCount(): number;
121
+ /**
122
+ * The pending holes the horizon has passed since the last call, in the
123
+ * order it passed them. Each is no longer pending: no repair states a block
124
+ * in it (that repair is `stale`, as for a span the horizon retired) and the
125
+ * release gate does not wait for it. Its owner must close it
126
+ * (`closeHolesWithin`), which turns it into a span that is not kept here.
127
+ */
128
+ takeExpiredHoles(): IsoBlockRange[];
109
129
  /** The stated block (never a span) ending exactly at `end`. */
110
130
  blockEndingAt(end: number): IsoBlockRange | undefined;
111
131
  /** The known block or span starting exactly at `start`. */
@@ -125,12 +145,30 @@ export declare class IsoBlockLocator<T> {
125
145
  hold(ssId: number, payload: T): boolean;
126
146
  /** Whether `ssId` is held unplaced. */
127
147
  isHeld(ssId: number): boolean;
148
+ /** The payload held unplaced for `ssId`, if any. */
149
+ heldSource(ssId: number): T | undefined;
150
+ /**
151
+ * The SS_IDs strictly between `a` and `b` that no repair has delimited a
152
+ * block of yet: those from the coverage end on, or all of them before the
153
+ * first repair. `missing` is the highest of them no source is held for;
154
+ * absent, every one of them arrived (C.5.2: SS_IDs are consecutive). Null
155
+ * when none lies past coverage. `flagged` is whether a source held among
156
+ * them satisfies `flag` (a RAP fragment, say): the held packets read as
157
+ * fec-multicast-00 Block Classification item 1 reads bounding packets.
158
+ */
159
+ undelimitedBetween(a: number, b: number, flag?: (payload: T) => boolean): {
160
+ start: number;
161
+ missing?: number;
162
+ flagged: boolean;
163
+ } | null;
128
164
  /**
129
165
  * Apply one repair symbol's `(SS_Start, SSB_length)`. The first repair of a
130
166
  * block states its range and places every held source in it; later repair
131
- * symbols of the same block change nothing. A range that contradicts a
132
- * known block (a different length, or an overlap with another block or a
133
- * span) fails closed: the repair symbol is dropped and no block changes.
167
+ * symbols of the same block change nothing. A repair whose range is exactly
168
+ * a repair-less span states that span's one block. A range that contradicts
169
+ * a known block (a different length, or an overlap with another block or
170
+ * with part of a span) fails closed: the repair symbol is dropped and no
171
+ * block changes.
134
172
  * A newly stated block retires behind its SS_Start (see the class note).
135
173
  * A block so far past `newest` that stating it would retire the position
136
174
  * `newest` is refused as `ahead`. When `newest` is a placed block's SS_Start
@@ -144,19 +182,23 @@ export declare class IsoBlockLocator<T> {
144
182
  */
145
183
  placeRepair(start: number, length: number): IsoRepairPlacement<T>;
146
184
  /**
147
- * Turn every pending hole inside `[start, start + length)` into a
148
- * repair-less span, claiming its held sources: its range FETCH ended, so
149
- * nothing more will state its blocks. Returns the spans, in SS_ID order.
185
+ * Turn every hole inside `[start, start + length)` into a repair-less span,
186
+ * claiming its held sources: its range FETCH ended, so nothing more will
187
+ * state its blocks. A hole the horizon passed (`takeExpiredHoles`) leaves a
188
+ * span that is not kept among the blocks, as the horizon would retire it at
189
+ * once; only `locate` finds it, until the next retirement, so its sources
190
+ * can be fed. Returns the spans, in SS_ID order.
150
191
  */
151
192
  closeHolesWithin(start: number, length: number): {
152
193
  block: IsoBlockRange;
153
194
  placed: IsoPlacedSource<T>[];
154
195
  }[];
155
196
  /**
156
- * Retire every block and span whose last SS_ID, and every held source,
157
- * lies more than `retentionBlocks` blocks behind `position`, with the shared
158
- * lower-bound metric (`isoBlocksBehindLowerBound`) every ISO interleave
159
- * horizon uses. Returns the retired block starts.
197
+ * Retire every block and span whose last SS_ID, and every held source
198
+ * outside a hole, lies more than `retentionBlocks` blocks behind
199
+ * `position`, with the shared lower-bound metric (`isoBlocksBehindLowerBound`)
200
+ * every ISO interleave horizon uses; a pending hole so far behind expires
201
+ * (`takeExpiredHoles`). Returns the retired block starts.
160
202
  */
161
203
  retireBehind(position: number): number[];
162
204
  /** Forget everything (publisher restart, track reset). */
@@ -1 +1 @@
1
- {"version":3,"file":"iso-block-locator.d.ts","sourceRoot":"","sources":["../src/iso-block-locator.ts"],"names":[],"mappings":"AA6BA,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACvB;AAED,kEAAkE;AAClE,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;CACpB;AAED,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAC5B;IACE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9C,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;KAAE,CAAA;IACjG;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAC7E;AACH,qEAAqE;GACn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I,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAIvC;;;;;;;;OAQG;IACH,kBAAkB,CAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,GAC7B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAgB/D;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC;IAsGjE;;;;;;;OAOG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,aAAa,CAAC;QAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAA;KAAE,EAAE;IA8BzG;;;;;;OAMG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAkCxC,0DAA0D;IAC1D,KAAK,IAAI,IAAI;CAsBd"}
@@ -55,6 +55,40 @@ var RUNTIME_FEC_RECEIVER = Object.freeze({
55
55
  overlays: true
56
56
  });
57
57
 
58
+ // ../mmt-base/dist/mmtp-siblings.js
59
+ var MMTP_MODES = Object.freeze(["mfu", "mfu-datagram"]);
60
+ var MMTP_SIBLING_HARD_FIELDS = Object.freeze([
61
+ "namespace",
62
+ "timescale",
63
+ "presentationAnchorTicks",
64
+ "groupDuration"
65
+ ]);
66
+ var MMTP_SIBLING_RENDITION_FIELDS = Object.freeze([
67
+ "codec",
68
+ "width",
69
+ "height",
70
+ "framerate",
71
+ "bitrate",
72
+ "samplerate",
73
+ "channelConfig",
74
+ "lang"
75
+ ]);
76
+ var MMTP_SIBLING_SOFT_FIELDS = Object.freeze([
77
+ "initRef",
78
+ "keyframeIntervalMs",
79
+ "keyframeIntervalTicks",
80
+ "isLive",
81
+ "altGroup"
82
+ ]);
83
+
84
+ // ../mmt-base/dist/datagram-leg-size.js
85
+ var DATAGRAM_LEG_UDP_FLOOR = 1200;
86
+ var DATAGRAM_LEG_QUIC_WT_FRAMING = 48;
87
+ var DATAGRAM_LEG_OBJECT_HEADER = 13;
88
+ var DATAGRAM_LEG_RELAY_ROOM = 16;
89
+ var DATAGRAM_LEG_DATAGRAM_MAX = DATAGRAM_LEG_UDP_FLOOR - DATAGRAM_LEG_QUIC_WT_FRAMING;
90
+ var DATAGRAM_LEG_BODY_MAX = DATAGRAM_LEG_DATAGRAM_MAX - DATAGRAM_LEG_OBJECT_HEADER - DATAGRAM_LEG_RELAY_ROOM;
91
+
58
92
  // src/iso-block-locator.ts
59
93
  var IsoBlockLocator = class _IsoBlockLocator {
60
94
  /**
@@ -71,6 +105,15 @@ var IsoBlockLocator = class _IsoBlockLocator {
71
105
  this.#heldEvicted = 0;
72
106
  /** Pending holes (see `deferIncompleteGaps`): unstated, sources still held. */
73
107
  this.#holes = [];
108
+ /** Holes the horizon passed while pending: sources held until closed. */
109
+ this.#expired = [];
110
+ /** Of `#expired`, those `takeExpiredHoles` has not handed out yet. */
111
+ this.#newlyExpired = [];
112
+ /**
113
+ * Spans closed from expired holes: behind the horizon, so kept only for
114
+ * `locate` while their sources are fed, until the next retirement.
115
+ */
116
+ this.#closedBehind = [];
74
117
  /**
75
118
  * Keep a gap that is missing a source as a pending hole rather than a span,
76
119
  * so a repair FETCHed for it (draft-ramadan-moq-fec §7.5) can still state
@@ -94,6 +137,9 @@ var IsoBlockLocator = class _IsoBlockLocator {
94
137
  #newest;
95
138
  #newestSource;
96
139
  #holes;
140
+ #expired;
141
+ #newlyExpired;
142
+ #closedBehind;
97
143
  static #checkedRetention(retentionBlocks) {
98
144
  if (!Number.isSafeInteger(retentionBlocks) || retentionBlocks <= 0) {
99
145
  throw new Error(
@@ -163,17 +209,29 @@ var IsoBlockLocator = class _IsoBlockLocator {
163
209
  }
164
210
  /** The known block or span containing `ssId`, with its ESI. */
165
211
  locate(ssId) {
166
- for (let i = this.#blocks.length - 1; i >= 0; i--) {
167
- const block = this.#blocks[i];
168
- if (isoBlockContains(block.start, block.length, ssId)) {
169
- return { block, esi: serial32Distance(block.start, ssId) };
212
+ for (const blocks of [this.#blocks, this.#closedBehind]) {
213
+ for (let i = blocks.length - 1; i >= 0; i--) {
214
+ const block = blocks[i];
215
+ if (isoBlockContains(block.start, block.length, ssId)) {
216
+ return { block, esi: serial32Distance(block.start, ssId) };
217
+ }
170
218
  }
171
219
  }
172
220
  return null;
173
221
  }
174
- /** Number of pending holes. */
222
+ /** Number of holes not closed yet, pending or past the horizon. */
175
223
  get holeCount() {
176
- return this.#holes.length;
224
+ return this.#holes.length + this.#expired.length;
225
+ }
226
+ /**
227
+ * The pending holes the horizon has passed since the last call, in the
228
+ * order it passed them. Each is no longer pending: no repair states a block
229
+ * in it (that repair is `stale`, as for a span the horizon retired) and the
230
+ * release gate does not wait for it. Its owner must close it
231
+ * (`closeHolesWithin`), which turns it into a span that is not kept here.
232
+ */
233
+ takeExpiredHoles() {
234
+ return this.#newlyExpired.splice(0);
177
235
  }
178
236
  /** The stated block (never a span) ending exactly at `end`. */
179
237
  blockEndingAt(end) {
@@ -226,12 +284,42 @@ var IsoBlockLocator = class _IsoBlockLocator {
226
284
  isHeld(ssId) {
227
285
  return this.#held.has(ssId);
228
286
  }
287
+ /** The payload held unplaced for `ssId`, if any. */
288
+ heldSource(ssId) {
289
+ return this.#held.get(ssId);
290
+ }
291
+ /**
292
+ * The SS_IDs strictly between `a` and `b` that no repair has delimited a
293
+ * block of yet: those from the coverage end on, or all of them before the
294
+ * first repair. `missing` is the highest of them no source is held for;
295
+ * absent, every one of them arrived (C.5.2: SS_IDs are consecutive). Null
296
+ * when none lies past coverage. `flagged` is whether a source held among
297
+ * them satisfies `flag` (a RAP fragment, say): the held packets read as
298
+ * fec-multicast-00 Block Classification item 1 reads bounding packets.
299
+ */
300
+ undelimitedBetween(a, b, flag) {
301
+ if (!serial32Precedes(a, b) || serial32Distance(a, b) <= 1) return null;
302
+ const first = a + 1 >>> 0;
303
+ const end = this.#coverageEnd;
304
+ const start = end !== void 0 && serial32Precedes(first, end) ? end : first;
305
+ if (!serial32Precedes(start, b)) return null;
306
+ const length = serial32Distance(start, b);
307
+ const missing = this.#highestMissing(start, length);
308
+ let flagged = false;
309
+ for (let i = 0; flag !== void 0 && !flagged && i < length; i++) {
310
+ const payload = this.#held.get(serial32Add(start, i));
311
+ flagged = payload !== void 0 && flag(payload);
312
+ }
313
+ return missing === void 0 ? { start, flagged } : { start, missing, flagged };
314
+ }
229
315
  /**
230
316
  * Apply one repair symbol's `(SS_Start, SSB_length)`. The first repair of a
231
317
  * block states its range and places every held source in it; later repair
232
- * symbols of the same block change nothing. A range that contradicts a
233
- * known block (a different length, or an overlap with another block or a
234
- * span) fails closed: the repair symbol is dropped and no block changes.
318
+ * symbols of the same block change nothing. A repair whose range is exactly
319
+ * a repair-less span states that span's one block. A range that contradicts
320
+ * a known block (a different length, or an overlap with another block or
321
+ * with part of a span) fails closed: the repair symbol is dropped and no
322
+ * block changes.
235
323
  * A newly stated block retires behind its SS_Start (see the class note).
236
324
  * A block so far past `newest` that stating it would retire the position
237
325
  * `newest` is refused as `ahead`. When `newest` is a placed block's SS_Start
@@ -250,7 +338,16 @@ var IsoBlockLocator = class _IsoBlockLocator {
250
338
  const known = this.blockAt(start);
251
339
  if (known !== void 0) {
252
340
  if (known.span) {
253
- return { status: "overlap", reason: `repair block ${start}+${length} falls inside a repair-less span` };
341
+ if (known.length === length) {
342
+ const block2 = { start, length, span: false };
343
+ this.#blocks[this.#blocks.indexOf(known)] = block2;
344
+ return { status: "placed", block: block2, placed: [] };
345
+ }
346
+ return length < known.length ? {
347
+ status: "overlap",
348
+ reason: `repair block ${start}+${length} is only the first block of repair-less span ${known.start}+${known.length}`,
349
+ ofSpan: known
350
+ } : { status: "overlap", reason: `repair block ${start}+${length} runs past repair-less span ${known.start}+${known.length}` };
254
351
  }
255
352
  if (known.length !== length) {
256
353
  return {
@@ -318,18 +415,28 @@ var IsoBlockLocator = class _IsoBlockLocator {
318
415
  return span === void 0 ? { status: "placed", block, placed } : { status: "placed", block, placed, span };
319
416
  }
320
417
  /**
321
- * Turn every pending hole inside `[start, start + length)` into a
322
- * repair-less span, claiming its held sources: its range FETCH ended, so
323
- * nothing more will state its blocks. Returns the spans, in SS_ID order.
418
+ * Turn every hole inside `[start, start + length)` into a repair-less span,
419
+ * claiming its held sources: its range FETCH ended, so nothing more will
420
+ * state its blocks. A hole the horizon passed (`takeExpiredHoles`) leaves a
421
+ * span that is not kept among the blocks, as the horizon would retire it at
422
+ * once; only `locate` finds it, until the next retirement, so its sources
423
+ * can be fed. Returns the spans, in SS_ID order.
324
424
  */
325
425
  closeHolesWithin(start, length) {
326
426
  const closed = [];
327
- for (const hole of [...this.#holes]) {
328
- if (!isoBlockContains(start, length, hole.start)) continue;
329
- this.#holes.splice(this.#holes.indexOf(hole), 1);
330
- const spanBlock = { start: hole.start, length: hole.length, span: true };
331
- closed.push({ block: spanBlock, placed: this.#claim(spanBlock) });
332
- this.#blocks.push(spanBlock);
427
+ for (const holes of [this.#holes, this.#expired]) {
428
+ for (const hole of [...holes]) {
429
+ if (!isoBlockContains(start, length, hole.start)) continue;
430
+ holes.splice(holes.indexOf(hole), 1);
431
+ const spanBlock = { start: hole.start, length: hole.length, span: true };
432
+ closed.push({ block: spanBlock, placed: this.#claim(spanBlock) });
433
+ if (holes === this.#holes) {
434
+ this.#blocks.push(spanBlock);
435
+ } else {
436
+ this.#closedBehind.push(spanBlock);
437
+ if (this.#newlyExpired.includes(hole)) this.#newlyExpired.splice(this.#newlyExpired.indexOf(hole), 1);
438
+ }
439
+ }
333
440
  }
334
441
  return closed.sort((x, y) => serial32Distance(start, x.block.start) - serial32Distance(start, y.block.start));
335
442
  }
@@ -343,15 +450,17 @@ var IsoBlockLocator = class _IsoBlockLocator {
343
450
  return void 0;
344
451
  }
345
452
  /**
346
- * Retire every block and span whose last SS_ID, and every held source,
347
- * lies more than `retentionBlocks` blocks behind `position`, with the shared
348
- * lower-bound metric (`isoBlocksBehindLowerBound`) every ISO interleave
349
- * horizon uses. Returns the retired block starts.
453
+ * Retire every block and span whose last SS_ID, and every held source
454
+ * outside a hole, lies more than `retentionBlocks` blocks behind
455
+ * `position`, with the shared lower-bound metric (`isoBlocksBehindLowerBound`)
456
+ * every ISO interleave horizon uses; a pending hole so far behind expires
457
+ * (`takeExpiredHoles`). Returns the retired block starts.
350
458
  */
351
459
  retireBehind(position) {
352
460
  this.observe(position);
353
461
  const horizon = this.#retentionBlocks;
354
462
  const retired = [];
463
+ this.#closedBehind.length = 0;
355
464
  for (let i = this.#blocks.length - 1; i >= 0; i--) {
356
465
  const block = this.#blocks[i];
357
466
  const last = serial32Add(block.start, block.length - 1);
@@ -363,10 +472,15 @@ var IsoBlockLocator = class _IsoBlockLocator {
363
472
  for (let i = this.#holes.length - 1; i >= 0; i--) {
364
473
  const hole = this.#holes[i];
365
474
  const last = serial32Add(hole.start, hole.length - 1);
366
- if (isoBlocksBehindLowerBound(last, position, this.#kMax) > horizon) this.#holes.splice(i, 1);
475
+ if (isoBlocksBehindLowerBound(last, position, this.#kMax) <= horizon) continue;
476
+ this.#holes.splice(i, 1);
477
+ this.#expired.push(hole);
478
+ this.#newlyExpired.push(hole);
367
479
  }
368
480
  for (const ssId of [...this.#held.keys()]) {
369
- if (isoBlocksBehindLowerBound(ssId, position, this.#kMax) > horizon) this.#held.delete(ssId);
481
+ if (isoBlocksBehindLowerBound(ssId, position, this.#kMax) > horizon && !this.#holes.some((hole) => isoBlockContains(hole.start, hole.length, ssId)) && !this.#expired.some((hole) => isoBlockContains(hole.start, hole.length, ssId))) {
482
+ this.#held.delete(ssId);
483
+ }
370
484
  }
371
485
  return retired;
372
486
  }
@@ -374,6 +488,9 @@ var IsoBlockLocator = class _IsoBlockLocator {
374
488
  reset() {
375
489
  this.#blocks.length = 0;
376
490
  this.#holes.length = 0;
491
+ this.#expired.length = 0;
492
+ this.#newlyExpired.length = 0;
493
+ this.#closedBehind.length = 0;
377
494
  this.#held.clear();
378
495
  this.#coverageEnd = void 0;
379
496
  this.#newest = void 0;