You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Background audio analyzer can be orphaned: a running 8x player survives source changes and can never be stopped #193
Where:chrome/player/modules/analyzer/AudioAnalyzer.mjs (startBackgroundAnalyzer: the onDone callback ends with an unconditional this.backgroundAnalyzerPlayer = null;; the post-load check is only if (newSource !== this.backgroundAnalyzerSource) { backgroundAnalyzerPlayer.destroy(); return; }; status is set RUNNING only after the load)
Failure scenarios
(a) FineTimeControls opened: start A loading (status still IDLE); tool closed: stopBackgroundAnalyzer (source = null); tool reopened and play: start B for the same source (allowed: status IDLE, source null). A resolves, source matches, assigned. B resolves, also matches, this.backgroundAnalyzerPlayer = B; A keeps running (rAF loop, its own AudioContext, 8x looping playback, fragment downloads) and nothing references it; reset()/stopBackgroundAnalyzer can never destroy it.
(b) Source changes while A loads; B (new source) is assigned first; A resolves, is destroyed, and its onDone sets backgroundAnalyzerPlayer = null: B is orphaned, and the status stuck at RUNNING refuses any later start for that source.
Suggested fix
A generation counter (const gen = ++this.startGen before the await; after it if (gen !== this.startGen) { player.destroy(); return; }), and in onDone null the field only when this.backgroundAnalyzerPlayer === backgroundAnalyzerPlayer. vadLifecycle.test.mjs's AudioAnalyzer block would take such a test.
Confidence: high on the code; medium on frequency.
From a line-by-line code review of the tree at 41363fd (2026-10-02). Each claim above was checked against the source before filing; the reproduction steps and line references are as of that commit.
Activity