unarr/internal/engine
Deivid Soto afd5856d0d feat(vaapi): hybrid CPU-scale + hwupload encode path (QW2, 0.9.14)
Closes QW2. Validated against the dev box's AMD Raphael iGPU
(/dev/dri/renderD128, radeonsi/mesa 25.2.8). The "proper" full-GPU
path via scale_vaapi triggers a known mesa 25 + Raphael bug
("Cannot allocate memory" per session start, encode still succeeds
but logs are spammy) — hybrid CPU scale → format=nv12 → hwupload
→ h264_vaapi encode delivers GPU surfaces to the encoder without
poking the broken scaler.

Three concrete changes in buildHLSFFmpegArgsAt:
  1. New `case "h264_vaapi"` adds `-vaapi_device /dev/dri/renderD128`.
     Multi-GPU hosts (this dev box has NVIDIA on renderD129 + AMD on
     renderD128) need it so the encoder doesn't bind to a non-VAAPI
     render node — without it the encoder fell back to NULL device
     in manual smoke testing.
  2. Filter chain branches on codec: VAAPI uses
     `scale=…,format=nv12,hwupload` while libx264 / NVENC / QSV
     keep the existing `scale=…,format=yuv420p,setparams=…` shape.
     The setparams color metadata block is dropped on VAAPI because
     VAAPI surfaces don't expose VUI fields and the encoder writes
     its own.
  3. Two new unit tests lock the argv shape so a future refactor
     doesn't accidentally merge the paths back together:
     TestBuildHLSFFmpegArgsVAAPI asserts the new flags + the
     ABSENCE of scale_vaapi; TestBuildHLSFFmpegArgsLibx264NoRegression
     verifies the software path keeps yuv420p + setparams + has
     none of the VAAPI extras.

Manual ffmpeg validation on the dev box:
  hybrid encode of 5 s 4K → 720p: 0.66 s wall, 472 % CPU, 268 KB
  output — no errors logged. scale_vaapi variant in comparison
  spammed "Cannot allocate memory" while emitting valid output.
2026-05-27 15:45:55 +02:00
..
debrid.go feat(sync): replace WS+DO transport with unified HTTP sync 2026-04-08 18:50:59 +02:00
debrid_test.go chore: rename module from torrentclaw-cli to unarr 2026-03-30 13:06:07 +02:00
hls.go feat(vaapi): hybrid CPU-scale + hwupload encode path (QW2, 0.9.14) 2026-05-27 15:45:55 +02:00
hls_cache.go feat(hls): persistent fMP4 segment cache + integrity + stats (0.9.7) 2026-05-26 23:39:02 +02:00
hls_cache_smoke_test.go feat(hls): persistent fMP4 segment cache + integrity + stats (0.9.7) 2026-05-26 23:39:02 +02:00
hls_cache_test.go feat(hls): persistent fMP4 segment cache + integrity + stats (0.9.7) 2026-05-26 23:39:02 +02:00
hls_test.go feat(hls): pre-segmentación delantada — 2 s segments + async session start (0.9.10) 2026-05-27 11:36:41 +02:00
hwaccel.go feat(hls): faster first-start — probe cache + tighter encoder presets (0.9.9) 2026-05-27 10:09:42 +02:00
hwaccel_test.go refactor(hls): critico-driven hardening of fase 3.2 2026-05-27 11:15:44 +02:00
manager.go feat(sync): replace WS+DO transport with unified HTTP sync 2026-04-08 18:50:59 +02:00
manager_integration_test.go test: add comprehensive test suite for engine, agent and cmd packages 2026-04-08 23:36:00 +02:00
manager_test.go fix(ci): fix lint errors and pin CI to Go 1.25 2026-03-31 22:15:12 +02:00
method.go feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
method_test.go feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +02:00
notify.go feat: improve daemon resilience, streaming, and usenet downloads 2026-03-28 21:36:12 +01:00
notify_test.go feat: improve daemon resilience, streaming, and usenet downloads 2026-03-28 21:36:12 +01:00
organize.go feat(organize): use server metadata for file organization and subtitle handling 2026-04-05 23:36:01 +02:00
organize_expand_test.go feat(organize): use server metadata for file organization and subtitle handling 2026-04-05 23:36:01 +02:00
organize_test.go feat: improve daemon resilience, streaming, and usenet downloads 2026-03-28 21:36:12 +01:00
probe.go feat(hls): faster first-start — probe cache + tighter encoder presets (0.9.9) 2026-05-27 10:09:42 +02:00
probe_cache.go refactor(hls): critico-driven hardening of fase 3.2 2026-05-27 11:15:44 +02:00
probe_cache_test.go refactor(hls): critico-driven hardening of fase 3.2 2026-05-27 11:15:44 +02:00
probe_test.go feat(stream): pion-based WebRTC byte streamer for browser playback 2026-05-06 23:12:38 +02:00
progress.go feat(sync): replace WS+DO transport with unified HTTP sync 2026-04-08 18:50:59 +02:00
progress_test.go fix(ci): fix lint errors and pin CI to Go 1.25 2026-03-31 22:15:12 +02:00
resolve.go feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
resolve_test.go feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
safepath.go feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
safepath_test.go feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
sockopt_unix.go fix(stream): use platform-specific socket options for Windows cross-compilation 2026-04-07 19:18:13 +02:00
sockopt_windows.go fix(stream): use platform-specific socket options for Windows cross-compilation 2026-04-07 19:18:13 +02:00
stream.go fix(stream): fix black screen on remote/Tailscale streaming 2026-04-09 16:15:41 +02:00
stream_player.go fix(security): CORS allowlist, URL scheme guard, state perms, ZIP slip, mirror docs 2026-05-15 18:48:59 +02:00
stream_server.go fix(security): CORS allowlist, URL scheme guard, state perms, ZIP slip, mirror docs 2026-05-15 18:48:59 +02:00
stream_server_extra_test.go test(coverage): raise engine+agent coverage above 50% 2026-05-12 11:21:59 +02:00
stream_server_test.go fix(security): CORS allowlist, URL scheme guard, state perms, ZIP slip, mirror docs 2026-05-15 18:48:59 +02:00
stream_source.go feat(stream)!: retire WebRTC, HLS-only, bump 0.9.4 2026-05-26 18:04:35 +02:00
stream_source_test.go test(coverage): raise engine+agent coverage above 50% 2026-05-12 11:21:59 +02:00
stream_test.go fix(stream): fix black screen on remote/Tailscale streaming 2026-04-09 16:15:41 +02:00
task.go fix(engine): truncate errorMessage before reporting status 2026-05-23 15:34:58 +02:00
task_test.go fix(lint): use default:none to disable errcheck, fix all gofmt and exhaustive 2026-03-31 00:29:16 +02:00
torrent.go feat(stream)!: retire WebRTC, HLS-only, bump 0.9.4 2026-05-26 18:04:35 +02:00
torrent_test.go test: add comprehensive test suite for engine, agent and cmd packages 2026-04-08 23:36:00 +02:00
transcode_quality.go feat(stream)!: retire WebRTC, HLS-only, bump 0.9.4 2026-05-26 18:04:35 +02:00
transcoder.go feat(stream)!: retire WebRTC, HLS-only, bump 0.9.4 2026-05-26 18:04:35 +02:00
transcoder_test.go test(coverage): raise engine+agent coverage above 50% 2026-05-12 11:21:59 +02:00
upnp.go fix: resolve deadlock, data races and path traversal vulnerabilities 2026-04-08 23:36:18 +02:00
upnp_debug_test.go feat(stream): add NAT-PMP port mapping for remote downloads 2026-04-06 10:09:07 +02:00
upnp_live_test.go feat(stream): add NAT-PMP port mapping for remote downloads 2026-04-06 10:09:07 +02:00
upnp_test.go feat(stream): add NAT-PMP port mapping for remote downloads 2026-04-06 10:09:07 +02:00
usenet.go fix: resolve deadlock, data races and path traversal vulnerabilities 2026-04-08 23:36:18 +02:00
usenet_test.go test(coverage): raise engine+agent coverage above 50% 2026-05-12 11:21:59 +02:00
vaapi_args_test.go feat(vaapi): hybrid CPU-scale + hwupload encode path (QW2, 0.9.14) 2026-05-27 15:45:55 +02:00
validate.go fix(cors): allow play from .to / staging / onion mirrors 2026-05-27 10:06:54 +02:00
verify.go feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
verify_test.go feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
watch_reporter.go feat(stream): report duration and position in watch progress 2026-04-07 23:29:00 +02:00
watch_reporter_test.go fix(security): UPnP opt-in, bounded SSE reader, signed self-update 2026-05-15 17:29:22 +02:00