Storing references on the AudioContext instead of on the AudioNodes will allow
the AudioContext to report them to the cycle collector until offline rendering
starts.
--HG--
extra : transplant_source : %CD%5Els2%7F/%DD%5E%07%08%FE%29%5B%98%95%F3%11G%E6
AudioNodes that keep playing or tail-time references need to have these
references cleared when an AudioContext has completed or is shut down by the
window.
Storing references on the AudioContext instead of on the AudioNodes will allow
the AudioContext to report playing references to the cycle collector until
offline rendering starts for bug 914033. This is not necessary for tail-time
references, but it is tidier to use the same code for playing and tail-time
references.
--HG--
extra : transplant_source : %E0%F1%06%BFV%B6XI%9BX%8E%8D7%3FsU%8F%F9%14r
The ObtainInputBlock API is also changed to create an input block for one input
block at a time. An array of these input blocks is then sent to
ProduceAudioBlock for processing, which generates an array of AudioChunks as
output.
Backwards compatibilty with existing engines is achieved by keeping the
existing ProduceAudioBlock API for use with engines with only a maximum of one
input and output port.
Here is what this patch does:
* Got rid of the JSBindingFinalized stuff
* Made all nodes wrappercached
* Started to hold a self reference while the AudioBufferSourceNode is playing back
* Converted the input references to weak references
* Got rid of all of the SetProduceOwnOutput and UpdateOutputEnded logic
The nodes are now collected by the cycle collector which calls into
DisconnectFromGraph which drops the references to other nodes and destroys the
media stream. Note that most of the cycles that are now inherent in the
ownership model are between nodes and their AudioParams (that is, the cycles
not created by content.)
We need this in order to update the MediaStreamGraph thread when an
AudioParam changes. This enables each AudioParam to be registered with
a callback from its owner node, so that the owner node can have custom
processing code for each AudioParam's mutation.
This is a mega-patch that was too hard to disentangle. Here's what it does:
-- Create infrastructure around AudioNode::UpdateOutputEnded to detect
when a node can no longer produce any output. When that becomes true,
disconnect it from the AudioNode graph.
-- Have AudioNode implement JSBindingFinalized to use as input in
UpdateOutputEnded.
-- Give every AudioNode a MediaStream, and give every connection
a MediaInputPort.
-- Actually play the audio that reaches the AudioContext's destination node.
-- Force AudioContext to use the audio sample rate defined by MediaStreamGraph.
-- Fix AudioBufferSourceNode's start and stop methods to possibly throw and
take default 'when' parameters.
-- Create an AudioNodeStream for AudioBufferSourceNode and give it a
AudioBufferSourceNodeEngine that does what's needed. Set parameters for
this engine in the start() and stop() methods.
-- Create AudioBuffer::GetThreadSharedChannelsForRate, which is responsible
for stealing the contents of any JS array buffers, and bundling them up
into a thread-shared read-only buffer object which can be used as
part of an AudioChunk. This method will also be responsible for
resampling and caching as necessary.
--HG--
rename : content/media/MediaStreamGraph.cpp => content/media/MediaStreamGraphImpl.h
extra : rebase_source : 9fa0ec0efa304acd6513e427103d6339c78efa53
We need this in order to update the MediaStreamGraph thread when an
AudioParam changes. This enables each AudioParam to be registered with
a callback from its owner node, so that the owner node can have custom
processing code for each AudioParam's mutation.