Skip to content

fix(tv): list each embedded subtitle track once in the player menu - #1013

Merged
Quick104 merged 3 commits into
Silo-Server:mainfrom
Rhainland:fix/tv-subtitle-menu-duplicate-tracks
Nov 22, 2026
Merged

Quick104 merged 3 commits into
Silo-Server:mainfrom
Rhainland:fix/tv-subtitle-menu-duplicate-tracks

Conversation

@Rhainland

@Rhainland Rhainland commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #744
Validation tasks: changes #324 C3
Paired pull requests (same report): Silo-Server/silo-server#4639, Silo-Server/silo-server#4640, Silo-Server/silo-server#4641, Silo-Server/silo-server#4642, #1010, #1011, #1012, Silo-Server/silo-apple#1237, Silo-Server/AetherEngine#30

Other clients: Apple N/A (the duplicate comes from the Android TV menu listing Media3's own tracks beside the server rows); Roku N/A (same reason); Web N/A (same reason)

On Android TV, the in-player Subtitles menu listed an embedded text track twice when the server delivers its row as a sidecar: once as the server row ("English (SDH) · SRT · Default") and again as the track Media3 finds in the file ("Subtitle 2", or the player's own label). A direct-play MKV with two embedded tracks showed up to four rows (#744).

#744's exact file (two embedded SubRip tracks) no longer shows the duplicate on today's main against a current server, because those rows are now natively switchable, so this pull request links the issue instead of closing it. The duplicate remains for any embedded row the server delivers as a sidecar without making it natively switchable, such as an ASS track on direct play.

Approach

The menu adds every Media3 track that no server row maps to. A row that the player cannot switch to natively resolves only to its own sidecar, so nothing tied the file's track to it. Subtitle rows on an original_http plan now keep the inventory's container track ID as sourceContainerTrackId, whether or not the track is natively switchable. The TV menu treats a Media3 track whose Format.id names that ID as the row itself, so the track is listed once, under the server's label, and a choice saved earlier as that player track checks the row. Server-made streams leave the field unset, since the file's IDs name nothing in them. Only a sidecar row stands for the file's track: an unplayable row, and a burn_in_only row (VobSub or DVB on direct play) whose route is a transcode, keep their track listed separately as the way to show it on the device. Picking the checked row while a saved player-track choice plays keeps that track instead of replanning it. nativeSwitchTrackId now builds on the same helper.

A server or library scan that sends no unique container track ID still lists the duplicate; nothing else ties the track to the row.

Validation

  • ./scripts/test-check-build-supply-chain.sh and ./scripts/check-build-supply-chain.sh: pass.
  • ./gradlew testDebugUnitTest: pass, including a table test of the TV menu options (sidecar rows, merged sources, unnamed tracks, missing IDs, unplayable rows, and the checked row for a saved player-track choice).
  • Review fixes (52532f6, on top of a merge of main that resolves the conflict with fix(player): play an ASS pick that the server burns in on an HLS transcode #1010): the menu test's new burn_in_only case and its re-pick check each failed on 3fcdc21 and pass now; all 261 Android TV unit tests, the android-shared and shared unit tests, and :androidTvApp:lintDebug pass.
  • :android-shared:lintDebug :androidApp:lintDebug :androidTvApp:lintDebug :androidApp:lintVitalRelease :androidTvApp:lintVitalRelease: pass.
  • :androidApp:assembleDebug :androidTvApp:assembleDebug: pass.
  • Android TV emulator, Subtitles menu: on an earlier main, a direct-play synthetic MKV with an ASS track the server delivers as a sidecar ("H264 MoreFonts (2018)") listed the extra "Subtitle 2" row; this branch lists the issue's synthetic "Dual SRT (2020)" file once per track. On today's main against a current server I could not reproduce the duplicate for either file (Dual SRT's rows are now natively switchable, and MoreFonts plays through a transcode on this emulator), so the captures are not a same-file pair.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-android/pr-1013/

Surface and build: Android TV emulator (Android 14, 1080p), debug builds of main (Nov 19 and today) and this branch. The captures are not a same-file pair; the page says why. The phone, tablet and foldable are unaffected: the change is in the TV menu builder, and the new field is only read there.

Risks

None identified. Older servers that send no container track ID keep today's listing.

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
  • Tool(s): Claude Code, Codex CLI (review only)
  • Model(s): claude-opus-5-5 (author and reviewer); gpt-6.2-sol and gpt-6.2-astra via Codex CLI, Claude Fable 5.2 (reviewers)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: two rounds of a four-model review (Sol, Astra, Opus, Fable) on the branch diff. Fixed: a choice saved as the now-hidden player track left no row checked; an unplayable row hid the only playable copy of its track; trimmed the menu test. Dismissed: the duplicate that remains without a container track ID (nothing ties the track to the row), and losing the player-track fallback when a sidecar fails (the issue asks for one row per track).

Note

Fix duplicate embedded subtitle tracks in TV player menu

  • Embedded subtitle tracks appeared twice in the TV player menu: once from the server rows and once from the local player tracks. The HUD now matches server rows to local tracks by original-file track ID and lists each track once.
  • Adds sourceContainerTrackId to PlayerSubtitleInfo and a PlaybackPlanV3.sourceContainerTrackId resolver, which returns the container track ID only for embedded rows on an ORIGINAL_HTTP plan with a unique canonical ID (PlaybackModels.kt, PlaybackProtocolV3.kt).
  • Only playable sidecar rows provide a source ID; unplayable and burn-in-only rows are excluded. Selecting a matched row preserves the committed local player-track identity (TvSubtitleHudState.kt).
  • Risk: PlaybackPlanV3.nativeSwitchTrackId is refactored to route through the new sourceContainerTrackId helper in PlaybackProtocolV3.kt; review that native-switch resolution still excludes burn-in mode as before.

Macroscope summarized 52532f6.

The TV Subtitles menu listed an embedded track twice when the server
delivers its row as a sidecar: once as the server row ("English (SDH) ·
SRT · Default") and again as the text track Media3 finds in the file.
Such a row resolves only to its own sidecar artifact, so nothing tied the
file's track to it and it was added as a player-only choice.

Subtitle rows on an original_http plan now keep the inventory's
container track ID as sourceContainerTrackId, whether or not the track
is natively switchable. The menu treats a Media3 track whose Format.id
names that ID as the row itself, so it keeps the server's label and is
not listed again, and a choice saved as that player track checks the
row. Server-made streams leave the field unset, since the file's IDs
name nothing in them. An unplayable row keeps its track listed apart,
as the only way to show it.

Related: Silo-Server#744
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Playback subtitle rows now carry source container track IDs for eligible embedded tracks. The Android TV subtitle HUD uses those IDs to match rows with Media3 tracks and avoid listing a matched track as a separate player-only choice.

Changes: Embedded subtitle track mapping

Layer / File(s) Summary
Define source track identity
shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackModels.kt, shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt
PlayerSubtitleInfo adds an optional source container track ID. The protocol helper returns it only for unique canonical IDs on embedded rows delivered through ORIGINAL_HTTP; native switchability remains separately determined.
Project identity into session state
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackV3Session.kt, android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/InPlacePlanAdoptionTest.kt
The session projects source container track IDs into subtitle inventory items. Tests check embedded rows, including non-switchable rows, and verify that HLS-transcoded rows have no source IDs.
Match TV subtitle rows to player tracks
androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleHudState.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleHudStateTest.kt
The HUD associates playable sidecar rows with matching Media3 tracks and excludes those tracks from separate player-only choices. Focus, checked state, and selection account for the association. Tests cover matched and unmatched tracks and rows that do not claim a source ID.

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

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • Issue 744 reports that the Android TV subtitle menu lists unselected embedded text tracks both as server rows and as player-only rows. This change matches rows to Media3 tracks using container track IDs.

Possibly related PRs

Suggested reviewers: quick104, rxwatcher

Merge Risk: Minimal · up to 52532

This change prevents embedded subtitle tracks from appearing twice in the Android TV player menu. It keeps the existing selection behavior and falls back to listing the player track when no ID matches. No merge-blocking risk was identified.

Security architecture risk: Minimal · up to 52532

The added identity reconciles subtitle choices without granting new access or native-playback authority. No material weakening of ownership or recovery guarantees was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated new influence of server-provided container identity is over subtitle choices and selection presentation in the current TV playback context. The inspected path establishes no additional account, tenant, credential, or service authority.

Trust Boundaries and Controls

  • observed — The plan-derived source identity requires original_http delivery, an embedded row, a canonical positive 32-bit container ID, and uniqueness in the inventory. The HUD further restricts this association to sidecar rows not marked unplayable. Matching reuses the existing exact-ID or numeric merged-source-prefix comparison.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(tv): list each embedded subtitle track once in the player menu" matches the main change: the Android TV subtitle menu no longer lists an embedded track twice. The changeset adds sourceC…
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 tied to the changeset. It explains that embedded subtitle tracks appeared twice in the Android TV Subtitles menu, once as a server sidecar row and once as a Media3 trac…
Full details: Title check

Explanation

The title "fix(tv): list each embedded subtitle track once in the player menu" matches the main change: the Android TV subtitle menu no longer lists an embedded track twice. The changeset adds sourceContainerTrackId, maps Media3 tracks to server rows in TvSubtitleHudState, and adds tests for that behavior. The title is specific and concise, and it names the affected surface (tv).

Full details: Description check

Explanation

The description is specific and tied to the changeset. It explains that embedded subtitle tracks appeared twice in the Android TV Subtitles menu, once as a server sidecar row and once as a Media3 track. It names the changed areas: the TV menu builder, the new sourceContainerTrackId field and resolver, and the nativeSwitchTrackId refactor. It also lists validation runs and known limits, such as the case with no container track ID.

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: 80d4e51b-ceb9-4d0d-88bd-8db4c379686a
Commits

Reviewing files that changed from the base of the PR and between c89bdf3 and 52532f6.

Files selected for processing: 6

  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackV3Session.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/InPlacePlanAdoptionTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleHudState.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleHudStateTest.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt

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

@silo-kody

silo-kody Bot commented Nov 20, 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 ❌

Resolve the TvSubtitleHudState conflict with Silo-Server#1010: the row's plays()
check now builds on playsAs, so a burned-in sidecar pick and a saved
player-track choice both check their server row.

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

macroscopeapp Bot commented Nov 22, 2026

Copy link
Copy Markdown

The Android TV subtitle-menu change is visible, but the linked captures are not a before-and-after of the same screen with the same media; the description explains that the duplicate could not be reproduced on current main. The missing evidence is a comparable Android TV before-and-after showing the menu change. Suggested fix: add that pair if a same-data baseline becomes available; otherwise, the stated reason leaves the gap for the reviewer to assess.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

…er track

A burn-in-only row (VobSub or DVB on direct play) whose track the player
cannot switch to natively plays only through a transcode, while Media3
already lists that track and can show it on the device. The menu hid
that track behind the row, so the only route left was the transcode.
Only a sidecar row now stands for the file's track.

A saved choice of the hidden player track checks the row that stands
for it. Picking that row sent the row's sidecar identity, so the
adapter staged a replan and an extraction for the track already on
screen. Picking it now re-picks the player track, and a pending player
track marks its row as applying.

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

@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.

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

Review of 3fcdc21, which is this branch with main merged in. Main's #1010 changed the same check and focus lines in TvSubtitleHudState.kt to playsAs, so the merge resolves that conflict and plays() now builds on playsAs.

Two findings are below. I'm fixing both in a commit on this branch, so there's no need to change anything yourself. The approach holds up otherwise: the new field is needed, nativeSwitchTrackId behaves as before, and the phone menu lists only server rows, so it needs no change.

@silo-kody

silo-kody Bot commented Nov 22, 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

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

Review summary

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

Reviewed head: 52532f6. That is the contributor's 53f5bb1, a merge of main (3fcdc21), and one fix commit.

What changed during review

  • Merged main. fix(player): play an ASS pick that the server burns in on an HLS transcode #1010 changed the same check and focus lines in TvSubtitleHudState.kt to playsAs. The merge keeps this PR's plays() and builds it on playsAs, so a burned-in sidecar pick and a saved player-track choice both check their row.
  • Burn-in-only rows keep their track (Medium, fixed in 52532f6). Hiding applied to every embedded row with a container track ID. A burn_in_only VobSub or DVB row with no native switch then lost the Media3 track the device could show, which left a server transcode as the only route. Only a sidecar row now stands for the file's track.
  • Re-picking the checked row (Low, fixed in 52532f6). With a saved player-track choice playing, picking the row it stands under sent the sidecar identity, which staged a replan and an extraction for subtitles already on screen. That pick now keeps the player track, and "Applying…" marks the row for a pending player track.

Both fixes have a test that failed on 3fcdc21 and passes on 52532f6.

Left for the maintainers

  • Maintainer decision: one row per track versus a fast fallback. For an ASS track on direct play, the Media3 copy used to switch at once, with Media3's plainer styling. Now the only listed choice is the server row, which waits for a replan and a whole-file extraction, and has no fallback when that extraction fails. [bug] Android TV subtitle menu lists each unselected embedded track twice #744 asks for one row per track, and the server's native_selectable answer already accounts for the styling preference and libass, so I'd keep it as is. The PR body mentions this trade-off.
  • Not confirmed, and not caused by this PR: a saved player-track choice restored on a fresh load may not reselect its track before Media3 publishes its tracks (TvPlayerSubtitlePolicy.kt passes the LocalMedia3 value through unchanged). That restore path is the same on main, and I haven't reproduced it.
  • Evidence: the captures aren't a same-file pair, as the PR body says. The fixes in 52532f6 change only burn-in-only rows and re-picks, which the captures don't show, so the published page still matches what it shows.

Validated features

Validation tasks: changes #324 C3. Case C3 (a manual track choice persists) hasn't been run yet, so no passed case regresses. I couldn't read the validation board, so I worked from #324's case table.

Tests

The PR's new tests read the new field, so they don't build on the base and can't show that they detect the bug. The two cases added in review failed on 3fcdc21 before their fixes. On the reviewed code, the Android TV subtitle unit tests (261), the android-shared playback tests, the shared unit tests (2,517), and :androidTvApp:lintDebug pass.

Other checks

  • User manual: unaffected. No docs page describes the duplicate rows.
  • Apple and Android parity: the phone menu lists only server rows. The Apple subtitle menu lists the view model's server tracks too, so the PR's Apple N/A holds.
  • Council review (round 1, on 3fcdc21): Sol (gpt-6.2-sol, xhigh) 6/10, Opus (claude-opus-5-5, high) 8/10, Gemini (gemini-4-neon, xhigh) 7/10. Two members found the burn-in-only gap and all three found the re-pick, both fixed above. The other findings were the fallback trade-off and the restore question above, plus theoretical ID collisions, container gating, and extra tests, which the source rules out or the repository's test rules don't call for. No second round ran: the fixes are small and each one is covered by a test.

Scores

  • Fit 9: it fixes a visible defect in the TV player at the menu that lists the rows, reuses the existing track-ID matching, and adds no setting or server work.
  • Readiness 8: no known defect remains. The one condition is that nobody has played the same file before and after on current main.

@macroscopeapp

macroscopeapp Bot commented Nov 22, 2026

Copy link
Copy Markdown

The latest commit also changes the Android TV Subtitles menu: burn-in-only tracks remain separately selectable, and selecting a server row that represents the currently playing Media3 track keeps that track instead of starting a sidecar replan. The Evidence section says its captures are not a same-file pair, so they do not show these states against the same data.

  • TvSubtitleHudState.kt — Android TV menu options: add before-and-after captures of the same file showing the duplicate sidecar track removed while a burn-in-only track remains selectable.
  • TvSubtitleHudState.kt — Android TV selection behavior: add a short recording showing the represented, currently playing track remains checked and selecting it does not start an apply/replan flow.

The stated phone, tablet, and foldable exclusion is consistent with the TV-only menu consumer.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@Quick104
Quick104 merged commit 03972d4 into Silo-Server:main Nov 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants