unarr/internal/library/mediainfo
Deivid Soto c82826bf68
Some checks failed
CI / Test (push) Failing after 6m21s
CI / Build (push) Successful in 1m34s
CI / Build-1 (push) Successful in 2m0s
CI / Build-2 (push) Successful in 1m33s
CI / Build-3 (push) Successful in 1m38s
CI / Build-4 (push) Successful in 1m35s
CI / Build-5 (push) Successful in 1m38s
CI / Lint (push) Failing after 2m34s
CI / Coverage (push) Failing after 2m44s
CI / Vet (push) Successful in 2m3s
fix(trickplay): stop scan-time sprite generation from saturating the host
Trickplay sprite generation (one full-decode ffmpeg pass per file) could pin a
machine: multiple agents on the same library decoded the same 4K file at once, no
CPU throttling, and crashed/restarted agents orphaned ffmpeg to init (it ran the
full 45-min decode to completion). Stacked orphans spiked a box to load ~140.

- Single-flight lock: O_CREATE|O_EXCL .lock in the shared sidecar dir so two
  agents watching the same library never decode the same file twice (stale locks
  reclaimed after a TTL). Returns ErrTrickplayInProgress → prewarm skips, not fail.
- Load gate: defer the heavy decode until 1-min load ≤ max(ratio×NumCPU, 1.5),
  capped at 15 min so it throttles without ever becoming a permanent off-switch on
  busy / small hosts. New knob library.prewarm_max_load_ratio (default 0.7).
- Concurrency: trickSem caps trickplay to ONE decode at a time per agent.
- CPU priority: setLowCPUPriority (nice 19) alongside the existing idle ionice.
- No orphans: hardenCmd sets Setpgid + Pdeathsig=SIGKILL, with runtime.LockOSThread
  around the child so the kernel kills ffmpeg exactly when the agent dies (and not
  spuriously — golang/go#27505).

Tests: single-flight/stale-reclaim, load-gate immediate/cancel, and an e2e
Pdeathsig orphan-kill check.
2026-06-04 08:25:00 +02:00
..
ffmpeg.go feat(stream)!: retire WebRTC, HLS-only, bump 0.9.4 2026-05-26 18:04:35 +02:00
ffmpeg_download.go feat(mediainfo): ResolveFFmpeg + DownloadFFmpeg mirroring ffprobe pattern 2026-05-06 09:49:32 +02:00
ffmpeg_test.go feat(mediainfo): ResolveFFmpeg + DownloadFFmpeg mirroring ffprobe pattern 2026-05-06 09:49:32 +02:00
ffprobe.go feat(library): detect corrupt/incomplete files during scan 2026-06-02 19:42:00 +02:00
ffprobe_download.go fix(library): use native arm64 ffprobe on Apple Silicon (osx-arm-64) 2026-04-09 09:26:10 +02:00
ffprobe_download_test.go test(mediainfo): add ffprobe download unit tests 2026-04-06 10:16:27 +02:00
ffprobe_test.go feat(library): detect corrupt/incomplete files during scan 2026-06-02 19:42:00 +02:00
harden_linux_test.go fix(trickplay): stop scan-time sprite generation from saturating the host 2026-06-04 08:25:00 +02:00
ioprio_linux.go fix(trickplay): stop scan-time sprite generation from saturating the host 2026-06-04 08:25:00 +02:00
ioprio_other.go fix(trickplay): stop scan-time sprite generation from saturating the host 2026-06-04 08:25:00 +02:00
lang.go feat: add migrate command, media server detection, and debrid auto-config 2026-03-29 16:54:32 +02:00
lang_test.go feat: add migrate command, media server detection, and debrid auto-config 2026-03-29 16:54:32 +02:00
sidecar.go fix(stream): retry thumbnail extraction with output-seek on seek-index failure 2026-06-03 18:55:49 +02:00
sidecar_test.go fix(stream): /critico review fixes for the sidecar cache 2026-06-02 13:46:07 +02:00
trickplay.go fix(trickplay): stop scan-time sprite generation from saturating the host 2026-06-04 08:25:00 +02:00
trickplay_lock_test.go fix(trickplay): stop scan-time sprite generation from saturating the host 2026-06-04 08:25:00 +02:00
trickplay_test.go feat(trickplay): scan-time montage sprite for the web scrubber 2026-06-03 20:30:29 +02:00
types.go feat(library): detect corrupt/incomplete files during scan 2026-06-02 19:42:00 +02:00