gecko-dev/dom/media/webaudio/test
Paul Adenot 6ee36e38f6 Bug 1094764 - Implement AudioContext.suspend and friends. r=roc,ehsan
- Relevant spec text:
    - http://webaudio.github.io/web-audio-api/#widl-AudioContext-suspend-Promise
    - http://webaudio.github.io/web-audio-api/#widl-AudioContext-resume-Promise
    - http://webaudio.github.io/web-audio-api/#widl-AudioContext-close-Promise
    - http://webaudio.github.io/web-audio-api/#widl-AudioContext-state
    - http://webaudio.github.io/web-audio-api/#widl-AudioContext-onstatechange

- In a couple words, the behavior we want:
    - Closed context cannot have new nodes created, but can do decodeAudioData,
    and create buffers, and such.
    - OfflineAudioContexts don't support those methods, transitions happen at
    startRendering and at the end of processing. onstatechange is used to make
    this observable.
    - (regular) AudioContexts support those methods. The promises and
    onstatechange should be resolved/called when the operation has actually
    completed on the rendering thread.  Once a context has been closed, it
    cannot transition back to "running". An AudioContext switches to "running"
    when the audio callback start running, this allow authors to know how long
    the audio stack takes to start running.
    - MediaStreams that feed in/go out of a suspended graph should respectively
    not buffer at the graph input, and output silence
    - suspended context should not be doing much on the CPU, and we should try
    to pause audio streams if we can (this behaviour is the main reason we need
    this in the first place, for saving battery on mobile, and CPU on all
    platforms)

- Now, the implementation:
    - AudioNodeStreams are now tagged with a context id, to be able to operate
    on all the streams of a given AudioContext on the Graph thread without
    having to go and lock everytime to touch the AudioContext. This happens in
    the AudioNodeStream ctor. IDs are of course constant for the lifetime of the
    node.
    - When an AudioContext goes into suspended mode, streams for this
    AudioContext are moved out of the mStreams array to a second array,
    mSuspendedStreams. Streams in mSuspendedStream are not ordered, and are not
    processed.
    - The MSG will automatically switch to a SystemClockDriver when it finds
    that there are no more AudioNodeStream/Stream with an audio track. This is
    how pausing the audio subsystem and saving battery works. Subsequently, when
    the MSG finds that there are only streams in mSuspendedStreams, it will go
    to sleep (block on a monitor), so we save CPU, but it does not shut itself
    down. This is mostly not a new behaviour (this is what the MSG does since
    the refactoring), but is important to note.
    - Promises are gripped (addref-ed) on the main thread, and then shepherd
    down other threads and to the GraphDriver, if needed (sometimes we can
    resolve them right away). They move between threads as void* to prevent
    calling methods on them, as they are not thread safe. Then, the driver
    executes the operation, and when it's done (initializing and closing audio
    streams can take some time), we send the promise back to the main thread,
    and resolve it, casting back to Promise* after asserting we're back on the
    main thread. This way, we can send them back on the main thread once an
    operation has complete (suspending an audio stream, starting it again on
    resume(), etc.), without having to do bookkeeping between suspend calls and
    their result. Promises are not thread safe, so we can't move them around
    AddRef-ed.
    - The stream destruction logic now takes into account that a stream can be
    destroyed while not being in mStreams.
    - A graph can now switch GraphDriver twice or more per iteration, for
    example if an author goes suspend()/resume()/suspend() in the same script.
    - Some operation have to be done on suspended stream, so we now use double
    for-loop around mSuspendedStreams and mStreams in some places in
    MediaStreamGraph.cpp.
    - A tricky part was making sure everything worked at AudioContext
    boundaries.  TrackUnionStream that have one of their input stream suspended
    append null ticks instead.
    - The graph ordering algorithm had to be altered to not include suspended
    streams.
    - There are some edge cases (adding a stream on a suspended graph, calling
    suspend/resume when a graph has just been close()d).
2015-02-27 18:22:05 +01:00
..
blink
audio-expected.wav
audio-mono-expected-2.wav
audio-mono-expected.wav
audio-quad.wav
audio.ogv
audioBufferSourceNodeNeutered_worker.js
browser_mozAudioChannel_muted.html
browser_mozAudioChannel_muted.js
browser_mozAudioChannel.html
browser_mozAudioChannel.js
browser.ini
chrome.ini Bug 1116187 - Disable failing mochitest-chrome tests for B2G, r=gbrown 2015-02-06 16:30:37 -08:00
corsServer.sjs Bug 937718 - Test for MediaElementAudioSourceNode and cross-origin resources. r=roc 2014-12-24 13:46:58 +01:00
invalid.txt
layouttest-glue.js
mochitest.ini Bug 1094764 - Implement AudioContext.suspend and friends. r=roc,ehsan 2015-02-27 18:22:05 +01:00
noaudio.webm
small-shot-expected.wav
small-shot-mono-expected.wav
small-shot.mp3
small-shot.ogg
test_analyserNode.html Bug 1131529 - Update the maximum FFT size in AnalyserNode to be 2^15. r=padenot 2015-02-16 16:03:07 +01:00
test_analyserNodeOutput.html
test_analyserNodePassThrough.html
test_analyserScale.html Bug 1118622 - Apply the gain to AnalyserNode data prior to sending on the main thread. r=ehsan 2015-01-29 18:05:23 +01:00
test_AudioBuffer.html
test_audioBufferSourceNode.html
test_audioBufferSourceNodeEnded.html
test_audioBufferSourceNodeLazyLoopParam.html
test_audioBufferSourceNodeLoop.html
test_audioBufferSourceNodeLoopStartEnd.html
test_audioBufferSourceNodeLoopStartEndSame.html
test_audioBufferSourceNodeNeutered.html
test_audioBufferSourceNodeNoStart.html
test_audioBufferSourceNodeNullBuffer.html
test_audioBufferSourceNodeOffset.html
test_audioBufferSourceNodePassThrough.html
test_AudioContext.html
test_audioContextSuspendResumeClose.html Bug 1094764 - Implement AudioContext.suspend and friends. r=roc,ehsan 2015-02-27 18:22:05 +01:00
test_audioDestinationNode.html
test_AudioListener.html
test_AudioNodeDevtoolsAPI.html
test_audioParamExponentialRamp.html
test_audioParamGain.html
test_audioParamLinearRamp.html
test_audioParamSetCurveAtTime.html
test_audioParamSetCurveAtTimeZeroDuration.html
test_audioParamSetTargetAtTime.html
test_audioParamSetValueAtTime.html
test_audioParamTimelineDestinationOffset.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_badConnect.html
test_biquadFilterNode.html
test_biquadFilterNodePassThrough.html
test_biquadFilterNodeWithGain.html
test_bug808374.html
test_bug827541.html
test_bug839753.html
test_bug845960.html
test_bug856771.html
test_bug866570.html
test_bug866737.html
test_bug867089.html
test_bug867104.html
test_bug867174.html
test_bug867203.html
test_bug875221.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug875402.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug894150.html
test_bug956489.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug964376.html
test_bug966247.html
test_bug972678.html
test_bug1056032.html
test_channelMergerNode.html
test_channelMergerNodeWithVolume.html
test_channelSplitterNode.html
test_channelSplitterNodeWithVolume.html
test_convolverNode_mono_mono.html
test_convolverNode.html
test_convolverNodeChannelCount.html
test_convolverNodePassThrough.html
test_convolverNodeWithGain.html
test_currentTime.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_decodeAudioDataPromise.html Bug 1000264 - Stop checking exceptions on decodeAudioData now that it uses promises, and check it in the promise test file instead. r=bz 2014-11-14 09:37:39 +01:00
test_decodeMultichannel.html
test_delayNode.html
test_delayNodeAtMax.html
test_delayNodeChannelChanges.html
test_delayNodeCycles.html
test_delayNodePassThrough.html
test_delayNodeSmallMaxDelay.html
test_delayNodeTailIncrease.html
test_delayNodeTailWithDisconnect.html
test_delayNodeTailWithGain.html
test_delayNodeTailWithReconnect.html
test_delayNodeWithGain.html
test_dynamicsCompressorNode.html Bug 1141282 - Test the type of the attributes of the DynamicCompressoNode, and make sure it returns sane values. r=ehsan 2015-03-12 14:36:40 +01:00
test_dynamicsCompressorNodePassThrough.html
test_gainNode.html
test_gainNodeInLoop.html
test_gainNodePassThrough.html
test_maxChannelCount.html
test_mediaDecoding.html Bug 1000264 - Stop checking exceptions on decodeAudioData now that it uses promises, and check it in the promise test file instead. r=bz 2014-11-14 09:37:39 +01:00
test_mediaElementAudioSourceNode.html
test_mediaElementAudioSourceNodeCrossOrigin.html Bug 1130077 - Bump the number of iterations to prevent failures on slow machines. r=ehsan 2015-03-05 13:30:12 +01:00
test_mediaElementAudioSourceNodePassThrough.html
test_mediaStreamAudioDestinationNode.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_mediaStreamAudioSourceNode.html Bug 1061046. Part 22: test_mediaStreamAudioSourceNode no longer sees a 1-sample delay. r=karlt 2014-09-23 13:41:58 -04:00
test_mediaStreamAudioSourceNodeCrossOrigin.html
test_mediaStreamAudioSourceNodePassThrough.html
test_mediaStreamAudioSourceNodeResampling.html
test_mixingRules.html
test_mozaudiochannel.html Bug 1073615 - One MediaStreamGraph singleton per audioChannel, r=roc 2014-11-17 16:07:55 +00:00
test_nodeToParamConnection.html
test_OfflineAudioContext.html Bug 1087944 - Test for the promise returned by OfflineAudioContext.startRendering(). r=ehsan 2014-11-19 18:18:24 +01:00
test_offlineDestinationChannelCountLess.html
test_offlineDestinationChannelCountMore.html
test_oscillatorNode2.html
test_oscillatorNode.html
test_oscillatorNodeNegativeFrequency.html Bug 916285 - Make OscillatorNode handle negative frequencies. r=karlt 2014-12-01 16:10:54 -08:00
test_oscillatorNodePassThrough.html
test_oscillatorNodeStart.html
test_oscillatorTypeChange.html
test_pannerNode_equalPower.html
test_pannerNode.html Bug 1128494 - Change the default panning model of the PannerNode to "equalpower". r=smaug 2015-02-03 11:25:37 +01:00
test_pannerNodeAbove.html
test_pannerNodeChannelCount.html
test_pannerNodeHRTFSymmetry.html Bug 1128494 - Change the default panning model of the PannerNode to "equalpower". r=smaug 2015-02-03 11:25:37 +01:00
test_pannerNodePassThrough.html
test_pannerNodeTail.html Bug 1128494 - Change the default panning model of the PannerNode to "equalpower". r=smaug 2015-02-03 11:25:37 +01:00
test_periodicWave.html
test_scriptProcessorNode_playbackTime1.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_scriptProcessorNode.html
test_scriptProcessorNodeChannelCount.html
test_scriptProcessorNodeNotConnected.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_scriptProcessorNodePassThrough.html
test_scriptProcessorNodeZeroInputOutput.html
test_singleSourceDest.html
test_stereoPannerNode.html Bug 1100349 - Tests for the StereoPannerNode. r=ehsan 2014-11-19 18:16:07 +01:00
test_stereoPannerNodePassThrough.html Bug 1100349 - Tests for the StereoPannerNode. r=ehsan 2014-11-19 18:16:07 +01:00
test_stereoPanningWithGain.html
test_waveDecoder.html
test_waveShaper.html
test_waveShaperNoCurve.html
test_waveShaperPassThrough.html
test_waveShaperZeroLengthCurve.html
ting-44.1k-1ch.ogg
ting-44.1k-1ch.wav
ting-44.1k-2ch.ogg
ting-44.1k-2ch.wav
ting-48k-1ch.ogg
ting-48k-1ch.wav
ting-48k-2ch.ogg
ting-48k-2ch.wav
ting-dualchannel44.1.wav
ting-dualchannel48.wav
webaudio.js Bug 1094764 - Implement AudioContext.suspend and friends. r=roc,ehsan 2015-02-27 18:22:05 +01:00