Bug 135331 - Web Audio doesn't release audio resources when nodes disconnected
Summary: Web Audio doesn't release audio resources when nodes disconnected
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.9
: P2 Normal
Assignee: Nobody
URL: https://brionv.com/misc/audio-test.html
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-27 17:30 PDT by Brion Vibber
Modified: 2014-07-28 23:42 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brion Vibber 2014-07-27 17:30:19 PDT
Creation of a Web Audio context and source node (for instance an oscillator or a JavaScriptNode) seems to cause Safari/WebKit to use audio resources for the duration of the page lifetime, even after the node has been disconnected and the context and node variables nulled out for possible garbage collection.

This causes a moderate CPU usage increase in coreaudiod on OS X or mediaserverd on iOS, which doesn't go away until the page is closed, reloaded, or otherwise navigated away from. For a long-running web app that uses audio only intermittently, this may cause unnecessary battery drain etc.

Steps to reproduce:
* Open Activity Monitor or other process monitor to watch for CPU usage
* Open WebKit nightly or Safari 7 to https://brionv.com/misc/audio-test.html
* Click 'Start audio' (it will be silent)
* Click 'Stop audio'

The CPU usage of coreaudiod (OS X) or mediaserverd (iOS) goes up a few percentage points at start, but doesn't go down at stop. Only when the page is unloaded are the resources being released.