Bug 996433 - Sprinkle MOZ_WEBRTC ifdefs to unbreak --disable-webrtc after bug 694814. r=jesup
authorJan Beich <jbeich@tormail.org>
Mon, 21 Apr 2014 09:15:34 +0200
changeset 179789 4d752223112e058383d95944535b9283c83ce9cb
parent 179788 d60ec8441e4cf70f945adcf63d0ab6290444fe03
child 179790 b29ed4f8b260652f4e1e98560b19a065c5b4bc99
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersjesup
bugs996433, 694814
milestone31.0a1
Bug 996433 - Sprinkle MOZ_WEBRTC ifdefs to unbreak --disable-webrtc after bug 694814. r=jesup
content/media/MediaStreamGraph.cpp
dom/media/MediaManager.cpp
--- a/content/media/MediaStreamGraph.cpp
+++ b/content/media/MediaStreamGraph.cpp
@@ -25,17 +25,19 @@
 #include "AudioNodeEngine.h"
 #include "AudioNodeStream.h"
 #include "AudioNodeExternalInputStream.h"
 #include <algorithm>
 #include "DOMMediaStream.h"
 #include "GeckoProfiler.h"
 #include "mozilla/unused.h"
 #include "speex/speex_resampler.h"
+#ifdef MOZ_WEBRTC
 #include "AudioOutputObserver.h"
+#endif
 
 using namespace mozilla::layers;
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 
 namespace mozilla {
 
 #ifdef PR_LOGGING
@@ -582,23 +584,25 @@ MediaStreamGraphImpl::UpdateStreamOrderF
 }
 
 static void AudioMixerCallback(AudioDataValue* aMixedBuffer,
                                AudioSampleFormat aFormat,
                                uint32_t aChannels,
                                uint32_t aFrames)
 {
   // Need an api to register mixer callbacks, bug 989921
+#ifdef MOZ_WEBRTC
   if (aFrames > 0 && aChannels > 0) {
     // XXX need Observer base class and registration API
     if (gFarendObserver) {
       gFarendObserver->InsertFarEnd(aMixedBuffer, aFrames, false,
                                     IdealAudioRate(), aChannels, aFormat);
     }
   }
+#endif
 }
 
 void
 MediaStreamGraphImpl::UpdateStreamOrder()
 {
   mOldStreams.SwapElements(mStreams);
   mStreams.ClearAndRetainStorage();
   bool shouldMix = false;
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -392,19 +392,25 @@ public:
     return stream.forget();
   }
 
   nsDOMUserMediaStream(MediaEngineSource *aAudioSource) :
     mAudioSource(aAudioSource),
     mEchoOn(true),
     mAgcOn(false),
     mNoiseOn(true),
+#ifdef MOZ_WEBRTC
     mEcho(webrtc::kEcDefault),
     mAgc(webrtc::kAgcDefault),
     mNoise(webrtc::kNsDefault),
+#else
+    mEcho(0),
+    mAgc(0),
+    mNoise(0),
+#endif
     mPlayoutDelay(20)
   {}
 
   virtual ~nsDOMUserMediaStream()
   {
     Stop();
 
     if (mPort) {
@@ -552,19 +558,23 @@ public:
     // the desired tracks in the MediaStreamGraph) or when
     // DOMMediaStream::NotifyMediaStreamGraphShutdown is called.
     nsRefPtr<DOMMediaStream> mStream;
   };
 
   NS_IMETHOD
   Run()
   {
+#ifdef MOZ_WEBRTC
     int32_t aec = (int32_t) webrtc::kEcUnchanged;
     int32_t agc = (int32_t) webrtc::kAgcUnchanged;
     int32_t noise = (int32_t) webrtc::kNsUnchanged;
+#else
+    int32_t aec = 0, agc = 0, noise = 0;
+#endif
     bool aec_on = false, agc_on = false, noise_on = false;
     int32_t playout_delay = 0;
 
     NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
     nsPIDOMWindow *window = static_cast<nsPIDOMWindow*>
       (nsGlobalWindow::GetInnerWindowWithId(mWindowID));
 
     // We're on main-thread, and the windowlist can only
@@ -632,22 +642,20 @@ public:
     // that the MediaStream has started consuming. The listener is freed
     // when the page is invalidated (on navigation or close).
     mListener->Activate(stream.forget(), mAudioSource, mVideoSource);
 
     // Note: includes JS callbacks; must be released on MainThread
     TracksAvailableCallback* tracksAvailableCallback =
       new TracksAvailableCallback(mManager, mSuccess, mWindowID, trackunion);
 
-#ifdef MOZ_WEBRTC
     mListener->AudioConfig(aec_on, (uint32_t) aec,
                            agc_on, (uint32_t) agc,
                            noise_on, (uint32_t) noise,
                            playout_delay);
-#endif
 
     // Dispatch to the media thread to ask it to start the sources,
     // because that can take a while.
     // Pass ownership of trackunion to the MediaOperationRunnable
     // to ensure it's kept alive until the MediaOperationRunnable runs (at least).
     nsIThread *mediaThread = MediaManager::GetThread();
     nsRefPtr<MediaOperationRunnable> runnable(
       new MediaOperationRunnable(MEDIA_START, mListener, trackunion,