carlos / platform Public

media-three-hour-sdr

Raises media conversion's length limit for SDR video at or below 1080p from 2 hours to 3, so LiveKit Cloud recordings (up to 3 hours per file) convert in one job. Paul asked for it on 2026-11-25. HDR up to 1080p stays at 75 minutes and video above 1080p at 30. The deadline (50 minutes), the grant (one hour), the classes and the 40 GiB size limit are unchanged. Not for merge yet: waiting on the caller.

The fit (spec amendment A9)

Plan 1's rule, D = (40 min - t_start - S/B) x v rounded down to 15 minutes, with the spike's t_start 31.7 s, B 95.3 MB/s and S 40 GiB:

  • at 5.85x (the 1-hour 1080p SDR run): 187.0 minutes, which rounds down to 180. 3 hours fit, with no step to spare.
  • at 5.42x (the 30 GiB, 1 h 43 min SDR run): 173.2 minutes, which rounds down to 165. That misses the rule by one step.

The whole run at 5.42x, timed from the deadline container's start, is the download (450.7 s), the probe at its 60 s bound, the encode (1,992.6 s), the upload at the output ceiling (3.55 GB, 37.2 s) and 30 s for the small outputs. That comes to 42.8 minutes against the 50-minute deadline, and 44.9 minutes from the grant's mint against its hour. The binding term is the 40 GiB size limit: at 5.42x the rule holds for sources up to 33.3 GiB.

Billing

A long video still reserves at weight 2, so 3 hours hold 360 allowance minutes while the job runs. A done 3-hour SDR job is charged 180. The fit, the reservation and the door's 402 needed no code change.

Changes

  • internal/media/limits.go: video_max defaults to 3h.
  • Tests: the refusal 1 ms over 3 hours for SDR, HDR at 75 minutes and above 1080p at 30, all through the dispatched payload and the codec's probe check. Also the refusal message naming 3 hours, the 360-minute reservation and the 180-minute charge, an allowance boundary at limits 180 and 179, and a fit guard (TestDefaultMaximumsFitTheLongClass) that fails for a default the engine can't convert.
  • Simulation: I8 gains grant checks. A row's grant and deadline stay within its class's figures, a done source is no longer than its grant, and each Run's payload carries the row's grant and the deployment's maximums. There are five checker witnesses and a 3-hour witness.
  • Spec A9, the §7.1 table, §5.1 and plan 2's defaults.
  • Docs: the media page's limits table, and the LiveKit page (which reached main as edaed836 while this branch was open; merged back in, with the add/add conflict resolved to main's text plus these edits), whose "Not yet supported" item on 2 hours is gone. Luna pass 7 reviewed the copy and its result was applied verbatim.

Review and checks

  • Astra round 1 of 3: READY AFTER FIXES, no P1. Its two P2s (the run's accounting, and the fit test's window) are fixed without another round.
  • Census: clean.
  • Local checks: targeted tests, the 200-seed simulation, the console guard set, docsite, make code-health, make staticcheck and make gitleaks all pass.
  • CI: earlier tips failed only in packages this branch doesn't touch. TestBurstSingleKeyFloodBounded (internal/edge, an allocation count) failed twice, and fails the same way on managed-fleets-2c-plan. TestWorkerRespawnAsksOwnershipAtItsExec (internal/activator, the race step) failed once. internal/edge imports none of the changed packages.

Open

Not verified: a recording LiveKit stops at its own 3-hour limit may report a duration a little over 3 hours, and would then be refused. The page doesn't promise it converts. One real recording settles it.

🤖 Generated with Claude Code

Commits 14
Discussions 0 0 open
Tasks 0/0 done

Discussions

  • No discussions on this branch yet.

Tasks

  • No tasks yet.

Activity