Bug 1476514 return concrete AudioNodeStream instead of base from DestinationStream() r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 30 Nov 2018 02:26:29 +0000
changeset 448910 d8084f695ac4ffd9673201b8fab65fc86cf19793
parent 448909 1b5ec7fefbbf8959db1bb438b6491d925074b066
child 448911 27ff7165e2e3e9b8023bd9a93a9358386e48e81e
push id35129
push usernerli@mozilla.com
push dateFri, 30 Nov 2018 09:34:14 +0000
treeherdermozilla-central@c5b713000513 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1476514
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1476514 return concrete AudioNodeStream instead of base from DestinationStream() r=padenot Differential Revision: https://phabricator.services.mozilla.com/D13218
dom/media/webaudio/AudioContext.cpp
dom/media/webaudio/AudioContext.h
--- a/dom/media/webaudio/AudioContext.cpp
+++ b/dom/media/webaudio/AudioContext.cpp
@@ -659,17 +659,17 @@ uint32_t AudioContext::MaxChannelCount()
 }
 
 uint32_t AudioContext::ActiveNodeCount() const { return mActiveNodes.Count(); }
 
 MediaStreamGraph* AudioContext::Graph() const {
   return Destination()->Stream()->Graph();
 }
 
-MediaStream* AudioContext::DestinationStream() const {
+AudioNodeStream* AudioContext::DestinationStream() const {
   if (Destination()) {
     return Destination()->Stream();
   }
   return nullptr;
 }
 
 double AudioContext::CurrentTime() {
   MediaStream* stream = Destination()->Stream();
@@ -944,19 +944,18 @@ void AudioContext::SuspendInternal(void*
   nsTArray<MediaStream*> streams;
   // If mSuspendCalled is true then we already suspended all our streams,
   // so don't suspend them again (since suspend(); suspend(); resume(); should
   // cancel both suspends). But we still need to do ApplyAudioContextOperation
   // to ensure our new promise is resolved.
   if (!mSuspendCalled) {
     streams = GetAllStreams();
   }
-  Graph()->ApplyAudioContextOperation(DestinationStream()->AsAudioNodeStream(),
-                                      streams, AudioContextOperation::Suspend,
-                                      aPromise);
+  Graph()->ApplyAudioContextOperation(DestinationStream(), streams,
+                                      AudioContextOperation::Suspend, aPromise);
 
   mSuspendCalled = true;
 }
 
 already_AddRefed<Promise> AudioContext::Resume(ErrorResult& aRv) {
   nsCOMPtr<nsIGlobalObject> parentObject = do_QueryInterface(GetParentObject());
   RefPtr<Promise> promise;
   promise = Promise::Create(parentObject, aRv);
@@ -996,19 +995,18 @@ void AudioContext::ResumeInternal() {
   nsTArray<MediaStream*> streams;
   // If mSuspendCalled is false then we already resumed all our streams,
   // so don't resume them again (since suspend(); resume(); resume(); should
   // be OK). But we still need to do ApplyAudioContextOperation
   // to ensure our new promise is resolved.
   if (mSuspendCalled) {
     streams = GetAllStreams();
   }
-  Graph()->ApplyAudioContextOperation(DestinationStream()->AsAudioNodeStream(),
-                                      streams, AudioContextOperation::Resume,
-                                      nullptr);
+  Graph()->ApplyAudioContextOperation(DestinationStream(), streams,
+                                      AudioContextOperation::Resume, nullptr);
   mSuspendCalled = false;
 }
 
 void AudioContext::DispatchBlockedEvent() {
   if (!StaticPrefs::MediaBlockEventEnabled()) {
     return;
   }
 
@@ -1055,26 +1053,26 @@ already_AddRefed<Promise> AudioContext::
   if (Destination()) {
     Destination()->DestroyAudioChannelAgent();
   }
 
   mPromiseGripArray.AppendElement(promise);
 
   // This can be called when freeing a document, and the streams are dead at
   // this point, so we need extra null-checks.
-  MediaStream* ds = DestinationStream();
+  AudioNodeStream* ds = DestinationStream();
   if (ds) {
     nsTArray<MediaStream*> streams;
     // If mSuspendCalled or mCloseCalled are true then we already suspended
     // all our streams, so don't suspend them again. But we still need to do
     // ApplyAudioContextOperation to ensure our new promise is resolved.
     if (!mSuspendCalled && !mCloseCalled) {
       streams = GetAllStreams();
     }
-    Graph()->ApplyAudioContextOperation(ds->AsAudioNodeStream(), streams,
+    Graph()->ApplyAudioContextOperation(ds, streams,
                                         AudioContextOperation::Close, promise);
   }
   mCloseCalled = true;
 
   return promise.forget();
 }
 
 void AudioContext::RegisterNode(AudioNode* aNode) {
--- a/dom/media/webaudio/AudioContext.h
+++ b/dom/media/webaudio/AudioContext.h
@@ -267,17 +267,17 @@ class AudioContext final : public DOMEve
   // OfflineAudioContext methods
   already_AddRefed<Promise> StartRendering(ErrorResult& aRv);
   IMPL_EVENT_HANDLER(complete)
   unsigned long Length();
 
   bool IsOffline() const { return mIsOffline; }
 
   MediaStreamGraph* Graph() const;
-  MediaStream* DestinationStream() const;
+  AudioNodeStream* DestinationStream() const;
 
   // Nodes register here if they will produce sound even if they have silent
   // or no input connections.  The AudioContext will keep registered nodes
   // alive until the context is collected.  This takes care of "playing"
   // references and "tail-time" references.
   void RegisterActiveNode(AudioNode* aNode);
   // Nodes unregister when they have finished producing sound for the
   // foreseeable future.