Bug 804387 - Part 0: Handle the possible Java exception in AudioTrack.stop() while destroying an audio stream; r=snorp

--HG--
extra : rebase_source : f3695b94c3b8eee5b41cc80a7d67a4e0ce2f6b5d
Bug 804387. Part 1: Make AllocateInputPort addref the returned port. r=jesup

--HG--
extra : rebase_source : a0e4d7889598577a540f132f4190225ecf12fdfb
Bug 804387. Part 1.5: Clean up main-thread MediaStream event listeners. r=jesup
There is no need for these to be independent objects in general and we
don't need to addref/release them. We can just require the caller to
remove them before they die.
We can also save some refcount churn by having
DispatchToMainThreadAfterStreamStateUpdate take already_AddRefed.

--HG--
extra : rebase_source : 751114a1befd73b405dff3ee986496efb6f76201
Bug 804387. Part 2: Fix misleading parameter name; these are NOT exactly microseconds. r=jesup

--HG--
extra : rebase_source : da23d4a4e5a9804b3c3ca19183ae048bf6012152
Bug 804387. Part 3: When a global underrun happens, don't insert blocked time, just cut that time out of the entire MediaStreamGraph timeline instead. r=jesup

--HG--
extra : rebase_source : 94f166e66f5401130b27867dd2b5ca039c704f14
Bug 804387. Part 4: Move MediaStreamGraphImpl to its own header file. r=jesup

--HG--
rename : content/media/MediaStreamGraph.cpp => content/media/MediaStreamGraphImpl.h
extra : rebase_source : 3413667aa3a11c634f703db4031e3c2b0b1e018e
Bug 804387. Part 5: Add MediaStream::GraphTimeToStreamTimeOptimistic and MediaStream::StreamTimeToGraphTime. r=jesup

--HG--
rename : content/media/MediaStreamGraph.cpp => content/media/MediaStreamGraphImpl.h
extra : rebase_source : 0e08f9bb0c544b44ab4953a0f00cae233cd488c7
Bug 804387. Part 6: ChangeExplicitBlockerCountImpl takes a GraphTime, not a StreamTime. r=jesup

--HG--
rename : content/media/MediaStreamGraph.cpp => content/media/MediaStreamGraphImpl.h
extra : rebase_source : c51cb893c9b6121e00a38f105f2efd2e8d70094d
Bug 804387. Part 7: Use a static_cast instead of dynamic check when processing ProcessedMediaStream message. r=jesup

--HG--
extra : rebase_source : 3eb9264b706e19ac19ebf2377a33871be4cbe981
Bug 804387. Part 7.2: Let BiquadFilterNode use the actual context sample rate. r=ehsan

--HG--
rename : content/media/MediaStreamGraph.cpp => content/media/MediaStreamGraphImpl.h
extra : rebase_source : 3d50af2ff2dff9fa047d59d0f3c815dec5cc686c
Bug 804387. Part 7.5: Make Web Audio tests context-rate-independent (disabling some decodeAudioData tests). r=ehsan

--HG--
extra : rebase_source : c625c50a08da1871e79851c2a824b0e3ea170eba
Bug 804387. Part 8: Create AudioNodeEngine and AudioNodeStream. r=jesup
Modifies MediaStreamGraph to always advance its time by a multiple of
WEBAUDIO_BLOCK_SIZE.

--HG--
extra : rebase_source : 99524b09edd4ac0e1bc6607f2ba14925bc2f11c2
Bug 804387. Part 9: Update WebAudio implementation to integrate with AudioNodeStream. r=ehsan
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
Bug 804387. Part 10: Add a mechanism for ensuring that we don't attempt to allocate an input port if the input node is not hooked up to MSG yet. r=roc

--HG--
extra : rebase_source : dc3a202cbb94c266f6df4b0c1b5247522fc76658
Bug 804387. Part 11: Fix testcase to expect correct sample rate. r=roc

--HG--
extra : rebase_source : aabab48ccaa6cbfacc2d22a425574d6e5b4109ee