Repository navigation
fix(jellycompat): leave TranscodingUrl off sources the client can direct play - #3104
Conversation
…ect play mediaSourceDTO published a TranscodingUrl on every source that supports transcoding, including sources that also set SupportsDirectPlay or SupportsDirectStream. Jellyfin sets TranscodingUrl only when it chooses to transcode. Swiftfin plays any TranscodingUrl before the direct URL, so it streamed over HLS even for files it could direct play, and the server spent remux or transcode work on every such session. Only a transcode-only source now carries TranscodingUrl and TranscodingContainer. A client whose direct play fails asks for PlaybackInfo again with the direct flags off (Jellyfin Web does) and gets one. Fixes Silo-Server#2981 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Transcoding metadata selection internal/jellycompat/handlers_playback.go, internal/jellycompat/playback_info_source_id_test.go |
The DTO omits TranscodingURL when direct play is supported. Tests check transcoding fields and HLS subprotocol selection across direct-play and direct-stream capability combinations. |
Transcode-only route validation internal/jellycompat/audio_v2_routes_test.go, internal/jellycompat/hevc_routes_test.go, internal/jellycompat/playback_info_source_id_test.go, internal/jellycompat/routing_policy_test.go |
Route tests disable direct play and direct stream before checking audio, HEVC, MPEG-TS, and Dolby Vision routes. Two playback-info test cases also disable direct streaming. A comment identifies direct streaming as a remux. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- Silo-Server/silo-server#2934: Both changes define playback metadata conditions. That PR updates
TranscodingSubProtocol; this PR updatesTranscodingURLbehavior.
Suggested labels: impact: playback
Suggested reviewers: quick104
Merge Risk: 
Minimal · up to e901d
-
The metadata change and associated route tests align with the stated direct-play and transcode-only behavior.
Security architecture risk: 
Minimal · up to e901d
-
The change withholds unnecessary transcoding URLs without expanding media permissions or adding playback routes. Direct-stream-only sources retain their remux fallback. No introduced or worsened security issue was identified; real-client playback compatibility remains unvalidated.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The changed exposure is client route preference for already negotiated media sources, not additional assets, privileges, services, or credentials. The direct-play route was already advertised for these sources.
Trust Boundaries and Controls
- observed — Media routes retain their existing authentication middleware. It accepts credentials or a matching playback-session grant, and also has a pre-existing credentialless static-stream exception tied to a live, recently active negotiation from the same client address. Shared-address clients can reuse that exception for the matching source; this limitation predates the PR and its grant conditions are unchanged.
-
Pre-merge checks: 
3 · 
1
-
Failed checks: 1 warning Passed checks: 3 passed-
Full details: Out of Scope Changes check
-
Explanation
The production change addresses the
PlaybackInfobehavior in [#2981]. The test changes support this objective by separating direct-play-capable sources from transcode-only route cases and by covering the direct-flag combinations. No unrelated change appears in the reviewed diff.
-
Full details: Linked Issues check
-
Explanation
Issue [
#2981] requires noTranscodingUrlfor a source that supports direct play or direct stream.mediaSourceDTOomits the URL only when!source.SupportsDirectPlay. A direct-stream-only source still receivesTranscodingUrlandTranscodingContainer. The new table-driven test explicitly expects that result, so the implementation and test do not meet the linked issue requirement.Resolution
Update
mediaSourceDTOso direct-stream-capable sources also omitTranscodingUrlandTranscodingContainer. Update the direct-flag test to require omission for direct-stream-only sources. Preserve the required transcode-only route behavior.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
|
The jellycompat Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
The Evidence section says there is no user-visible change, but this fix is intended to switch Swiftfin from HLS to direct playback. Please replace that statement with before-and-after PlaybackInfo excerpts for the same direct-capable source, showing the changed transcode fields, and a real Swiftfin playback result confirming the selected playback method. Name the builds used and redact stream URLs and tokens; the description currently says Swiftfin was not tested. |
There was a problem hiding this comment.
Actionable comments posted: 1

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:
464cf06d-be46-4ec9-9bba-7bf14473f25c
Files selected for processing: 5-
internal/jellycompat/audio_v2_routes_test.gointernal/jellycompat/handlers_playback.gointernal/jellycompat/hevc_routes_test.gointernal/jellycompat/playback_info_source_id_test.gointernal/jellycompat/routing_policy_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.
-
Quick104
left a comment
There was a problem hiding this comment.
Reviewed e6b77b75d65071aead2aeccb722e88fe42484093. One P2 remains: removing the HLS URL from direct-stream-only sources breaks a supported Swiftfin custom-profile configuration. The inline finding gives the trigger and repair.
The new DTO test passes on head and fails in its three direct-source cases against the merge-base implementation. Independent verification also negotiated the affected Swiftfin profile and confirmed that its resulting static request receives original MKV bytes on head, while base retains the HLS URL. No physical Swiftfin or AVPlayer playback was run; the default Swiftfin profile usually avoids this particular negotiation.
Validated features: update the line to Validation tasks: changes #1246 C1. The recorded 23 October playback pass is an agent runtime result on a local integration build, with human acceptance pending; the changed PlaybackInfo contract warrants revalidation. C2’s access checks are unchanged, and the 113 other recovered passed cells do not reach this DTO. Full project enumeration was unavailable because the token lacks read:project; live issue bodies and comments supplied the limited coverage. No validation records were changed.
The native API and first-party clients are unaffected. No manual correction was identified for the intended direct-play fix.
Fit: 9/10 · Readiness: 5/10 — not ready (assuming CI is green).
Reviewed with Codex and gpt-6.1-sol at xhigh, using independent review and verification passes. No product code was changed.
Swiftfin builds a Static=true URL when a source has no TranscodingUrl, so a direct-stream-only source (an MKV under an MP4 direct-play profile) fetched the original file instead of the remux. Only a source the client can direct play leaves TranscodingUrl off. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
…o fix/jellycompat-no-transcodingurl-on-direct-2981
Resolves the routing policy test conflict with #3104 in favour of this branch: the case sets EnableTranscoding=false, so no TranscodingUrl is expected alongside the progressive remux. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem
Closes #2981
Related issue: N/A
Validation tasks: none
Jellyfin-compat PlaybackInfo published a
TranscodingUrlon every media source that supports transcoding, including sources that also allow direct play or direct stream. Jellyfin sets it only when it chooses to transcode. Swiftfin plays anyTranscodingUrlbefore the direct URL, so it streamed over HLS even for files it could direct play, and the server did remux or transcode work for each of those sessions.Approach
mediaSourceDTOnow leavesTranscodingUrlandTranscodingContaineroff any source the client can direct play. A direct-stream-only source keeps them: Swiftfin with a Custom → Replace profile (MP4/H.264/AAC direct play, TS transcoding) negotiates exactly that for an MKV, and without aTranscodingUrlit builds its ownStatic=trueURL and gets the original MKV instead of the remux.TranscodingSubProtocolis unchanged:hlsonly on a transcode-only source. A client whose direct play fails asks for PlaybackInfo again with the direct flags off (Jellyfin Web does) and gets a transcode-only source. Tests that built a direct-play source and expected a URL now build a transcode-only one, and a new test covers the four direct-flag combinations.Validation
go test ./internal/jellycompat/: passes exceptTestPlaybackInfoWithoutStripOrToneMapStillHasNoRouteandTestPlaybackInfoSkipsStripWhenRPUCannotBeStripped, which fail the same way on a clean main in my local environment.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3104/
POST /Items/{id}/PlaybackInfoon a running server, before (latest, build-1905,e9c649b8c) and after (the same image, database and library with this branch'ssilobinary,e901deba2), using the profile the reviewer described for Swiftfin's Custom → Replace mode (direct play MP4 H.264/AAC, transcoding TS over HLS):TranscodingUrlbeforeThere is no Swiftfin playback result: I have no Apple device, so the change from HLS to direct play in that client is inferred from Swiftfin's source (it plays any
TranscodingUrlfirst), not observed.Risks
Clients that fall back to
TranscodingUrlafter a failed direct play of a direct-play source without requesting PlaybackInfo again would no longer find one. Jellyfin Web requests it again, and Jellyfin itself behaves this way, so I expect no regression, but other clients are unverified.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Omit
TranscodingURLfrom direct-play-capable sources in jellycompatThe media-source DTO builder in handlers_playback.go now emits
TranscodingURLandTranscodingContaineronly when the source supports transcoding and cannot direct play. Direct-stream-only and transcode-only sources keep the HLS route, since Swiftfin needs it for the direct-stream remux case.TranscodingURL,TranscodingContainer, andTranscodingSubProtocolin each case.TranscodingURLfrom a direct-play source now see it empty; seePlaybackHandler.mediaSourceDTOin handlers_playback.go.Macroscope summarized e901deb.