Bug 1036431 - Setting AudioContext.mozAudioChannelType should set the audiochannel in mStream as well, r=ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 30 Jul 2014 12:26:12 +0100
changeset 196844 deb63ed4434b75e5d8d60c825ec9cefb774f4d60
parent 196843 85b40c4b8af7e8e61e4ff3bf24ee337841d87306
child 196845 413586b58d1a75c092c0e6f06b497626412a87ef
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersehsan
bugs1036431
milestone34.0a1
Bug 1036431 - Setting AudioContext.mozAudioChannelType should set the audiochannel in mStream as well, r=ehsan
content/media/webaudio/AudioDestinationNode.cpp
--- a/content/media/webaudio/AudioDestinationNode.cpp
+++ b/content/media/webaudio/AudioDestinationNode.cpp
@@ -324,17 +324,16 @@ AudioDestinationNode::AudioDestinationNo
                             MediaStreamGraph::CreateNonRealtimeInstance(aSampleRate) :
                             MediaStreamGraph::GetInstance();
   AudioNodeEngine* engine = aIsOffline ?
                             new OfflineDestinationNodeEngine(this, aNumberOfChannels,
                                                              aLength, aSampleRate) :
                             static_cast<AudioNodeEngine*>(new DestinationNodeEngine(this));
 
   mStream = graph->CreateAudioNodeStream(engine, MediaStreamGraph::EXTERNAL_STREAM);
-  mStream->SetAudioChannelType(aChannel);
   mStream->AddMainThreadListener(this);
   mStream->AddAudioOutput(&gWebAudioOutputKey);
 
   if (aChannel != AudioChannel::Normal) {
     ErrorResult rv;
     SetMozAudioChannelType(aChannel, rv);
   }
 }
@@ -534,16 +533,20 @@ AudioDestinationNode::SetMozAudioChannel
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
 
   if (aValue != mAudioChannel &&
       CheckAudioChannelPermissions(aValue)) {
     mAudioChannel = aValue;
 
+    if (mStream) {
+      mStream->SetAudioChannelType(mAudioChannel);
+    }
+
     if (mAudioChannelAgent) {
       CreateAudioChannelAgent();
     }
   }
 }
 
 bool
 AudioDestinationNode::CheckAudioChannelPermissions(AudioChannel aValue)