From c824757a77cc1fc5c1371af9665c028895ebb4af Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Mon, 7 Apr 2014 15:37:50 -0400 Subject: [PATCH] Backed out changeset 6dc08e9fc7e8 (bug 694814) --- .../media/webrtc/MediaEngineWebRTCAudio.cpp | 28 +++++++++---------- dom/media/MediaManager.cpp | 24 ++++++++-------- .../src/media-conduit/AudioConduit.cpp | 16 +++++++++++ .../src/media-conduit/AudioConduit.h | 5 ++++ 4 files changed, 46 insertions(+), 27 deletions(-) diff --git a/content/media/webrtc/MediaEngineWebRTCAudio.cpp b/content/media/webrtc/MediaEngineWebRTCAudio.cpp index ef55502f362..eb163c36449 100644 --- a/content/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/content/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -188,19 +188,11 @@ MediaEngineWebRTCAudioSource::Config(bool aEchoOn, uint32_t aEcho, aAgcOn ? aAGC : -1, aNoiseOn ? aNoise : -1)); - bool update_echo = (mEchoOn != aEchoOn); - bool update_agc = (mAgcOn != aAgcOn); - bool update_noise = (mNoiseOn != aNoiseOn); - mEchoOn = aEchoOn; + bool update_agc = (mAgcOn == aAgcOn); + bool update_noise = (mNoiseOn == aNoiseOn); mAgcOn = aAgcOn; mNoiseOn = aNoiseOn; - if ((webrtc::EcModes) aEcho != webrtc::kEcUnchanged) { - if (mEchoCancel != (webrtc::EcModes) aEcho) { - update_echo = true; - mEchoCancel = (webrtc::EcModes) aEcho; - } - } if ((webrtc::AgcModes) aAGC != webrtc::kAgcUnchanged) { if (mAGC != (webrtc::AgcModes) aAGC) { update_agc = true; @@ -217,11 +209,17 @@ MediaEngineWebRTCAudioSource::Config(bool aEchoOn, uint32_t aEcho, if (mInitDone) { int error; - - if (update_echo && - 0 != (error = mVoEProcessing->SetEcStatus(mEchoOn, (webrtc::EcModes) aEcho))) { - LOG(("%s Error setting Echo Status: %d ",__FUNCTION__, error)); - } +#if 0 + // Until we can support feeding our full output audio from the browser + // through the MediaStream, this won't work. Or we need to move AEC to + // below audio input and output, perhaps invoked from here. + mEchoOn = aEchoOn; + if ((webrtc::EcModes) aEcho != webrtc::kEcUnchanged) + mEchoCancel = (webrtc::EcModes) aEcho; + mVoEProcessing->SetEcStatus(mEchoOn, aEcho); +#else + (void) aEcho; (void) aEchoOn; (void) mEchoCancel; // suppress warnings +#endif if (update_agc && 0 != (error = mVoEProcessing->SetAgcStatus(mAgcOn, (webrtc::AgcModes) aAGC))) { diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index acfe1d6a194..a31b1ce459e 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -571,6 +571,18 @@ public: TracksAvailableCallback* tracksAvailableCallback = new TracksAvailableCallback(mManager, mSuccess, mWindowID, trackunion); + // 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 runnable( + new MediaOperationRunnable(MEDIA_START, mListener, trackunion, + tracksAvailableCallback, + mAudioSource, mVideoSource, false, mWindowID, + mError.forget())); + mediaThread->Dispatch(runnable, NS_DISPATCH_NORMAL); + #ifdef MOZ_WEBRTC // Right now these configs are only of use if webrtc is available nsresult rv; @@ -601,18 +613,6 @@ public: } #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 runnable( - new MediaOperationRunnable(MEDIA_START, mListener, trackunion, - tracksAvailableCallback, - mAudioSource, mVideoSource, false, mWindowID, - mError.forget())); - mediaThread->Dispatch(runnable, NS_DISPATCH_NORMAL); - // We won't need mError now. mError = nullptr; return NS_OK; diff --git a/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp b/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp index 10fb7aefe1d..a0df599d19e 100644 --- a/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp +++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp @@ -413,11 +413,27 @@ WebrtcAudioConduit::ConfigureSendMediaCodec(const AudioCodecConfig* codecConfig) nsCOMPtr branch = do_QueryInterface(prefs); if (branch) { + int32_t aec = 0; // 0 == unchanged + bool aec_on = false; + + branch->GetBoolPref("media.peerconnection.aec_enabled", &aec_on); + branch->GetIntPref("media.peerconnection.aec", &aec); + + CSFLogDebug(logTag,"Audio config: aec: %d", aec_on ? aec : -1); + mEchoOn = aec_on; + if (static_cast(aec) != webrtc::kEcUnchanged) + mEchoCancel = static_cast(aec); + branch->GetIntPref("media.peerconnection.capture_delay", &mCaptureDelay); } } #endif + if (0 != (error = mPtrVoEProcessing->SetEcStatus(mEchoOn, mEchoCancel))) { + CSFLogError(logTag,"%s Error setting EVStatus: %d ",__FUNCTION__, error); + return kMediaConduitUnknownError; + } + //Let's Send Transport State-machine on the Engine if(mPtrVoEBase->StartSend(mChannel) == -1) { diff --git a/media/webrtc/signaling/src/media-conduit/AudioConduit.h b/media/webrtc/signaling/src/media-conduit/AudioConduit.h index c83667e8544..5211c734a93 100755 --- a/media/webrtc/signaling/src/media-conduit/AudioConduit.h +++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.h @@ -162,6 +162,8 @@ public: mChannel(-1), mCurSendCodecConfig(nullptr), mCaptureDelay(150), + mEchoOn(true), + mEchoCancel(webrtc::kEcAec), #ifdef MOZILLA_INTERNAL_API mLastTimestamp(0), #endif // MOZILLA_INTERNAL_API @@ -262,6 +264,9 @@ private: // Current "capture" delay (really output plus input delay) int32_t mCaptureDelay; + bool mEchoOn; + webrtc::EcModes mEchoCancel; + #ifdef MOZILLA_INTERNAL_API uint32_t mLastTimestamp; #endif // MOZILLA_INTERNAL_API