Bug 1397793 - Refactor the code that sets the processing modes. r?pehrsons draft
authorPaul Adenot <paul@paul.cx>
Tue, 07 Nov 2017 14:28:06 +0100
changeset 707567 f80414c0e9048ee5eb9754a0161844b5607addb8
parent 707566 16547d0ace0d0d7e791ef60249f94fe3060944b4
child 707568 cf84d44df1fadd262283946641d7ce67f779b7d2
push id92158
push userpaul@paul.cx
push dateTue, 05 Dec 2017 14:38:23 +0000
reviewerspehrsons
bugs1397793
milestone59.0a1
Bug 1397793 - Refactor the code that sets the processing modes. r?pehrsons MozReview-Commit-ID: IUgAfHawFIz
dom/media/webrtc/MediaEngineWebRTC.h
dom/media/webrtc/MediaEngineWebRTCAudio.cpp
--- a/dom/media/webrtc/MediaEngineWebRTC.h
+++ b/dom/media/webrtc/MediaEngineWebRTC.h
@@ -479,16 +479,21 @@ private:
   nsresult
   UpdateSingleSource(const AllocationHandle* aHandle,
                      const NormalizedConstraints& aNetConstraints,
                      const NormalizedConstraints& aNewConstraint,
                      const MediaEnginePrefs& aPrefs,
                      const nsString& aDeviceId,
                      const char** aOutBadConstraint) override;
 
+
+  void UpdateAECSettingsIfNeeded(bool aEnable, webrtc::EcModes aMode);
+  void UpdateAGCSettingsIfNeeded(bool aEnable, webrtc::AgcModes aMode);
+  void UpdateNSSettingsIfNeeded(bool aEnable, webrtc::NsModes aMode);
+
   void SetLastPrefs(const MediaEnginePrefs& aPrefs);
 
   // These allocate/configure and release the channel
   bool AllocChannel();
   void FreeChannel();
 
   // This is true when all processing is disabled, we can skip
   // packetization, resampling and other processing passes.
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -185,16 +185,17 @@ MediaEngineWebRTCMicrophoneSource::Media
     int aIndex,
     const char* name,
     const char* uuid,
     bool aDelayAgnostic,
     bool aExtendedFilter)
   : MediaEngineAudioSource(kReleased)
   , mAudioInput(aAudioInput)
   , mAudioProcessing(AudioProcessing::Create())
+  , mAudioOutputObserver(new AudioOutputObserver())
   , mMonitor("WebRTCMic.Monitor")
   , mCapIndex(aIndex)
   , mDelayAgnostic(aDelayAgnostic)
   , mExtendedFilter(aExtendedFilter)
   , mTrackID(TRACK_NONE)
   , mStarted(false)
   , mSampleFrequency(MediaEngine::USE_GRAPH_RATE)
   , mTotalFrames(0)
@@ -497,17 +498,16 @@ MediaEngineWebRTCMicrophoneSource::Updat
     UpdateNSSettingsIfNeeded(prefs.mNoiseOn, static_cast<NsModes>(prefs.mNoise));
     UpdateAECSettingsIfNeeded(prefs.mAecOn, static_cast<EcModes>(prefs.mAec));
 
     webrtc::Config config;
     config.Set<webrtc::ExtendedFilter>(new webrtc::ExtendedFilter(mExtendedFilter));
     config.Set<webrtc::DelayAgnostic>(new webrtc::DelayAgnostic(mDelayAgnostic));
     mAudioProcessing->SetExtraOptions(config);
   }
-
   SetLastPrefs(prefs);
   return NS_OK;
 }
 
 #undef HANDLE_APM_ERROR
 
 void
 MediaEngineWebRTCMicrophoneSource::SetLastPrefs(