Skip to content

fix(playback): ignore unchanged output route replans - #50

Merged
blurbery merged 1 commit into
mainfrom
fix/playback-output-route-loop
Aug 27, 2026
Merged

blurbery merged 1 commit into
mainfrom
fix/playback-output-route-loop

Conversation

@blurbery

Copy link
Copy Markdown
Owner

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_changed replan. 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_unchanged and 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.

@blurbery
blurbery force-pushed the fix/playback-output-route-loop branch from 9952ff6 to 8e2d2ec Compare August 27, 2026 01:08
@blurbery
blurbery merged commit e5899d3 into main Aug 27, 2026
3 checks passed
@blurbery
blurbery deleted the fix/playback-output-route-loop branch August 27, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant