Bug 1397793 - Refactor the code that sets the processing modes. r?pehrsons
MozReview-Commit-ID: IUgAfHawFIz
--- 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(