Skip to content

Close AudioContext when recording visualization stops - #49

Merged
afq984 merged 1 commit into
chromeos:mainfrom
afq984:fix-audiocontext-leak
Sep 20, 2026
Merged

afq984 merged 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
@zhourkr

zhourkr commented Sep 8, 2026

Copy link
Copy Markdown

Hello everyone, regarding the changes to this question, has it been merged?

@afq984
afq984 merged commit c3c447a into chromeos:main Sep 20, 2026
9 checks passed
@afq984
afq984 deleted the fix-audiocontext-leak branch September 20, 2026 08:42
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.

2 participants