Repository navigation
fix(jellycompat): accept an empty stream index in playback requests - #2970
Conversation
…uests Jellyfin Web 12.1 sends "SubtitleStreamIndex":"" in PlaybackInfo when Play starts from a series page. Jellyfin reads an empty string as an unset nullable number; Silo rejected the request with 400, so the episode never started. Session progress reports share the same decoder.
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. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
Please change the line to Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Quick104
left a comment
There was a problem hiding this comment.
One finding, low severity: the contract doc doesn't describe the new input rule.
docs/jellycompat-api.md (around line 116) tells clients they "must omit SubtitleStreamIndex" to get a fresh automatic subtitle selection. After this change, null, an empty string, or a blank string for SubtitleStreamIndex or AudioStreamIndex gives the same result as leaving the field out, in PlaybackInfo and in /Sessions/Playing* reports, and an explicit 0 or -1 still counts as a choice. A client author who reads the doc today can't tell that "" is accepted, or that it means "unset" and not stream 0. The repository's rules ask for the docs/*-api.md file to change along with the contract. The fix is one sentence in that paragraph.
I'm fixing this in a commit on this branch, so there's no need to change it yourself.
No other findings. The code review covered line-by-line behavior, removed guards, callers, contract and failure handling, plus a separate cross-provider pass. An empty index never reaches stream 0 or Off, an explicit 0 stays distinct from unset, the moved audio-selection code behaves exactly as before, and nothing marshals or stores these request types.
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:
|
Review summaryReviewed head: Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green) Fit: this fixes a real Jellyfin Web 12.1 failure, where pressing Play on a series page shows "Playback Error". It brings Silo in line with how Jellyfin reads an empty nullable number, it changes only the type that both affected request bodies already share, and it adds no new surface. Readiness: an empty or blank index now means "unset" everywhere it is read, and never stream 0 or Off. That holds for PlaybackInfo subtitle and audio selection, Addressed
Left for maintainers: nothing. Other feedback
Validated features: no case recorded as passed is affected. Related PRs: this PR and #2934 touch different hunks of User manual: no change needed. The fix restores expected Jellyfin Web behavior and doesn't change any documented setting or step. Apple/Android: not affected. This is jellycompat input parsing only; the native clients use Review method: three finders (diff and callers; contract and failure; cleanup and conventions), a validation check, and a cross-provider round (gpt-6.1-sol). None found a correctness defect. |
Problem
Related issue: #1246
Validation tasks: unblocks #1246 C1
Pressing Play on a series page in Jellyfin Web 12.1 shows "Playback Error" instead of starting the episode. Jellyfin Web sends
"SubtitleStreamIndex": ""in that PlaybackInfo request. Jellyfin reads an empty string as an unset number, but Silo rejects the whole request with 400Invalid playback request. Playing a movie, or an episode from its own page, works because those requests send a number.This change reads an empty or blank
AudioStreamIndexorSubtitleStreamIndexas unset, the same asnullor leaving the field out. Silo then picks the tracks it would pick for a request without them.Approach
compatIntValuealready accepted a number or a numeric string. It is now a nullable value, so an empty string decodes as "not set" instead of as stream 0. A pointer field can't express that:encoding/jsonallocates the pointer before the decoder runs, so the field would have read as index 0. PlaybackInfo and the/Sessions/Playing*progress reports share this type, so both accept the empty string. A value that is neither a number nor blank still returns 400.The audio-change handling in progress reports moved unchanged into its own method, because the linter flags its nesting once the condition line changes.
Jellyfin's
JsonNullableStructConverterdoes the same for every nullable number ("Required - some clients send an empty string"). This change covers only the two stream indexes, the fields seen arriving empty.docs/jellycompat-api.mdnow states that an empty or blank index counts as an omitted field, and that0is stream 0.Validation
gofmt,go vet,make lint-changed,make lint-router-recoveryand theverify-*targets pass. Web steps not run; no web files changed.make test-gopasses exceptTestPlaybackInfoWithoutStripOrToneMapStillHasNoRouteandTestPlaybackInfoSkipsStripWhenRPUCannotBeStripped, which fail the same way on unchangedmainon this machine (local FFmpeg build).Evidence
Jellyfin Web 12.1, the same series and profile, 10 seconds after pressing Play on the series page.
Evidence: https://evidence.siloserver.org/r/silo-server/pr-2970/
Surface and build: Jellyfin Web 12.1 (installed by Silo), Google Chrome, desktop and phone width. Before is
main; after ismainwith this change and #2934. In Chrome, direct play also needs #2934 (#2879). Without it, the episode now starts loading but stays on the spinner.Risks
None identified. A request that sent an empty index used to fail. It now behaves like a request without the field.
Checklist
AI Disclosure
Note
Accept empty stream index in jellycompat playback and session-report requests
Replaces nullable pointer fields for audio and subtitle stream indexes with a value-based
compatIntValuewrapper that carries its own set flag, so an explicit zero stays distinct from an omitted value. The decoder in handlers_playback.go now accepts numbers, numeric strings, and treats null, empty, and blank strings as unset for both playback-info and session-report requests.HandlePlaybackInfoandbuildPlaybackSourceonly applies a requested index when the wrapper reports the request set one and the index is validhandlePlaybackReportinto a newapplyReportedAudioSelectionhelper0now selects stream zeroMacroscope summarized 90ccda4.