Repository navigation
fix(playback): ignore unchanged output route replans - #50
Merged
Merged
Conversation
blurbery
force-pushed
the
fix/playback-output-route-loop
branch
from
August 27, 2026 01:08
9952ff6 to
8e2d2ec
Compare
This was referenced Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A — narrow fix
I traced a live Android playback session that kept rotating through direct play, remux, and transcode. The transports were starting correctly; each replacement was being killed by another
output_route_changedreplan. The client was advancing its opaque output generation when Media3 remounts triggered a Spatializer callback, even though the actual route capabilities had not changed.This is the server-side half of blurbery/silo-android#4.
Approach
I added a deliberately narrow compatibility guard for legacy failure-shaped output-route replans. If the only differences are the opaque output context ID and Spatializer runtime state, the server returns
409 output_route_unchangedand leaves the healthy plan mounted. Every other mutable planning input must still match: quality, selected tracks, network constraints, codec evidence, delivery capabilities, device context, and client features. A real route change therefore continues through the normal planner.The Android fix prevents the false route generation at the source. This server guard protects already-installed clients and breaks the remount → callback → replan cycle without changing the database or transport lifecycle.
Validation
GOCACHE=/Users/blur/Documents/Codex/2026-08-27/si/work/go-cache GOWORK=off go test ./internal/api/handlers -run 'TestHandleReplanPlaybackV3RejectsUnchangedOutputRoute|TestSameLegacyOutputRouteReplanV3RequiresEveryOtherInputToMatch' -count=1— passed\n-GOCACHE=/Users/blur/Documents/Codex/2026-08-27/si/work/go-cache GOWORK=off go test ./internal/api/handlers -run '^TestHandleReplanPlaybackV3' -count=1— passed\n-git diff --check— passed\n- Full repository validation is delegated to this PR’s GitHub Actions checks.\n\n## Risks\n\nThe guard is intentionally conservative: any difference beyond the two known non-planning fields allows the replan. Existing Android clients treat a failed output-route invalidation as non-fatal and continue the currently mounted plan. No migration or API schema change is required.\n\n## AI Disclosure\n\n- Tool(s): OpenAI Codex desktop and Codex CLI review\n- Model(s): gpt-5.6-sol\n- Involvement: AI-assisted\n- Adversarial review: Reviewed the committed patch against protocol compatibility, route-capability fallbacks, delivery-scoped planning inputs, idempotency/lease behavior, Android 409 handling, and regression coverage. Earlier review passes found over-broad comparison logic and missing contract documentation; those findings were resolved by narrowing the guard to the exact legacy signature, comparing every other mutable planner input, preserving lease release behavior, and documenting the new conflict. The final independent review reported no findings.\n\n## Checklist\n\n- [x] I read and can explain the complete diff.\n- [x] This pull request addresses one concern.