Skip to content

feat(playback): lower Auto quality when playback keeps buffering, and test connection speed - #636

Merged
Quick104 merged 178 commits into
mainfrom
feat/buffering-quality
Oct 23, 2026
Merged

Quick104 merged 178 commits into
mainfrom
feat/buffering-quality

Conversation

@Quick104

@Quick104 Quick104 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: Silo-Server/silo-server#2699 (server side), Silo-Server/silo-server#637, #631
Validation tasks: changes #7 and #8 (Play and Playback robustness), #347 C3 and #348 C3 (manual quality), and #344 C1 and #345 C1 (own-device overrides); none of them is recorded as passed

When a remote connection can't keep up, Android playback stalls, recovers and stalls again until the viewer picks a lower quality by hand. Since #613, Auto requests carry no bandwidth measurement, so the server plans the source file whenever the device can play it, even on a link slower than the file. #631 is one report: a 50 Mbps file played directly over Wi-Fi that delivered about 30–40 Mbps, and it buffered four times in 90 seconds.

This brings the server's buffering-quality design to the phone and TV apps. They measure the connection and send that reading when playback starts. When playback keeps buffering anyway, they lower quality, or offer to.

Approach

The apps follow the buffering-quality spec as settled at silo-server 4ab2b8e95, after a review that compared web, Apple and Android against it.

  • Detecting buffering. One BufferingQualityController in shared/ drives both players, fed by one Media3 adapter. Its tests replay the spec's conformance vectors.
    • Only running out of data is a stall. A wait that begins with more than a second of media buffered is Media3 catching up to a keyframe. It counts only if the buffer drains while it lasts, which the adapter checks every 200 ms.
    • On a tunneled player every wait counts, because its buffered figure includes samples already in the codec.
    • A subtitle or cue refresh on the phone is a reload, not a stall. Until a plan first plays, though, a reload or seek is part of the start's wait, which counts from the first wait; a pause before then ends the current wait without ending the start.
    • An outage (failing media requests, or no network) pauses stall timing. It ends only when the plan's media data arrives again or playback runs; a subtitle or playlist load doesn't start or end one, and an adopted plan starts with none.
  • Lower quality when buffering is a new Playback setting (playback.buffering_quality_mode): Automatically (the default), Ask first, or Never.
    • Automatically lowers Auto at once and shows a Restore quality pill. Ask first shows a pill offering Lower quality. A quality the viewer picked in the player is always asked about. Never only reports.
    • Lower quality on a picked quality steps to the highest rung below the lower of the rung the plan names in active_quality and the delivered bitrate, or below the delivered bitrate when the plan names none.
    • A playback suppression, such as a transient audio-focus loss, counts as a stop, as a pause does.
    • Pills wait while an intro, credits or Next Up pill is up, while the TV player menu is open, in picture in picture, and on the phone while Silo is in the background. Notices stay on screen for 5 seconds of visible time.
    • A quality pick hides any pill as it is sent, and nothing prompts or lowers until its plan is adopted or the server refuses it.
    • The viewer's answer, the "Can't lower quality" notice and the wait before a new offer belong to the title. Retry or a renewal keeps them. A quality pick, a version pick or the phone's Wi-Fi/cellular quality switch clears them once its plan plays; one the server refuses doesn't.
    • A lowering that meets another replan in flight is refused and tried again later. A Restore quality that meets one waits for it, and its learned_limit: "clear" goes out once, on whichever request comes next.
    • In a Watch Party the controller times stalls and reports plans, but never lowers or prompts.
  • Learned limits. Lowering Auto is a quality_change replan whose estimate is 70% of the delivered bitrate.
    • The server keeps that as a limit for this device and connection for 7 days, and Auto plans under it.
    • The Quality menu labels Auto "Auto · limited after buffering". Playback settings shows "Limited to 4.2 Mbps after buffering on Oct 18" with Reset.
    • Restore quality clears the limit. A quality pick drops the lowered estimate the playback kept.
    • Cast requests always send learned_limit: "ignore" and no estimate, because this device's limits aren't the receiver's.
  • Connection speed test. The app times the server's bandwidth probe over one connection, in 500 ms windows.
    • On sign-in, a return to the foreground or a network change, it reads the reading the server already holds for this device and connection.
    • It runs an automatic quick test (at most 3 seconds and 100 MB) only when automatic tests are on and no current reading proves the link. Test speed in Settings runs a 10-second accurate test.
    • With the local route up, the test goes over the LAN with the saved server's credentials.
    • No test runs on a metered network, while media plays, or in the background. A VPN's own metered flag doesn't count.
    • A result is kept only once the server stores it. If the report fails, Settings says the test couldn't be saved.
    • A 429 holds that server's tests until its Retry-After, and "Try again in N seconds" goes away when the time is up.
    • A playback start sends the highest current reading as bandwidth_estimate_kbps with source probe. A reading goes only to the server and route it was measured on.
  • Connection group in Playback settings: the speed ("48 Mbps · measured 3 minutes ago on Wi-Fi", or "Faster than 108 Mbps" for a lower bound), Test speed, and the server's Auto budget.
    • Rates round down: one decimal under 10 Mbps, whole Mbps above, with no digit grouping.
    • The group reads the connection again after a network change, Reset and Test speed.
    • On a metered network a note replaces the speed.
  • Plan summaries. Each plan that stops playing reports a plan_summary route event:
    • its stalls, delivered bitrate, mode, last buffering action and the estimate of the request that made it;
    • throughput_kbps, counted from this plan's media requests that received data for at least a second, and left out when the network changed while the plan played.
    • Every stall's time counts in the totals, and only stalls of a second or more in the count.
    • A failed plan reports when the error shows.
    • When the phone leaves the foreground it saves the playing plan's summary so far. If the process dies, the next launch sends it, within 24 hours. Anything sent at a later launch, including a live send that failed, goes without throughput_kbps.
  • Older servers.
    • The request fields, learning and summaries need the server's buffering_quality_v1 and playback_plan_summary_v1. The speed test and the Connection group need connection_speed_v1.
    • The setting needs a server whose settings manifest has playback.buffering_quality_mode. Without it the row hides and the apps run Automatically.
    • Without them, requests carry none of the new fields, and lowering still works through the estimate alone.
  • docs/playback/01-media3-only-player-architecture.md §3.5–3.6 and docs/playback/sequenced-api-v2.md describe the behavior.

It is one pull request for the same reason as the server's: the speed test is how Auto gets its budget, and the learned limit and the reading feed that same budget. The server side is Silo-Server/silo-server#2699, and the Apple apps get the same behavior in Silo-Server/silo-apple#842.

Validation

  • Supply chain (./scripts/test-check-build-supply-chain.sh, ./scripts/check-build-supply-chain.sh): passed.
  • Unit tests (./gradlew testDebugUnitTest) at c9c3d65, after merging main: 6,290 tests in shared, android-shared, androidApp, androidTvApp and libass-bridge, 0 failures. They replay the spec's 66 controller cases and 13 speed-test cases, vendored from silo-server aadc7fdf8. ServerSetupPersistenceTest occasionally fails two cases on a Dispatchers.Main race in a full run; it passes alone and on rerun.
  • Lint (:android-shared:lintDebug :androidApp:lintDebug :androidTvApp:lintDebug :androidApp:lintVitalRelease :androidTvApp:lintVitalRelease) at 99d9217 (unit tests and debug builds re-run at c9c3d65; CI covers the rest): no findings beyond the baselines.
  • Builds (:androidApp:bundleRelease :androidTvApp:bundleRelease, :androidApp:assembleDebug :androidTvApp:assembleDebug) at 99d9217 (unit tests and debug builds re-run at c9c3d65; CI covers the rest): passed.
  • Manual on an onn 4K Pro (Android 14), against an isolated dev server with the link shaped:
    • Neither a 4K HEVC Dolby Vision remux nor a 1080p H.264 file played tunneled.
    • At 8 Mbps the 1080p plan ran out of data with 268 ms buffered. The wait counted, and after 6 seconds Automatically lowered it to a 6,000 kbps plan.
    • Separately, the 4K remux hit Media3's stuck-player timeout 10 seconds after its first frame on both starts. Silo recovered, and the slow restart then lowered quality to the 1080p version. Whether main does the same wasn't checked.
  • Manual at 0b3a808 against f3146fb, on Android 16 phone and TV emulators against the same server, now at settings revision 23 (the commits after 0b3a808 have unit tests only):
    • Test speed until the probe budget answered 429. Once the wait ended, the branch cleared "Try again in N seconds"; f3146fb kept showing it.
    • The same 108,134 kbps reading gave an Auto budget of "86 Mbps", where f3146fb showed "87 Mbps".
    • With Ask first, the TV prompt hid under the player menu for about 8 seconds and came back with its time left: on screen 15.0 s in all. On f3146fb the timer ran on under the menu, and the prompt was on screen about 7.5 s.
  • Manual at f3146fb, on Android 16 phone, tablet, foldable (folded and open) and TV emulators against an isolated dev server running the server branch, with the link throttled to 4 Mbps for playback:
    • A fresh sign-in ran the quick test, which reported the server's target, 108,134 kbps, as a lower bound after 500 ms.
    • Test speed settled at 372 Mbps on the phone and 467 Mbps on the TV.
    • The start sent the reading as bandwidth_estimate_kbps with source probe.
    • With Automatically, buffering lowered Auto from a 17,398 to a 6,000 kbps plan with a 12,178 kbps observed_rebuffer estimate, and showed Restore quality on all four devices.
    • Settings then showed "Limited to 12 Mbps after buffering on Oct 19", and Reset cleared it.
    • With Ask first, the prompt showed on the phone and TV.
    • On main, the same title on the same link buffered with nothing offered.
  • Not tested:
    • physical devices other than the onn 4K Pro, and a TV that does play tunneled;
    • the speed test over a real local route;
    • a process death with a saved plan summary, Cast, the owed Restore clear, the outage end and the start wait through a reload, which have unit tests only;
    • moving between Wi-Fi and a real cellular or metered network.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-android/buffering-quality/

Surface and build: the first set compares main at b1e5774 with f3146fb on Android 16 emulators (phone, tablet, foldable folded and open, and Android TV 1080p) against an isolated dev server running the server branch. Each pair shows the same screen, profile and title: Playback settings, and Aladdin buffering on Auto at 52:37–52:48 over a 4 Mbps link. The Ask first prompt, Test speed and the learned-limit row are new, so they have after captures only.

The review fixes compare f3146fb with 0b3a808 on Android 16 phone and TV emulators against the same server:

  • The 429 message on the phone, after its wait ended.
  • The Connection rows' budget for the same reading.
  • Recordings of the TV's Ask first prompt under the player menu, with the log timing. These runs use different titles, because the prompt's answer belongs to a title.
  • The onn 4K Pro tunneling check.

Tablet and foldable run the phone app's Settings code, so the 429 and rounding changes reach them unchanged; they weren't captured again. The menu rule is TV-only.

Risks

  • Automatic lowering is on by default for Auto. A viewer who finds it wrong can switch to Ask first or Never, reset a learned limit, or cap quality with Maximum bitrate.
  • Speed tests count against the server's probe budget of 2 GB per account per 10 minutes. A household whose devices run several Test speed checks in a row can get "Try again in N seconds".
  • Movies — Android #7 and Movies — Android TV #8 list in-session auto quality-stepping as out of scope for 1.0, and this adds it.
  • The vendored playback-v3 wire fixtures and settings manifest stay at silo-server 857655f4f, re-vendored for the new fields. Five v3 fixtures differ from the server's current copies because of unrelated server changes (bitrate policy, sync_key, Auto best-effort). Re-vendoring them is a separate change.

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, running in T3 Code
  • Tool(s): Claude Code subagents (code review, code search, implementation); GitHub CLI
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated. The maintainer set the product decisions; human review is pending.
  • Adversarial review:
    • Two Claude Code review agents read the first diff (code only; they ran no builds or devices). They found five bugs, all fixed with tests.
    • A later cross-platform review by Claude Code agents compared web, Apple and Android against the spec. The maintainer ruled on its open questions, and the spec now settles them. This update applies its Android findings, except the one left open below. Two subagents implemented parts of it in their own worktrees: the speed test and Settings fixes, and the saved plan summaries.
    • A Claude Code audit of this branch then simplified it (about 760 lines fewer, behavior kept) and found gaps against the spec, now fixed: a TV Restore dropped while busy, audio-focus suppression, TV Back on API 35 and below, the phone notice behind the AI-subtitle notice, network validation, Settings read ordering, the "Try again" timing, a rolled-back TV plan identity, and pill-timer drift.
    • The follow-ups the first review left open are fixed: a Restore during another replan, failing subtitle loads pausing stall timing, the mode before settings load, and a Settings read after a network change.
    • Left open: the 4K stuck-player timeout on the onn 4K Pro, and Settings' own connection read, which still doesn't feed the readings starts send.

🤖 Generated with Claude Code

Note

Add buffering-quality Auto lowering and connection speed test to playback

  • Adds a shared BufferingQualityController that detects playback stalls, lowers Auto quality via protocol-v3 replans, and shows a Lower/Keep/Restore prompt pill in the phone and TV player UIs
  • Adds a bandwidth probe (BandwidthProbe, SpeedTestMeter) with automatic scheduling, a Test-speed row in Playback settings, learned playback limits with Reset, and a persistent BufferingQualityMode setting (never/ask/always) synced to the server
  • Records playback throughput through PlaybackThroughputMeter on Media3 transfers and sends plan-summary route events; journaled events survive network failures and are replayed after launch
  • Pins an explicitly chosen file version across retries, navigation routes, and cast requests via versionChosen/allowAlternateVersions
  • Fixes startup-stall classification (transport vs decoder), delivery-aware audio-track matching, and transient network failures, which now wait out outages and reopen the same route instead of failing
  • Risk: buffering-quality fields are gated by server feature support in PlaybackSessionManager and SequencedPlayback; older servers must not receive the new fields — see gatedForBufferingQuality in BufferingQualityRequestGating.kt. User-facing playback and seek error text is now generic, and the buffering pill takes over Back on TV

Macroscope summarized 5b5418b.

Quick104 and others added 30 commits October 17, 2026 19:12
Freeze the shared surface the phone and TV players will drive: the
playback.buffering_quality_mode enum, the controller's inputs and outputs,
and the buffering_quality_v1 request and plan fields from the spec's Wire
contract. Vendor the spec's conformance vectors unchanged. The controller
body follows in the next commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er 857655f4f

Take settings manifest revision 21 with playback.buffering_quality_mode and
regenerate SettingKeys.kt with cmd/settingsgen, the 23-case buffering-quality
vectors, and the decision fixture that now advertises buffering_quality_v1 and
playback_plan_summary_v1.

The server's settings conformance fixture still targets revision 20, so
SettingsConformanceTest fails until the server bumps it; raised with the
server thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One state machine for the phone and TV players: the web player's stall
tracker (startup grace, counted and long stalls, outages re-timed), Auto
lowering with an undo in always mode, the prompt for ask mode and picked
qualities, the no-lower cooldown, rearm after an unadopted replan, and
per-plan plan_summary facts.

BufferingQualityVectorsTest replays all 23 vendored conformance cases on a
virtual clock and fails with every broken case named.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… gate its requests

Add the Media3 adapter both players will use: it turns player and load
callbacks into the controller's playing, waiting (network, seek, reload),
pause, seek and transport-trouble events. It also tracks whether media data
is still arriving, so a startup-stall transport_stall on a slow plan that is
still receiving data belongs to the controller rather than the same-plan
reopen.

Requests carry buffering_quality_v1, bandwidth_estimate_source and
learned_limit only when the server advertises the feature, either in the
/api/v2 capabilities or in a decision's server_features; never mode sends
learned_limit: ignore. Controller replans go out as quality_change with the
step-down estimate. Each start and replan logs a one-line summary of its
body, and plan_summary route events go out when the server advertises
playback_plan_summary_v1.

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

playback.buffering_quality_mode (Never, Ask first, Automatically; default
Automatically) joins phone and TV Playback settings next to Maximum Bitrate,
layered per profile and device like Skip Intros. It is newer than some
supported servers, so reads and writes are gated on contract revision 21 the
way the cellular quality pair is.

When the server advertises buffering_quality_v1 and reports a learned limit
for this device's connection, Settings shows "Limited to 44 Mbps after
buffering on Oct 17" with Reset, backed by GET /api/v2/playback/connection
and DELETE .../learned-limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The phone player now runs the buffering-quality controller outside Watch
Party rooms and downloaded files. A new plan is handed to the controller when
it mounts; the controller's replans go out as quality_change with the
step-down estimate, and a replan that cannot be sent at once is reported as
not adopted rather than queued without its fields.

The notice overlay gains the prompt (Playback keeps buffering: Lower quality,
Keep quality) and the undo (Quality lowered to stop buffering: Restore
quality) with the intro pill's countdown fill; Back answers them. The Quality
menu labels Auto "Auto · limited after buffering" while a learned limit holds
it down.

A startup-stall transport_stall on a plan that is still receiving data now
belongs to the controller: no same-plan reopen, no failure replan.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The spec now treats each adoption as a new plan, since a server plan_id can
repeat; the controller keys its state on a local adoption identity and keeps
the server plan_id for plan_summary. The step-down estimate is the exact
integer floor of delivered x 7 / 10 (22120 gives 15484, not 15483). A
higher-priority pill now hides a visible buffering pill with its timer
frozen, and the pill returns with the remainder when that pill goes.

Re-vendor the 32-case vectors and the settings conformance fixture, which now
targets manifest revision 21, from silo-server bdd8892a0. On the phone, every
applied mount is a new adoption, and the recap and credits skip pill joins
intro skip and Next Up ahead of buffering pills.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Route events arrive on the session manager's IO scope while the test polls
them; a synchronized list does not guard iteration, so the poll could throw
ConcurrentModificationException.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The TV player runs the buffering-quality controller outside Watch Party
rooms. Each mounted plan is a new adoption except a client-side same-plan
remount, which is a reload. The controller's replans ride the quality
transaction so subtitle state survives them, as a menu pick does, and a
replan that fails or is dropped before commit is reported back.

The notice overlay gains the prompt and undo pills with the intro pill's
countdown fill and focus rules: the pill takes focus unless the viewer is
mid-scrub, is not drawn while the HUD or Next Up is open, Left/Right stay
inside the prompt, and Select and Back are handled at the player root.
Intro, recap/credits and Next Up pills outrank it. The HUD labels Auto
"Auto · limited after buffering" under a learned limit, and a slow plan that
is still receiving data no longer takes the startup stall's same-plan reopen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
After the buffering controller lowered Auto, the next automatic replan in the
same playback (a subtitle track change, a seek reanchor or a failure
recovery) went out with no estimate, so a server without
buffering_quality_v1 planned the source again and playback stalled, lowered
and climbed back in a loop.

Every later replan in the attempt that reads as Auto now carries the
step-down estimate, without bandwidth_estimate_source since it is not a new
observation. Restore quality, any quality change the controller did not
send, and a new attempt drop it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a throttled link the startup stall detector reported decoder_no_output
with 1.5 s buffered: the decoder had a little input and no first frame
because the network had not delivered more, not because it was wedged. The
failure replan that followed raced the buffering controller's lowering.

While the player is buffering with less than the threshold buffered, the
transport now owns the stall, as it already does for the Dolby Vision
transform deadline: the decoder deadline stays anchored, and a stall that
expires is a transport_stall, which the screens hand to the buffering
controller when data is still arriving. A playing player with silent video
is still the decoder's fault.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the web player's probe to Android: a 40 MB download timed over a
2-second window from the first byte, with the same warm-up, first-byte
deadline and minimum-window rules. It runs in the background a few seconds
after sign-in or a return to the foreground, never while media loads or
plays, and never on a metered or cellular link, against servers that
advertise connection_speed_v1 and a bandwidth_probe_url. A redirect to the
media proxy is followed without credentials. Results are cached for 30
minutes, discarded on any network change, and reported to the server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A video start now sends the probe's fresh estimate as
bandwidth_estimate_kbps with source probe, so Auto can rule out a source the
link clearly cannot carry. Only starts carry it: a probe estimate is a hint,
and replans never raise quality from it. Servers without
buffering_quality_v1 get the estimate without the source. Media3's
bandwidth meter is still never sent.

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

The client now reads and sends bandwidth_estimate_kbps on start and replan,
so the golden fixtures round-trip without the UNSENT_NETWORK_EVIDENCE
exemption.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Phone and TV Playback settings gain a Connection group on servers that
advertise connection_speed_v1: the measured speed with when and on what
network it was measured, a Test speed action (a 429 says when to try again),
and the server's own "Auto plays videos up to N Mbps without converting
them" budget. On cellular or metered links the row says speed tests are
skipped there.

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

Update the quality policy and network inputs sections for the buffering
controller and its server-side learned limit, the probe and its gates, the
probe estimate on starts, the step-down estimate on lowering replans, and
the rule that Media3's bandwidth meter is never sent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rule for repeating a lowering's step-down estimate on later Auto
replans lived inside PlaybackSessionManager, out of reach of the shared
vector runner. The revised buffering-quality vectors now test it through
client_replan, quality_changed and new_attempt events, so the rule moves to
a pure function in shared/domain/player that the manager calls under its
existing atomic reference. Behaviour is unchanged.

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

Re-vendor vectors.json unchanged at silo-server 408328dc7, which adds the
kept-estimate rule and three events: client_replan, quality_changed and
new_attempt. The runner now passes the controller's replans and the
client's own replans through withKeptStepDownEstimate, as
PlaybackSessionManager does, and takes each replan body from the wire
request. All 37 cases pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The controller keeps no log, so a device log showed when a lowering was
sent but not the waits and resumes that led to it. The Media3 adapter now
logs every event it sends (playing, waiting with its cause, pause, seek,
transport errors) under the BufferingQuality tag, which is enough to replay
a field report's decisions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The player draws no pills in picture in picture, but the buffering pill's
15-second timer kept running there: the undo expired unseen, and an Ask
first prompt timed out and cleared the stall history. The buffering spec
now says a player that cannot show its pills hides them as it does behind
a higher-priority pill (silo-server 457592aac).

Picture in picture now counts as a higher-priority pill on phone and TV, so
the buffering pill waits with its remaining timer and shows when the full
player returns. The phone also counts a stopped activity, since playback can
continue in the background there; the TV player already pauses or closes
when it leaves the foreground.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
When the decoder falls behind, Media3 drops to the next keyframe and
reports STATE_BUFFERING with seconds of media still buffered. The adapter
read every such wait as the network running out, so a device that could
not decode fast enough lowered quality and taught the server a network
limit it never hit. On an overloaded emulator, a 2000 kbps plan through a
6 Mbit/s relay was lowered to 1120 kbps after waits that began with 3.6 s
and 6.4 s buffered. That matches the 2000 and 1120 kbps step-downs seen
earlier on the Mac mini.

A wait that starts with more than a second buffered past the playhead is
now a renderer wait, which the controller does not count, as with a seek.
If its buffer drains before playback resumes, it becomes a network wait.
Both players give the adapter the player's totalBufferedDuration.

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

The spec now defines the renderer wait Android started reporting in
2e02cf9 (silo-server 416f0d8ed): a wait that begins with more than
RENDERER_WAIT_BUFFER_MS = 1000 of media buffered is not a stall, and one
whose buffer falls to that threshold becomes a stall from that moment.

Re-vendor vectors.json unchanged at 416f0d8ed (39 cases, with
renderer_waits_do_not_count and renderer_wait_drains_into_stall), map the
renderer cause in the runner, and move the adapter's threshold into the
controller's constants under the spec's name, so the constants check covers
it. All 39 cases pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Settings rounded every rate to whole megabits, so a 1400 kbps learned limit
read "Limited to 1 Mbps after buffering" and a 1013 kbps budget read "up to
1 Mbps". Below 10 Mbps that hides up to 40% of the figure.

The learned-limit row, the connection speed line and the Auto budget now
show one decimal below 10 Mbps ("1.4 Mbps") and whole megabits from there
("44 Mbps", as in the spec), formatted for the device's locale, with kbps
only below 100 kbps. The web already shows the decimal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reset re-read the connection but updated only the learned-limit row. The
Connection group's "Auto plays videos up to" line, which the server caps at
80% of the limit, kept the old figure until Settings was reopened: after
resetting a 1400 kbps limit it still read 1.1 Mbps.

A successful reset now reads the connection once more and updates both the
limit row and the Connection group, on phone and TV.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Media3 adapter reports STATE_IDLE as a stop, and the controller treated
every stop as the viewer pausing. After a player error and its recovery,
the controller still counted the viewer as paused, so an undo pill shown
while the recovered plan buffered kept its 15-second timer frozen until the
first frame. On the emulator that left the pill up about 25 seconds too
long. The spec freezes a pill only while the viewer has paused.

A wait for any cause but a pause now means the player is trying to play:
the controller stops counting the viewer as paused and resumes a frozen
pill timer.

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

Settings read the learned limit and connection speed once, when its
ViewModel was created. The TV ViewModel lives as long as the activity, so a
limit learned during playback never appeared in TV Settings until the app
restarted. The phone page went stale the same way when it sat in the back
stack under the player.

Both now read the connection whenever the Playback settings screen enters
composition, which covers returning from the player.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Describe the renderer wait from the spec (a wait that begins with media
buffered is not a stall) and the pill holds behind higher-priority pills,
in picture in picture and, on the phone, in the background.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clients re-tested every 30 minutes while open, and on every network change.
For 300 users on 2 devices that is about 3,600 tests and 90 GB a day, each
saturating the server's upload for 2 seconds. The approved redesign tests
only when the server holds no current reading for this device and network.

The 30-minute expiry, its re-test timer and the 5-minute retry are gone. A
reading now lasts 7 days, for the server and network it was taken on, and
playback starts send it for that whole time. A check, a few seconds after
sign-in, a return to the foreground or a network change, uses the reading in
hand when it has one. Otherwise it reads this device's stored reading from
GET /api/v2/playback/connection and measures only when the server has none
young enough. A check that fails or is refused waits for the next one, and
after a 429 none measures before its Retry-After. Test speed always
measures, replacing a running automatic check. The metered, cellular and
playback gates are unchanged.

The target, lower bounds, playback samples and the new measurement wait for
the spec change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104 and others added 15 commits October 22, 2026 17:35
The phone's same-route reopen (the outage-end reopen, the transient network
retry, the transport_reopen of a stalled start and the PCM audio retry) only
copied the plan in the UI state. The screen's mount effect applies a mount
only when the view model expects that generation, so the copy never reached
Media3: after an outage the player sat on a spinner over the dead stream.

The reopen now takes a new mount generation, so the screen re-prepares the
player at the current position. The buffering controller reads the applied
mount as a reload of the plan it already has, as on TV, not as a new plan.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
After an outage the player reopens the same route. If that reopen failed on
its connection before playing, the next error always sent failure_recovery,
even when the link had dropped again, which is the replan into an outage
that C10 forbids.

Now the error after that reopen sends failure_recovery only while no outage
is in progress: the device is online and the server answers. Otherwise the
player keeps waiting and reopens again. The media loads' own trouble cannot
make this call, because the failed request that raised the error counts as
one; a route that fails while the server answers (a dead transcode node,
say) still recovers.

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

The ample-buffer rule (C11) made any wait with more than 5 s buffered a
renderer wait. Media3 resumes after a rebuffer at 5 s, so a network wait
that was about to end looked like the renderer's and could never count. The
threshold is now twice the player's resume amount, 10 s.

Tunneled players were exempt from the rule. Tunneling is on for most TVs, so
a tunneled decoder stuck on a full buffer was timed as a network stall and
lowered quality. The ample rule now applies to them too; only the 1 s
renderer-wait start rule still skips them, because a tunneled codec's held
samples count as buffered.

An ample wait now stays the renderer's until playback runs, as the spec
says, instead of turning back into a network wait if the buffer later falls.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The adapter's 200 ms wait check kept running after the screen detached the
player it watched. It went on checking a player it no longer heard from and
could start an outage on the controller for it. And because the adapter kept
its starved phase, a player attached later in the same wait made no state
change, so its wait was never announced or watched.

Detaching now cancels the check and leaves the adapter stopped; the next
seed announces whatever wait it finds.

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

The start-deadline lowering (C9) ran for every startup stall the detector
reported, decoder and renderer failures included, and needed no sign that
the link was slow. A stream the device cannot play, or one whose media
arrived at full speed, was lowered and its failure_recovery (which excludes
the failed route on the server) never sent.

It now lowers only a transport_stall, and only when the plan's measured
throughput is below its delivered bitrate. decoder_no_output,
render_startup_failure and dv7_transform_stall, a plan with no measurement,
and one receiving at or above its bitrate keep the failure path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
When a start missed its deadline and the controller sent a lowering, the
player dropped the startup stall: if the replan was refused, failed, or its
plan was never adopted, nothing else ever acted on the stalled load and the
viewer was left on a dead player.

The view models now hand the controller the start's failure path with the
deadline. The controller runs it once if the lowering fails or its rearm
passes while the stalled plan is still current and has not played; the view
model runs it only if that load is still the one mounted. An adopted plan,
playback starting or the player stopping cancels it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The TV screen reported picture in picture as a higher-priority pill, which
freezes the buffering pill. A lowering made in picture in picture kept its
undo pill frozen for the whole session, which blocked any further lowering,
and on return the pill showed its full time for a lowering long past. The
phone fixed this in round 1; TV kept the old wiring.

Picture in picture now reaches the controller as a hidden view, as on the
phone: a prompt still waits, and an undo pill runs on the real clock unseen
and shows its remaining time on return.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two restarts of the file already playing pinned it as if the viewer had
picked it: the TV's Dolby Vision toggle, and the phone's restart of the
previous version after a failed version switch. A default play that went
through either lost Auto's freedom to move to a lower sibling version under
a bandwidth budget (C6) for the rest of the session.

Both now keep the playing session's pin instead, read from the lifecycle's
last start (allow_alternate_versions: false). The viewer's own version pick
still pins.

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

f82ea6c made every replacement plan's load a source reload, which never
counts as a stall. That is right for a replacement of a source that has
played, such as a slow audio-track switch. But a failure recovery before the
first frame, or a lowering made during the start's wait, then had its whole
load go untimed, and only the 20 s start deadline could act on it.

Only a replacement adopted after a plan of the attempt has played is now a
source reload. One adopted before then carries on the start's wait: its
waits are timed under the grace the attempt's first wait began, and a first
frame after a wait does not restart it. "Played" is a plan reaching
playback, not a stall-history reset.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Once an outage started, only a completed media load, buffered-position
progress or playback ended it; bytes still arriving on a slow request did
not. On the TV emulator at 500 kbps and 1 Mbps a 7 MB segment or an MKV
index read kept the outage open for 45 to 70 s, which held off stall
counting and the start-deadline lowering although the link was working.
C1 says the outage ends when the plan's media data arrives again.

The wait check now ends load trouble when any media request has received
a byte since the trouble began (the same byte timestamp the silence rule
reads), so the wait is timed as a stall again and a new silence is timed
from that byte.

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

During a 45 s outage on the TV emulator the player gave up at about 30 s
and the screen showed a frozen frame with no Buffering chip for the
remaining ~17 s. waitOutOutage sets isBuffering, but Media3 reports the
player error before the player goes idle, and the idle state change then
cleared it. Phone and TV now keep isBuffering while the outage wait runs;
the reopened mount's own buffering takes over when it ends.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On the TV emulator (S6b) the controller lowered a 567 kbps replacement
that was still in the attempt's start wait when its undo pill hid. The
player refused to send it, because the first lowering's own transaction
was still open (TV keeps it until the new mount reports its tracks), yet
that plan's plan_summary said buffering_action lowered with no lowering
made. sendLowering marks the action before the player sends the replan,
and onReplanFailed never took it back.

A failed automatic lowering (not sent, failed, or reported unadopted)
now puts back the plan's previous action. A prompt the viewer answered
with Lower stays accepted: that answer happened either way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Before any plan of a playback attempt has played, a wait does not show that
the network is slow. On the Apple TV a lowered plan whose subtitle rendition
answered 503 for 20-27 s never started, and each replacement carried on the
start's wait and lowered again about every 21 s: 8 lowerings in 2.6 minutes,
down to 125 kbps, and a 249 kbps limit learned for 24 hours.

The controller now reads the playing plan's measured throughput
(PlaybackThroughputMeter.peekKbps through the session manager). Until a plan
of the attempt has played, a trigger acts only when that throughput is below
the plan's delivered bitrate, the test the start-deadline lowering already
made, which now reads the same source. Without that evidence nothing lowers,
prompts or reports, and the start runs on to its deadline and failure path.
When the first frame ends a start wait that had no such evidence, the wait
stays out of the stall history, so a slow start does not lower at its first
frame. After the attempt has played, stalls trigger as before.

vectors.json carries no throughput input, so the harness answers with the
evidence present. slow_start (lowers at 16 s, before any frame) and
slow_start_frame_after_grace (its start wait pairs with a later stall) need it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The server now clears the connection's playback sample when a manual Test
speed result arrives, so the reading becomes that result. The probe
scheduler kept its own copy of the sample and a start sent the higher of
the two, so right after a 20 Mbps Test speed a start could still send an
older 97 Mbps sample and begin a direct play the link cannot carry.
Settings' re-read of the connection does not reach the scheduler's cache,
so the scheduler drops its sample itself when it keeps a Test speed
result. Automatic tests keep the higher reading, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A server remux or transcode maps only the plan's audio track into its
stream. The phone and TV matched a pick against the mounted tracks by
language and codec, so on a remux a commentary pick matched the main mix:
the switch was skipped and confirmed while the main mix kept playing, and
the next replan then switched the audio unasked. On those deliveries a row
other than the plan's now always replans.

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

silo-kody Bot commented Oct 23, 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 and others added 4 commits October 23, 2026 14:29
On Prompt to Undo the outgoing card's dispose cleared the report the Undo
card had just made, so focus was not returned when the Undo pill hid.

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

The owed learned_limit clear was taken when the start or replan was built,
so a request that failed before the server answered dropped it and the next
start ran under the limit the viewer restored against.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A replan adopted while the wait ran was remounted again when the outage
ended, and a failure recovery could run against it. The wait now acts only
on its own mount, and a newer mount's error starts a wait of its own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A failed pick of the committed preference changed no quality, so the pick
stayed pending and held prompts and lowering until the next plan. Any failed
transaction now refuses the latest pick, as on TV.

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

silo-kody Bot commented Oct 23, 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 ❌
⚠️ 4 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Validate download ownership before publishing subtitle bytes
  • Bind playback markers to the actual playing file
  • Share route-aware audio decisions and preserve original-format decoder fallback
  • Apply playback route eligibility consistently at admission and media loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request evidence-required Needs before-and-after evidence before the Evidence check passes impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish size/XXXL 3000+ added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant