Skip to content

Add reload cap and visibility backoff to buffer monitor (release)#33

Merged
ryanbr merged 3 commits intomasterfrom
feat/reload-cap-visibility-backoff
Apr 5, 2026
Merged

Add reload cap and visibility backoff to buffer monitor (release)#33
ryanbr merged 3 commits intomasterfrom
feat/reload-cap-visibility-backoff

Conversation

@ryanbr
Copy link
Copy Markdown
Owner

@ryanbr ryanbr commented Apr 5, 2026

Inspired by TTV-AB v5.1.4 stability improvements:

  1. One-reload-per-recovery cap: after buffer monitor escalates to a player reload once, subsequent buffer fixes stay on pause/play until playback resumes healthily. Prevents reload cascades during persistent stalls. The recoveryReloadUsed flag resets when playback advances.

  2. Visibility-aware poll backoff: when document.hidden is true, poll 5x slower (5s instead of 1s). Reduces background CPU on multi-tab users. Returns to normal poll rate on next tick after visibility restored.

Graduating from testing scripts to release.

@ryanbr ryanbr force-pushed the feat/reload-cap-visibility-backoff branch from 9a6acbe to ab43bbc Compare April 5, 2026 08:49
Inspired by TTV-AB v5.1.4 stability improvements:

1. One-reload-per-recovery cap: after buffer monitor escalates to a player
   reload once, subsequent buffer fixes stay on pause/play until playback
   resumes healthily. Prevents reload cascades during persistent stalls.
   The recoveryReloadUsed flag resets when playback advances.

2. Visibility-aware poll backoff: when document.hidden is true, poll 5x
   slower (5s instead of 1s). Reduces background CPU on multi-tab users.
   Returns to normal poll rate on next tick after visibility restored.

Graduating from testing scripts to release.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ryanbr ryanbr force-pushed the feat/reload-cap-visibility-backoff branch from ab43bbc to a53f019 Compare April 5, 2026 09:06
ryanbr and others added 2 commits April 5, 2026 22:15
After initial sizing, 5x delay gives 4s worst-case stall detection on
hidden tabs. Tuning to 3x keeps CPU savings meaningful (~67% fewer
monitor iterations vs ~80% at 5x) while reducing worst-case delay to 2s,
which stays below the user-perception threshold for "something broke"
(typically ~3s).

Better trade for users with background audio streams — 2-3s silence
window on stall instead of 4-5s.

Chained off feat/reload-cap-visibility-backoff — merge that first.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ryanbr ryanbr merged commit b1b7a85 into master Apr 5, 2026
2 checks passed
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