Skip to content

fix(playback): tone-map Dolby Vision Profile 5 through RPU-aware executors - #2267

Merged
Quick104 merged 3 commits into
mainfrom
fix/issue-1999-dv-rpu-tonemap
Oct 11, 2026
Merged

Quick104 merged 3 commits into
mainfrom
fix/issue-1999-dv-rpu-tonemap

Conversation

@Quick104

@Quick104 Quick104 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #1999
Related issue: #704
Validation tasks: none

Dolby Vision Profile 5 files can't be converted for screens without Dolby Vision. A web viewer who plays one gets "This HDR format can't be converted", even though the bundled FFmpeg on the server and its transcode nodes can tone-map it. Titles that also have an SDR version silently play that version instead. Single-file titles don't play at all. The same happens to Dolby Vision files on other profiles whose base layer reports compatibility ID 0.

Silo refuses these sources before asking any executor (hdr_transcode_unsupported), because their base layer only looks right after the Dolby Vision RPU reshapes it; tone-mapped as plain PQ it comes out green and magenta. This change adds a dolby_vision tone-map source kind for them and runs it only on executors that apply the RPU.

Approach

  • tonemap.ResolveSource classifies Profile 5 with an RPU as dolby_vision. Compatibility ID 0 on another profile qualifies only when the stream is tagged PQ, and the node's preflight then requires the decoded frames to carry the PQ transfer and Dolby Vision metadata. An untagged ID 0 base can be plain SDR, and one such file rendered blown out through the RPU path, so those stay refused and keep falling back to an SDR version.
  • Software tonemapx, QSV tonemap_opencl, and NVENC tonemap_cuda run the kind with apply_dovi=1. VAAPI tonemap_vaapi and VideoToolbox can't apply the RPU, so they don't advertise it, and a pool of only those executors still answers hdr_transcode_unsupported. A recipe that pairs the kind with a filter that can't apply the RPU is rejected before FFmpeg starts.
  • The capability probe smoke-tests the kind on the RPU executors only. It isn't part of an executor's complete inventory, so an FFmpeg build that rejects apply_dovi keeps its other kinds cached instead of re-probing every 15 seconds. Any other failure of that smoke, such as a busy device, caches the result for the usual 15-second retry. The probe time budgets grow by one smoke command per device on those executors.
  • A migration adds dolby_vision to the download_artifacts tone-map CHECK constraint, so tone-mapped downloads of these files can be queued. A migrations test now checks that the constraint covers every source kind.
  • Playback planning, jellycompat, and downloads all classify sources through ResolveSource and the advertised capabilities, so they change together. source_kinds and tone_map_source_kind are free-form strings in the node protocol and /api/v2, so the new value needs no contract or client change. A node that doesn't advertise dolby_vision (VAAPI, VideoToolbox, or a node on an older build) is never planned for these sources.

Validation

  • Go: build, gofmt, go vet, make lint-changed, make verify-playback-fixtures, make verify-apiv2-contract, make verify-local-paths, and make verify-case-collisions pass. make test-go passes except TestRunStatsWithRealFFmpeg and TestRunSheetsOpenGOPHEVCWithRealFFmpeg in internal/mediasample, which fail the same way on origin/main with the FFmpeg 6.1 installed locally. Web checks weren't run; the diff has no web changes.
  • New tests cover the classification (Profile 5, ID 0 with and without a PQ tag, missing RPU, legacy rows), the apply_dovi option in each filter graph and its refusal for VAAPI, probe smoke kinds, refused and transient smoke failures, the raised probe budgets, the preflight frame checks, and the constraint's coverage of every source kind. The download-artifact round trip now runs for every kind and is listed in scripts/ci/db-contracts.txt; it needs a migrated database, so it wasn't run locally.
  • On a Silo dev deployment with two Intel Arc QSV transcode nodes (jellyfin-ffmpeg 8.1.3), 16 HDR and Dolby Vision samples were played in Chrome 153 and Firefox 155 at a forced 720p transcode, with GPU tone mapping and again CPU-only, before and after the change. Before, Profile 5 and ID 0 titles failed with hdr_transcode_unsupported or switched to their SDR version. After, Profile 5 and PQ-tagged ID 0 titles play tone-mapped with correct colour on QSV and on the CPU in both browsers. The untagged ID 0 title plays its SDR version as before. HDR10, HDR10+, HLG, AV1, VP9, and Dolby Vision 7, 8.1, and 8.4 results didn't change.
  • After the migration ran on the dev deployment, a 5 Mbps download of a Profile 5 title for an SDR-only device was accepted. Its artifact row froze the dolby_vision kind, and a node encoded it with tonemap_opencl and apply_dovi=1. That insert hits the old constraint without the migration.
  • One single-file Profile 5 title still fails to start because its first audio track is AVS3, which FFmpeg can't decode. With its E-AC-3 track selected it plays tone-mapped. That audio-track problem is separate from this change.
  • NVENC was checked on an RTX 5080 with the same FFmpeg build, outside the dev deployment. The probe advertises dolby_vision for tonemap_cuda, and Silo's NVENC graph on a 4K Profile 5 clip matches the software output; the old apply_dovi=0 graph gives the green and magenta picture.
  • Not exercised on hardware: VAAPI-only and VideoToolbox pools, which keep refusing these sources (unit tests only).

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/issue-1999/

Risks

  • The migration replaces the download_artifacts tone-map CHECK constraint in one transaction. The validating scan runs under that statement's lock, which blocks writes to the table for its duration; the table holds one row per prepared download variant. Down restores the old list as NOT VALID so rows that froze dolby_vision don't block a rollback.

  • Executors that apply the RPU now accept sources they used to refuse. A file tagged PQ with compatibility ID 0 whose base isn't actually PQ would pass both the stream check and the frame check and play with wrong colour; none of the test library's files does this.

  • Profile 5 isn't preflighted. If an executor's decoder couldn't parse a file's RPU, the RPU filters would quietly tone-map the base as plain PQ. Software, VAAPI-to-QSV, and CUDA decode all attached the RPU on the test files; preflighting every Profile 5 start would add its sampling cost to each first play.

  • Capability probes on QSV, NVENC, and software take one more smoke command, so a cold probe can take a few seconds longer. The API's probe budgets were raised to match.

Related problems found while testing are filed separately: #2265 (a stopped transcode can keep running on the node), #2266 (preflight rejections show a retryable generic error), #2268 and #2269 (pre-existing tone-map issues found in review).

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code with its subagents, GitHub CLI, Playwright (headed Chrome and Firefox)
  • Model(s): claude-opus-5-5, claude-sonnet-5-5 (review subagents)
  • Involvement: Fully AI-generated at the maintainer's direction; human review of the diff is pending.
  • Adversarial review: Codex gpt-6.1-sol (xhigh) reviewed 82e14d5fc in the background and found nothing new; it independently reproduced the Dolby Vision smoke-timeout case a review bot reported, which 6e718b185 fixes. Before opening, a multi-agent review (finders, verifiers, and a sweep on claude-opus-5-5 and claude-sonnet-5-5) found the download-artifact constraint gap, a Dolby Vision probe failure cached permanently, a migration that held its lock through validation and a Down that would wedge rows, an untagged compatibility ID 0 base rendering wrong, and stale docs; all are fixed here. Pre-existing issues it found are filed separately.

🤖 Generated with Claude Code

Quick104 and others added 2 commits October 11, 2026 11:16
…utors

Profile 5 and compatibility id 0 sources were refused with
hdr_transcode_unsupported on every client that cannot play Dolby Vision,
although the bundled FFmpeg converts them correctly once the RPU is
applied. They now resolve to a dolby_vision source kind that only
executors able to apply the RPU advertise: software tonemapx, QSV
tonemap_opencl and NVENC tonemap_cuda, each run with apply_dovi=1.
VAAPI and VideoToolbox keep refusing these sources.

The new kind is smoke-tested only on those executors and does not count
toward a complete probe inventory, so builds that refuse apply_dovi keep
their cached capabilities. Compatibility id 0 on profiles other than 5
also requires decoded frames to carry Dolby Vision metadata.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…led DV probes

The download_artifacts tone-map CHECK constraint only listed the five
original source kinds, so a tone-mapped download of a Dolby Vision
Profile 5 file failed at insert. Widen it online and add a migrations
test that the constraint covers every source kind.

A Dolby Vision smoke that fails for a reason other than FFmpeg refusing
apply_dovi no longer caches the kind as unsupported for good; it is
retried after five minutes.

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

silo-kody Bot commented Oct 11, 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 ❌

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T16:07:07.037856Z 6e718b1 New commits
🔒 Security Review ✅ Completed 2026-10-11T16:07:25.099489Z 6e718b1 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2aef0a3d-577a-490e-8685-1ec6fe89d31b


📥 Commits

Reviewing files that changed from the base of the PR and between 82e14d5 and 6e718b1.



📒 Files selected for processing (2)
  • internal/tonemap/probe.go
  • internal/tonemap/probe_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.




📝 Walkthrough
📝 Walkthrough

Walkthrough

The change adds Dolby Vision as a tone-map source for eligible streams. It updates executor capability probes, RPU-aware filters, playback validation, and tone-map recipe persistence. Probe and playback timeout expectations also increase.

Changes

Dolby Vision tone mapping

Layer / File(s) Summary
Source classification and RPU-aware filters
internal/tonemap/tonemap.go, internal/tonemap/tonemap_test.go
The source model recognizes Dolby Vision inputs. Software BT.2390, OpenCL, and CUDA filters enable RPU application for that source kind.
Capability probes and cache behavior
internal/tonemap/probe.go, internal/tonemap/probe_test.go, docs/architecture/playback-protocol-v3.md, internal/api/handlers/playback_v3.go, internal/api/handlers/playback_v3_capability_retry_test.go, internal/api/handlers/playback_v3_test.go
Capability probes test Dolby Vision only when the selected filter can apply an RPU. Unsupported apply_dovi options preserve other source capabilities; other Dolby Vision smoke failures use a five-minute retry TTL. Probe and playback timeout expectations are updated.
Playback planning and RPU validation
internal/playback/protocol_v3_test.go, internal/tonemap/preflight.go, internal/tonemap/preflight_test.go, internal/playback/transcode.go, internal/playback/transcode_args_test.go, docs/architecture/playback-protocol-v3.md
Playback planning classifies supported Profile 5 and compatibility-ID 0 inputs. Preflight requires Dolby Vision metadata and PQ transfer signaling. Transcode validation rejects filters that cannot apply the RPU.
Tone-map recipe persistence
migrations/sql/20261011152954_allow_dolby_vision_download_tone_map.sql, migrations/download_artifact_tone_map_test.go, internal/downloads/artifact_repo_test.go, scripts/ci/db-contracts.txt
The recipe constraint accepts dolby_vision. Tests check migration coverage for all source kinds and artifact recipe round trips.

Priority: ➖ Normal

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

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Playback as Playback planner
  participant Probe as Capability probe
  participant FFmpeg
  participant Preflight
  Playback->>Probe: Read executor capabilities
  Probe->>FFmpeg: Smoke test RPU-capable filter
  FFmpeg-->>Probe: Return smoke result
  Playback->>Preflight: Validate decoded Dolby Vision frame
  Preflight-->>Playback: Accept or reject tone-map source
Loading

Possibly related PRs

  • Silo-Server/silo-server#634: Introduced HDR-to-SDR source classification, capability probing, executor graphs, and recipe persistence, which this change extends for Dolby Vision.
  • Silo-Server/silo-server#745: Changes capability warming and cache refresh behavior that uses the probe settlement and retry state updated here.

Suggested labels: v1

Suggested reviewers: neurekadev



Merge Risk: ⚪ Minimal · up to 6e718

The change adds Dolby Vision tone mapping only on executors that can apply the RPU, and it preserves standard HDR capabilities when the optional smoke test is unsettled. No actionable merge-blocking risk is evident from the supplied review.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check Passed For #1999, the PR adds Dolby Vision Profile 5 and qualifying compatibility-ID-0 classification through ResolveSource. It routes these sources only to RPU-capable software, QSV, and NVENC executors w…
Out of Scope Changes check Passed The changes remain connected to #1999. Probe-budget updates, protocol documentation, preflight validation, migration support, and test changes support Dolby Vision tone mapping, capability advertiseme…
Docstring Coverage Passed Docstring coverage is 86.44% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 59 functions across 14 files.
Title check Passed The title clearly and concisely identifies the main change: enabling Dolby Vision Profile 5 tone mapping through RPU-aware executors.
Description check Passed The description directly explains the problem, implementation, validation, limitations, risks, and evidence for the Dolby Vision tone-mapping changes.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR





🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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 Oct 11, 2026
Comment thread internal/tonemap/probe.go Resolved
A Dolby Vision smoke that hit its own command deadline was treated as a
transient probe failure, so the whole probe errored and the standard
kinds that had already passed were discarded. Classify any failure of
the optional Dolby Vision smoke first while the probe still has time,
so it is retried after five minutes like other unsettled failures.

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

silo-kody Bot commented Oct 11, 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 ❌

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 v1

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[bug] cannot play HDR content

1 participant