Repository navigation
fix(playback): stop reporting encode targets for copy sessions rebuilt after a restart - #3982
Conversation
… restart A recipe card keeps the negotiated target resolution and bitrate so the stream can be matched and rebuilt, but a video copy applies neither. reconstructSession copied them onto the session anyway, so after a server restart the admin views showed encode targets for a remux that the live session had never reported. Closes Silo-Server#3100
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. Walkthrough
Merge Risk:
|
…sion A native HLS remux reported the source's height label as target_resolution while live, and none once rebuilt after a restart, so the field changed on a restart. The v2 contract documents it as empty when not transcoding. Drop it whenever the session copies video. 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: 656f78c (the PR's 18bd676 plus one review fix). Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green) The fix is small and sits at the shared rebuild step. It reuses Addressed
Tests
Left for the maintainers
Checks
Evidence for the review fix: https://evidence.siloserver.org/r/silo-server/pr-3982-r2/ Posted by Claude Code (claude-opus-5-5) for the maintainer. A cross-provider review (gpt-6.1-sol) of 18bd676 found no further issues. |
Problem
Closes #3100
Related issue: N/A
Validation tasks: touches #1206 C1 and #1207 C1 (both not yet run)
When the server restarts during a Jellyfin-client HLS remux, the admin sessions view starts reporting encode targets for a stream that only copies video. On a local build, a 1080p H.264 file remuxed under a 4 Mbps client limit showed no target before the restart. After the restart and the next segment request, it showed
target_resolution: "720p". ffmpeg never applies that resolution to a copy.The recipe card keeps the negotiated resolution and bitrate because jellycompat uses them to match and rebuild the negotiated stream. When
reconstructSessionrebuilt the session after a restart, it copied those card values onto the session even when the video is copied. This change leaves the card as it is and clears the two targets on the rebuilt session whenever the card copies video.Approach
The fix sits at the shared rebuild in
internal/playback, so native and jellycompat copy sessions follow the same rule. It reuses the existingRecipeCard.VideoStreamCopy()check, which covers progressive remux and HLS video copy. Encode sessions keep their targets.Native
/api/v2HLS remux sessions change too. They used to report the source's own height label astarget_resolution(for example"1080p") while live, and a rebuilt session also reported the card's bitrate. Clearing only the rebuilt session would have made the field change partway through a stream, sov3SessionStreamStatenow dropstarget_resolutionwhenever the session copies video. A native copy session reports no target resolution or target bitrate, live or rebuilt, which matches the v2 schema ("Empty when not transcoding"). The web admin view shows a remux as copied, using the source fields, andstream_bitrate_kbpsfalls back to the source bitrate. The one visible difference is the detail line for a version the server switched to automatically, which no longer repeats the output height for a copy. The Apple and Android clients do not readtarget_resolution.Validation
mainand passes here.go build ./...,gofmt,go mod tidy -diff,go vet ./...,make lint-changedandmake lint-router-recovery: clean.make test-go: passes. Four packages that do not touch this change (api/handlers,backup,ebookconvert,uploads) failed locally only because of a group-writable umask in the test shell, and they pass withumask 022.make verify-playback-fixtures,verify-local-paths,verify-case-collisions,verify-bidiandverify-size-ratchet: pass. The web half and the API contract checks were not run because nothing in those areas changed.TestV3SessionOutputFormatMatchesDeliveryfailed on the first commit of this branch for the three copy cases and passes now. On an isolated sandbox at 656f78c, a native HLS remux of a 1080p H.264 MKV reportedtarget_resolution: nullbefore and after a restart, and a native 720p encode kept"720p". Evidence: https://evidence.siloserver.org/r/silo-server/pr-3982-r2//api/v2/admin/sessionsonce the rebuilt session has synced. Cases: Jellyfin HLS remux, Jellyfin HLS encode, and native/api/v2HLS remux, each onmainand on this branch.Evidence
GET /api/v2/admin/sessions, trimmed to the stream fields. Source: 1080p, 3099 kbps.Surface and build: native admin API,
mainat 48748d9 and this branch.Risks
The only change is to what copy sessions report to the admin views. The recipe card, stream matching and the rebuilt ffmpeg command stay the same. A native HLS remux's
target_resolutionnow reads null, live and after a restart, instead of the source's label. No first-party client displays that field for a remux.Checklist
AI Disclosure
target_resolutionchange after a restart; both reviewers judged it display-only, and it is described above.Note
Fix
TranscodeManager.reconstructSessionto drop encode targets for copy sessions after restartAfter a restart, sessions rebuilt from a recipe card could report a target resolution and bitrate even when the card uses video stream copy.
reconstructSessionin transcode_manager.go now clears both targets for copy cards; non-copy cards keep their targets. Adds a table-driven test,TestReconstructSessionReportsOnlyAppliedVideoTargets.Macroscope summarized 18bd676.