Skip to content

fix(playback): decode on the CPU when the GPU decoder rejects the source - #4057

Merged
Quick104 merged 12 commits into
Silo-Server:mainfrom
blurbery:fix/cuda-startup-software-decode
Nov 13, 2026
Merged

Quick104 merged 12 commits into
Silo-Server:mainfrom
blurbery:fix/cuda-startup-software-decode

Conversation

@blurbery

@blurbery blurbery commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #4030
Validation tasks: unblocks #1172 C2

Other clients: N/A (no client-visible change)

With Hardware acceleration set to NVENC, every HEVC transcode fails on an NVIDIA card whose decoder can't take HEVC, such as a GTX 970. FFmpeg exits with Hardware is lacking required capabilities, and the startup retry runs the same -hwaccel cuda command again, so playback ends with transcode_start_failed. Auto already recovers by decoding on the CPU and encoding on the GPU, but the explicit settings never try that.

This change makes the startup retry recognise that decoder error and decode on the CPU instead. NVENC keeps encoding when it can, and software is the last step.

It covers local v3 starts, transcode node starts and download preparation. It leaves #4030 open because Jellyfin-compatible starts with an explicit backend start once without waiting for a manifest, so they never reach a retry and still fail the same way. Node reconstructs have the same gap.

Approach

When FFmpeg's stderr contains Hardware is lacking required capabilities, the retry builds a fallback from the same AutoTranscodePipeline stages Auto uses after its first one: CPU decode with the configured hardware encoder, then CPU decode and encode. Reusing the pipeline means the mixed stage keeps NVENC (the same hwupload graph Auto runs) and still has a software step if the upload fails. The fallback has its own cache, so an explicit setting never changes what Auto remembers for a file.

The fallback only applies to a hardware backend whose attempt decoded on the GPU, and never to a tone-map recipe or copied video. Any other early exit keeps the existing retry. Download preparation walks the same two stages, but moves on to software only when the CPU-decode attempt failed before writing any output. FFmpeg writes the container header only once every encoder has opened, so an attempt with output got past hardware startup, and a later failure such as a full disk doesn't cost a second full encode.

The marker is the only decoder message matched. It's the one NVDEC prints when the card has no decoder for the codec, profile or bit depth. I left out the generic Failed setup for format cuda line because other CUDA init failures print it too. The check reads FFmpeg's whole retained stderr (the 64 KiB tail buffer) and marks the startup error with ErrHardwareDecodeUnsupported, so it doesn't depend on the 500-byte excerpt the error message keeps.

A ready-gated node start under an explicit hardware backend can now run up to three attempts, so the API server gives those starts the same deadline as Auto (one manifest wait per attempt). This also covers the existing VideoToolbox software retry, which already needed a second wait.

worker-http-protocol.md now describes the node retry and the deadline.

Validation

  • go test ./internal/playback/ -run 'TestStartReadyTranscode|TestStartReconstructTranscode|TestWaitForGenerationManifest' -count=1: passes. The new table case fails on main: the decoder rejection is retried with the same GPU decode and never reaches software. One row puts the rejection after 600 bytes of earlier output.
  • go test ./internal/api/handlers/ -run 'TestPrepareLocalTransportV3|TestRemotePlaybackTransportTimeout' -count=1: passes. The new case drives the reported v3 path with a fake FFmpeg that prints the NVDEC error, and fails on main.
  • go test ./internal/playback/ -run TestPrepareFileRetriesRejectedDecodeOnCPU -count=1: passes. A fake FFmpeg rejects the CUDA decode. The download moves on to libx264 when the CPU-decode attempt dies without output, and stops when it fails after writing output. Two existing prepare-file tests (TestPrepareFileRetriesVideoToolboxFailureInSoftware, TestPrepareFileDoesNotDropHardwareToneMapGraphOnSoftwareRetry) fail on my Mac with and without this change, so CI on Linux is the check for those.
  • go build ./internal/api/handlers/, go vet ./internal/playback/, gofmt -l: clean.
  • Full Go gate and lint: left to CI on this pull request.
  • Not tested on real hardware. I don't have an NVIDIA card without HEVC decode.

Evidence

No capture on real hardware: I don't have a GPU that reproduces this. The reporter's logs on #4030 show Auto's CPU-decode stage playing the same file on a GTX 970 with NVENC, and that's the path this change now takes with an explicit NVENC setting.

FFmpeg arguments Silo builds for the same v3 local start (H.264 720p target, Hardware acceleration = NVENC), from the handler test's fake FFmpeg that prints Hardware is lacking required capabilities for any -hwaccel cuda command. Trimmed to the decode, encoder and filter arguments.

Before (main at 0387303):

RESULT: transcode_start_failed
ATTEMPT 1: -hwaccel cuda -hwaccel_output_format cuda -noautorotate ... -c:v h264_nvenc ... -vf scale_cuda=w=-2:h=720:format=nv12
ATTEMPT 2: -hwaccel cuda -hwaccel_output_format cuda -noautorotate ... -c:v h264_nvenc ... -vf scale_cuda=w=-2:h=720:format=nv12

After (this branch):

RESULT: ready
ATTEMPT 1: -hwaccel cuda -hwaccel_output_format cuda -noautorotate ... -c:v h264_nvenc ... -vf scale_cuda=w=-2:h=720:format=nv12
ATTEMPT 2: -init_hw_device cuda=cu -filter_hw_device cu ... -c:v h264_nvenc ... -vf format=nv12,hwupload,scale_cuda=w=-2:h=720:format=nv12

Risks

  • A start that hits this error now runs up to three FFmpeg processes instead of two. The decoder rejection exits in under a second in the reporter's logs, so the extra attempts cost little.
  • The longer deadline means an unresponsive node holding an explicit hardware start fails over after about 95 seconds instead of 35, the same as an Auto start.
  • On a host with two different NVIDIA cards in hw_device, a decoder rejection used to retry on the other card. It now decodes on the CPU and still encodes on NVENC, so it plays at a higher CPU cost.
  • Every start on an affected card still makes one failed GPU-decode attempt first. Probing decode per codec would avoid that and is a bigger change.
  • A reconstruct of a session that recovered this way re-resolves from live config and the recipe card's CPU-decode flag, so it encodes with libx264 rather than NVENC. Before this change those sessions never started.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or how I checked a change nobody sees.

AI Disclosure

  • Harness: Claude Code (Claude desktop app, Code tab)
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted. AI-assisted with Claude Opus. I directed the task and designed the work.
  • Adversarial review: a separate Claude Opus subagent reviewed the diff for correctness: retry-loop invariants, cache side effects, exclusions, lock and error handling in the v3 branch, startup deadlines, and whether the stderr excerpt keeps the marker. It found no bugs and two risks: the shared node deadline and hosts with two different NVIDIA cards. I corrected the comments and doc that claimed the retry would fail on every device, and listed the multi-GPU case above. Review bots then raised the node deadline, the prepare path stopping before software or retrying after a late failure (first with a time limit, then with the written-output check), classification from the stderr excerpt, and a goconst finding, and those are fixed here.

Note

Retry playback transcodes on CPU decode when a hardware decoder rejects the source

  • When FFmpeg's hardware decoder rejects a video source, the pipeline now retries with CPU decoding while keeping the configured hardware encoder, then falls back to software encoding only if the retry fails before writing output.
  • Adds ErrHardwareDecodeUnsupported and classifyFFmpegFailure in transcode_startup.go to detect the decoder-rejection marker in retained FFmpeg stderr, plus NewSoftwareDecodeRetryPipeline to build the retry sequence.
  • Applies the retry in local startup (playback_v3.go), prepared-file encoding (prepare_file.go), and the startup coordinator in transcode_startup.go.
  • RequireReady remote starts with an explicit hardware backend (not auto/none, not video-copy) now get the multi-attempt readiness timeout via remoteHardwareRetryPossibleV3 in playback_transport.go.
  • Risk: requests with tone mapping, video copy, or already-software decoding are excluded from the retry; check NewSoftwareDecodeRetryPipeline eligibility gates and the legacyDecodeRetryPipeline policy gate if a path should retry but does not.

Macroscope summarized 0dbc356.

With an explicit hardware backend, a transcode whose FFmpeg exits with
"Hardware is lacking required capabilities" (NVDEC without HEVC on a
Maxwell GTX 970, for example) retried the identical command, so every
HEVC transcode on that card failed. The startup retry now recognises the
decoder rejection and walks CPU decode with the hardware encoder, then
full software, the same order hw_accel=auto already takes.

This covers the v3 local start, transcode node starts and download
preparation. Other early exits keep the existing retry.

Related issue: Silo-Server#4030
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Startup now detects eligible hardware-decoder rejection errors and retries with CPU video decoding. File preparation and local transport startup use the retry pipeline. Required-ready starts can receive extended readiness timeouts, as reflected in tests and protocol documentation.

Changes: Hardware decoder rejection fallback

Layer / File(s) Summary
Retry eligibility and startup policy
internal/playback/transcode_startup.go, internal/playback/transcode.go, internal/playback/gpudetect.go, internal/playback/transcode_startup_test.go
Startup logic classifies hardware-decoder rejection errors and builds a CPU-decode retry pipeline for eligible hardware configurations. The retry can retain NVENC encoding before a later software-acceleration attempt. Tests cover retry-policy limits and errors that do not trigger the fallback.
File and local transport retry paths
internal/playback/prepare_file.go, internal/playback/prepare_file_test.go, internal/api/handlers/playback_v3.go, internal/api/handlers/playback_v3_test.go
File preparation and local transport startup can retry with CPU decoding. File-preparation tests cover partial-output handling and software-encoding fallback. Local transport tests cover explicit NVENC and automatic-mode startup paths.
Readiness deadlines and protocol
internal/api/handlers/playback_transport.go, internal/api/handlers/playback_v3_test.go, docs/architecture/worker-http-protocol.md
Required-ready explicit-hardware video starts receive an extended timeout when retry attempts are possible. Tests and protocol documentation describe readiness wait limits.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant PrepareFile
  participant TranscodeStartup
  participant FFmpeg
  PrepareFile->>TranscodeStartup: Start transcode attempt
  TranscodeStartup->>FFmpeg: Run hardware-decode attempt
  FFmpeg-->>TranscodeStartup: Return decoder-rejection error
  TranscodeStartup->>FFmpeg: Retry with CPU video decoding
  FFmpeg-->>PrepareFile: Return retry result
Loading

Suggested reviewers: quick104, rhainland

Merge Risk: Minimal · up to 0dbc3

Playback and downloads that fail because a GPU decoder rejects the source now retry with CPU decoding. A tester confirmed this on real hardware, and no remaining merge-blocking risk was found.

Security architecture risk: Low · up to 0dbc3

Retries are bounded and preserve existing session identity, output handling, and cleanup. No introduced access-control weakness was established. The main residual risk is additional CPU work and longer startup waits on shared workers; production capacity and real hardware behavior were not validated.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed resource exposure is additional CPU decoding or encoding on the existing execution host for eligible media jobs. Retries retain the same source, session, and output destination. Concurrent eligible jobs can increase shared-worker load; bounded attempt count does not itself bound total CPU consumption.

Trust Boundaries and Controls

  • observed — The remote start continues through the existing signed API-to-worker request. The fallback is selected inside that execution flow rather than introducing another remote endpoint or authority-bearing request.

Resilience and Maintainability Implications

  • observed — Retries remain inside existing session-lifecycle publication controls: local preparation retains commit and rollback handling, while worker replacement uses a separate directory when an existing session is present and publishes only after startup succeeds.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: when the GPU decoder rejects a source, the transcode decodes on the CPU. The changeset adds a CPU-decode retry for FFmpeg's 'Hardware is lacking required capabilities'…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is specific and related to the changeset. It explains the problem: explicit NVENC HEVC transcodes fail on GPUs whose decoder lacks HEVC support, with FFmpeg reporting 'Hardware is lack…
Full details: Title check

Explanation

The title names the main change: when the GPU decoder rejects a source, the transcode decodes on the CPU. The changeset adds a CPU-decode retry for FFmpeg's 'Hardware is lacking required capabilities' startup failure, which matches the title.

Full details: Description check

Explanation

The description is specific and related to the changeset. It explains the problem: explicit NVENC HEVC transcodes fail on GPUs whose decoder lacks HEVC support, with FFmpeg reporting 'Hardware is lacking required capabilities'. It describes the approach: a CPU-decode retry that keeps the hardware encoder, then software encoding as a last step, covering local v3 starts, transcode node starts, and download preparation. It also lists the files and deadline changes, risks, validation commands, and the known gaps left open (Jellyfin-compatible starts and node reconstructs). This matches the raw summary's changes in playback_v3.go, prepare_file.go, transcode_startup.go, playback_transport.go, and the docs.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4f4ae9b1-0edc-43d3-aedc-71f2bf7acfda
Commits

Reviewing files that changed from the base of the PR and between 0dcc7b2 and 0dbc356.

Files selected for processing: 4

  • docs/architecture/worker-http-protocol.md
  • internal/playback/gpudetect.go
  • internal/playback/prepare_file.go
  • internal/playback/prepare_file_test.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 13, 2026
@silo-kody

silo-kody Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@blurbery
blurbery marked this pull request as ready for review November 13, 2026 05:31
@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish labels Nov 13, 2026
Comment thread internal/playback/transcode_startup.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 493a766b-3ff3-4712-8309-4eeb26081241
Commits

Reviewing files that changed from the base of the PR and between 0387303 and fc4008b.

Files selected for processing: 7

  • docs/architecture/worker-http-protocol.md
  • internal/api/handlers/playback_v3.go
  • internal/api/handlers/playback_v3_test.go
  • internal/playback/prepare_file.go
  • internal/playback/transcode.go
  • internal/playback/transcode_startup.go
  • internal/playback/transcode_startup_test.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread internal/playback/prepare_file.go Resolved
Comment thread internal/playback/transcode_startup.go Resolved
A ready-gated node start under an explicit hardware backend can now run
the CPU-decode and software attempts after a decoder rejection, and the
VideoToolbox software retry already needed a second wait. Size the API
server's deadline for those starts to two manifest waits.

Related issue: Silo-Server#4030
…tderr

The startup error keeps only the first 500 bytes of FFmpeg's stderr, so
earlier output could hide the decoder rejection from the retry. Mark the
error from the retained stderr instead and test a rejection that follows
longer output.

Related issue: Silo-Server#4030
Download preparation now walks the same CPU decode with the hardware
encoder, then software, as a playback start.

Related issue: Silo-Server#4030
@silo-kody

silo-kody Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Comment thread internal/playback/prepare_file.go Resolved
@blurbery

Copy link
Copy Markdown
Contributor Author

@aske2002 this should fix the GTX 970 failure from #4030. I don't have a card that reproduces it, so could you test the branch on yours when you get a chance? There's no prebuilt image for pull requests, so it needs building from blurbery/silo-server branch fix/cuda-startup-software-decode.

To check it:

  1. Set Hardware acceleration to NVENC (not Auto).
  2. Play an HEVC file that has to transcode, for example with the Chromecast H.264/AAC profile you used before.
  3. Playback should start. The log should show hardware decoder rejected the source during startup; retrying with CPU decoding, then an FFmpeg command with -init_hw_device cuda and h264_nvenc and no -hwaccel cuda.
  4. If you can, prepare a download of the same file too. It should finish with the same CPU decode and NVENC encode.

Thanks for the detailed report, the logs made this easy to track down.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5d8de029-b659-4ad9-ae18-551b8cf6b656
Commits

Reviewing files that changed from the base of the PR and between fc4008b and 36a4c28.

Files selected for processing: 7

  • docs/architecture/worker-http-protocol.md
  • internal/api/handlers/playback_transport.go
  • internal/api/handlers/playback_v3_test.go
  • internal/playback/prepare_file.go
  • internal/playback/transcode.go
  • internal/playback/transcode_startup.go
  • internal/playback/transcode_startup_test.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Each attempt after a decoder rejection may use its whole readiness wait
before it exits, so give a ready-gated explicit hardware start the same
deadline as hw_accel=auto. Add playback.HWAccelAuto for the new check.

Related issue: Silo-Server#4030
A CPU-decode attempt that failed after encoding for a while (a full disk,
for example) would fail a software encode too, so only an attempt that
died while starting moves on to software.

Related issue: Silo-Server#4030
@silo-kody

silo-kody Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Comment thread internal/playback/prepare_file.go Resolved
…sed time

A slow input probe could push a genuine startup failure past the startup
window and skip the software attempt. FFmpeg writes the container header
only once every encoder has opened, so move on to software only when the
CPU-decode attempt wrote no output.

Related issue: Silo-Server#4030
@silo-kody

silo-kody Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@aske2002

Copy link
Copy Markdown

Tested on my GTX 970 and it works, for both playback and a download.

Build: upstream image build-2222 (main 0387303) with a binary from main plus this branch at 284e8ca (merged with #4059 and #4060). Hardware acceleration was set to NVENC, not Auto.

Playback. I cast The Odyssey (HEVC Main 10, AC3 5.1) with an H.264/AAC stereo profile, starting at 1:05:48. It started playing:

  1. The first attempt with -hwaccel cuda exited after about 0.7 s with Hardware is lacking required capabilities.
  2. Then the log showed hardware decoder rejected the source during startup; retrying with CPU decoding.
  3. The retry used -init_hw_device cuda=cu -filter_hw_device cu, -c:v h264_nvenc and -vf format=nv12,hwupload,scale_cuda=w=-2:h=1080:format=nv12, with no -hwaccel cuda. The session was ready about 2 s later.

Download. I prepared a converted download of the same file at the 720p preset:

  1. The first attempt failed the same way.
  2. Then the log showed prepared encode failed in the hardware decoder; retrying with CPU decoding.
  3. The retry ran -init_hw_device cuda=cu, -c:v hevc_nvenc -b:v 1800k and -vf format=nv12,hwupload,scale_cuda=w=-2:h=720:format=nv12.
  4. It finished in about 39 minutes. ffprobe shows a complete file: HEVC 1280x720 with stereo AAC and two mov_text tracks, 10355.7 s long (2.6 GB). That's the full runtime.

No software-encode step was needed in either case.

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer review of 284e8ca. The fix is sound: on main, explicit NVENC reruns the same -hwaccel cuda command (local v3) or doesn't retry at all (node), and all four new or changed tests fail on main for that reason. Three findings below, none blocking. I'm fixing all three on this branch. A summary comment follows.

🤖 Claude Code (claude-opus-5-5)

Comment thread internal/playback/prepare_file.go Resolved
Comment thread internal/playback/transcode.go Resolved
Quick104 and others added 2 commits November 13, 2026 11:30
When a download's CPU-decode attempt failed and the retry moved on to
libx264, the NVENC/QSV/VAAPI workload reservation stayed counted for the
whole software encode, skewing the device's active count and QSV/VAAPI
device selection.

Related issue: Silo-Server#4030

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ately

On main the node didn't retry an explicit NVENC start at all, so the walk
replaces a failed start, not a repeated command, and it applies only to a
GPU-decoded video transcode without tone mapping. Derive hwAccelAuto from
HWAccelAuto so the package has one value for "auto".

Related issue: Silo-Server#4030

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104

Copy link
Copy Markdown
Contributor

Maintainer review summary

Reviewed head: 0dbc356 (the author's 284e8ca plus two review commits)

The defect is real and this fixes it. On main, explicit NVENC doesn't recover from Hardware is lacking required capabilities. StartupRetryHWAccel returns the same accel for NVENC, so the local v3 start reruns the identical -hwaccel cuda command and the node's AccelChange policy doesn't retry at all. The four new or changed tests (TestStartReadyTranscodeRetriesDecoderRejectionOnCPU, TestPrepareFileRetriesRejectedDecodeOnCPU, TestPrepareLocalTransportV3NVENCRetriesRejectedDecodeOnCPU, TestRemotePlaybackTransportTimeoutCoversAutoFallbackAttempts) all fail on main for that reason and pass here. On main, the v3 handler test logs the same CUDA command twice before transcode_start_failed.

Addressed in this review

  • f28dbb8: when a download moved on to libx264, it kept its GPU workload reservation for the whole software encode. It's released now. The test assertion fails on 284e8ca.
  • 0dbc356: worker-http-protocol.md said the node used to "repeat the command". It used to fail the start. The text now names the conditions the retry applies under. hwAccelAuto now derives from the new HWAccelAuto.

Left for the maintainers to settle (all disclosed in the PR's Risks section)

Validated features: unblocks #1172 C2 (NVENC forced, auto and disabled modes, plus software fallback on unsupported hardware; not run yet). I found no passed case this changes. The #1177 C3 failover case runs explicit-hardware rehomes into the longer deadline only if its sandbox used an explicit backend. I couldn't confirm the setting and judged it a minor change at most. The board script was unavailable to me, so these cases come from the validation issue bodies.

User manual: unaffected. The playback page doesn't describe how explicit modes fall back, and Activity still shows the hardware encoder after a mixed recovery.

Other clients: N/A. Server-only, no API change.

Cross-provider review: one round on 284e8ca. It found the download reservation issue, fixed above, and nothing else blocking.

Fit: 8/10 · Readiness: 8/10, conditional (assuming CI is green)

🤖 Claude Code (claude-opus-5-5)

@Quick104
Quick104 merged commit 061bbd1 into Silo-Server:main Nov 13, 2026
23 checks passed
Quick104 added a commit that referenced this pull request Nov 13, 2026
…GPU can't decode the source (#4097)

With Hardware acceleration set to an explicit backend, a GPU whose decoder
rejects the source (HEVC on a GTX 970) made FFmpeg exit at startup. #4057
retried on the CPU for starts that wait for a first manifest. Four paths
started FFmpeg without waiting and handed back the exited process:
Jellyfin-compatible local and node starts, and local and node reconstructs.

These paths now wait for the first manifest when the start decodes on the GPU,
and walk the same CPU-decode retry on a decoder rejection. Any other outcome is
returned as before, except that a Jellyfin node start is now sent with
RequireReady.

Related issue: #4030

Co-authored-by: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants