Skip to content

Close AudioContext when recording visualization stops#49

Open
afq984 wants to merge 1 commit into
chromeos:mainfrom
afq984:fix-audiocontext-leak
Open

Close AudioContext when recording visualization stops#49
afq984 wants to merge 1 commit into
chromeos:mainfrom
afq984:fix-audiocontext-leak

Conversation

@afq984

@afq984 afq984 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Each recording created a new AudioContext for the waveform AnalyserNode but never closed it. Browsers limit the number of concurrent AudioContexts, so after ~40 record/stop cycles new contexts fail to start: getByteFrequencyData() returns silence (the waveform stops appearing) and audio decode/playback breaks until the page is refreshed.

Close the AudioContext in the draw loop once the stream is no longer active, mirroring the cleanup already done in the download handler.

Bug: b/538354264

Each recording created a new AudioContext for the waveform AnalyserNode
but never closed it. Browsers limit the number of concurrent
AudioContexts, so after ~40 record/stop cycles new contexts fail to
start: getByteFrequencyData() returns silence (the waveform stops
appearing) and audio decode/playback breaks until the page is refreshed.

Close the AudioContext in the draw loop once the stream is no longer
active, mirroring the cleanup already done in the download handler.

Bug: b/538354264
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