gecko-dev/dom
Paul Adenot e32b404e54 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
..
activities Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
alarm Bug 1147804 followup: Add missing 'override' annotation to AlarmHalService::Notify declaration. rs=ehsan 2015-04-10 09:27:37 -07:00
animation Bug 1153734 part 5 - Add AnimationEffectReadonly as a superinterface of KeyframeEffectReadonly; r=smaug 2015-04-15 08:48:21 +09:00
apps Bug 1111961 - Developer mode support r=ferjm,pauljt 2015-04-13 09:49:50 -07:00
archivereader Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
asmjscache Bug 1125102 - Make QuotaManager and FileService to be independent of each other; r=bent 2015-04-14 10:57:41 +02:00
audiochannel Back out bug 1154243 since mWindow is an nsIDOMWindow 2015-04-14 08:54:59 -04:00
base Bug 1094764 - Implement AudioContext.suspend and friends. r=roc,ehsan 2015-02-27 18:22:05 +01:00
battery Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
bindings Bug 1154831 - Remove the gcc-4.6-warning-silencing code in ErrorResult::ErrorResult; r=bzbarsky 2015-04-16 07:29:31 -04:00
bluetooth Bug 1153796: Share BluetoothInterfaceHelpers.{cpp,h} between Bluetooth v1 and v2, r=btian 2015-04-15 11:46:33 +02:00
broadcastchannel Bug 1148033 - BroadcastChannel API should rispect the B2G app sandboxes, r=ehsan 2015-04-02 17:05:50 +01:00
browser-element Bug 1142806 - Try to keep at least one foreground process at any time. r=gsvelto 2015-04-13 16:25:09 +08:00
cache Bug 1149987 - Part 8: Do not store or match Response objects with a Vary:* header; r=bkelly 2015-04-15 15:55:51 -04:00
camera Bug 1020179 - Let PContent manage PContentPermissionRequest. r=fabrice, r=khuey 2015-04-13 21:08:00 -04:00
canvas Bug 1153574 - Re-enable Mulet reftests taskcluster-specific disables. r=ahal, a=test-only 2015-04-13 14:26:00 -04:00
cellbroadcast Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
contacts Bug 949614 - Use === for SimpleTest.is; r=Waldo 2015-04-14 15:28:13 +02:00
crypto Bug 1147940 - Remove the dom.webcrypto.enabled pref as it is no longer necessary. r=smaug,r=rbarnes 2015-04-08 19:23:05 +01:00
datastore Bug 1152169 - DataStoreService should check if the first revision exists, r=bent 2015-04-16 12:25:42 +01:00
devicestorage Bug 1020179 followup: Mark DeviceStorageRequest::GetRequester as override (and use NS_IMETHOD instead of NS_IMETHODIMP inside of class definition). rs=ehsan 2015-04-15 10:05:38 -07:00
downloads Bug 947167 - Fix/improve debugging of test_downloads_pause_resume.html intermittent. r=aus 2015-03-12 22:27:46 -04:00
encoding Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj 2015-03-21 12:28:04 -04:00
engineeringmode
events Make test_bug422132.html compatible with APZ. (bug 1149128, r=kats) 2015-04-15 16:41:26 -04:00
fetch Backed out changeset 1bbb1ec38652 (bug 1110485) 2015-04-15 09:54:45 +02:00
filehandle Bug 1125102 - Make QuotaManager and FileService to be independent of each other; r=bent 2015-04-14 10:57:41 +02:00
filesystem Bug 1020179 - Let PContent manage PContentPermissionRequest. r=fabrice, r=khuey 2015-04-13 21:08:00 -04:00
fmradio Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
gamepad Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
geolocation Bug 1020179 - Let PContent manage PContentPermissionRequest. r=fabrice, r=khuey 2015-04-13 21:08:00 -04:00
html Bug 1149913 - Disable bug 1093611. Set pref dom.url.encode_decode_hash to true r=honzab 2015-04-16 05:25:10 +03:00
icc Bug 949849 - B2G RIL: Update the marionette test script for icc.updateContact. r=echen 2015-04-13 18:27:00 -04:00
identity
imptests Bug 1141017 - resurrect serif and monospace. r=ehsan 2015-03-30 11:58:00 +02:00
indexedDB Backed out changeset dd10ce7a6b1a (bug 1151242) for bustage. 2015-04-14 13:20:05 -04:00
inputmethod Backed out changeset d8c689def44e for landing with the wrong bug number in the commit message. 2015-03-24 10:48:56 -04:00
inputport Bug 1026350 followup #2: Use NS_IMETHOD instead of NS_IMETHODIMP for function-decl that happens to provide inline impl, in FakeInputPortService.cpp. rs=froydnj 2015-04-10 09:49:55 -07:00
interfaces Bug 1154721 - Add an "Unregister" button to about:serviceworkers, r=ehsan 2015-04-15 18:11:17 +01:00
ipc Bug 1152479 - Do not use layout-related nsIDOMWindowUtils APIs from C++ APZ code. r=kats 2015-04-14 16:44:59 -04:00
json Backed out changeset 050848a5273c (bug 1153988) for Windows build bustage CLOSED TREE 2015-04-14 14:42:59 -07:00
jsurl Backed out changeset 050848a5273c (bug 1153988) for Windows build bustage CLOSED TREE 2015-04-14 14:42:59 -07:00
locales Bug 1004703 - ignore 'unsafe-inline' if nonce- or hash-source specified (r=sstamm) 2015-04-07 09:06:05 -07:00
manifest Bug 1153958 - Make manifest processor e10s friendly. r=ehsan 2015-04-14 16:00:00 +02:00
mathml Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
media Bug 1094764 - Implement AudioContext.suspend and friends. r=roc,ehsan 2015-02-27 18:22:05 +01:00
messages Bug 1138264 - Part 1: Define new system messages of "sms-failed" and "sms-delivery-error". r=echen 2015-04-02 14:26:20 +08:00
mobileconnection Bug 1027546 - Part 3: Create a new testcase. r=aknow 2015-03-23 03:42:00 -04:00
mobileid
mobilemessage Bug 1154186 - Deprecate nsISmsMessenger_new.idl. r=echen 2015-04-14 18:07:44 +08:00
network Bug 935838 - Add per app network traffic statistics to the UDP socket. r=sicking, r=mayhemer 2015-04-08 15:35:00 -04:00
nfc Bug 1152667 - Remove NfcGonkMessage.h r=dimi 2015-04-09 15:54:02 +08:00
notification Bug 1020179 - Let PContent manage PContentPermissionRequest. r=fabrice, r=khuey 2015-04-13 21:08:00 -04:00
offline Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
payment
permission
phonenumberutils Bug 1136211 - SMS cannot be sent to a 15-digit phone number (such as an iNum) which doesn't have a territory id. r=mhenretty 2015-03-31 14:56:05 -07:00
plugins Backed out changeset 050848a5273c (bug 1153988) for Windows build bustage CLOSED TREE 2015-04-14 14:42:59 -07:00
power Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
presentation Bug 1153063 - turn on logging for debug in test_tcp_control_channel.js. r=fabrice 2015-04-15 11:01:02 +08:00
promise Bug 1083361 - Exposing a PromiseDebugging API to monitor uncaught DOM Promise. r=bz 2015-04-10 17:27:57 +02:00
push Bug 1153937 - enable PushServiceLauncher. r=nsm 2015-04-13 10:03:24 -07:00
quota Bug 1125102 - Make QuotaManager and FileService to be independent of each other; r=bent 2015-04-14 10:57:41 +02:00
requestsync Bug 1151082 - RequestSyncAPI - avoid infinite loop when processing pending messages, r=ehsan 2015-04-09 19:59:39 +01:00
res
resourcestats
secureelement Bug 1149177 - [Secure Element] UiccConnector using nsIIccService. r=allstars.chh 2015-03-31 01:40:00 -04:00
security Bug 1148732 - When checking a document's scheme, check the innermost uri. r=dveditz, smaug 2015-04-15 10:18:27 -07:00
settings Bug 949614 - Use === for SimpleTest.is; r=Waldo 2015-04-14 15:28:13 +02:00
simplepush Bug 1038811 - Push Notifications - Move old push to simplepush. r=nsm. sr=jst 2015-04-10 20:19:28 -07:00
smil Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
speakermanager Bug 1151992 - Use call state to decide the usages of output device. r=baku 2015-04-10 17:00:14 +08:00
storage Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
svg Bug 949614 - Use === for SimpleTest.is; r=Waldo 2015-04-14 15:28:13 +02:00
system Bug 1154186 - Deprecate nsISmsMessenger_new.idl. r=echen 2015-04-14 18:07:44 +08:00
telephony Bug 1145551 - DTMF should be sent using the active SIM, the given or the default one (in that order). r=aknow 2015-04-09 19:22:37 +02:00
tests Bug 1133833 - Disable a few tests on Android 4.3 for intermittent failures; r=trivial 2015-04-14 21:05:40 -06:00
tethering
time Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
tv Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
voicemail Bug 1142770 - part 2 - disable telephonyservice and voicemailservice. r=fabrice 2015-03-23 15:50:14 +08:00
vr Bug 1151937; [webvr] change deviceId/hardwareId to simple values; r=jrmuizel CLOSED TREE 2015-04-07 13:26:44 -04:00
wappush
webidl Bug 1094764 - Implement AudioContext.suspend and friends. r=roc,ehsan 2015-02-27 18:22:05 +01:00
wifi Bug 1084230 - Marionette test for WPA-EAP connection. r=hchang 2015-03-26 21:50:54 +08:00
workers Bug 1149913 - Disable bug 1093611. Set pref dom.url.encode_decode_hash to true r=honzab 2015-04-16 05:25:10 +03:00
xbl Bug 1143651 - don't use CallQueryInterface when the compiler can do the cast for us; r=ehsan 2015-03-12 13:20:29 -04:00
xml Bug 1143651 - don't use CallQueryInterface when the compiler can do the cast for us; r=ehsan 2015-03-12 13:20:29 -04:00
xslt Bug 1134920 - Use moz_xmalloc/moz_xrealloc/free instead of nsMemory::Alloc/Realloc/Free. r=nfroyd 2015-04-01 13:51:45 +09:00
xul Bug 949614 - Use === for SimpleTest.is; r=Waldo 2015-04-14 15:28:13 +02:00
jar.mn
moz.build Backed out 4 changesets (bug 1150683) for Android xpcshell test bustage 2015-04-13 20:15:58 -07:00