Bug 694814: Patch 5 - Move AEC from PeerConnection to getUserMedia rs=padenot

This commit is contained in:
Randell Jesup 2014-04-02 13:58:19 -04:00
parent 54ff846572
commit d63ba60c75
4 changed files with 27 additions and 46 deletions

View File

@ -188,11 +188,19 @@ MediaEngineWebRTCAudioSource::Config(bool aEchoOn, uint32_t aEcho,
aAgcOn ? aAGC : -1,
aNoiseOn ? aNoise : -1));
bool update_agc = (mAgcOn == aAgcOn);
bool update_noise = (mNoiseOn == aNoiseOn);
bool update_echo = (mEchoOn != aEchoOn);
bool update_agc = (mAgcOn != aAgcOn);
bool update_noise = (mNoiseOn != aNoiseOn);
mEchoOn = aEchoOn;
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;
@ -209,17 +217,11 @@ MediaEngineWebRTCAudioSource::Config(bool aEchoOn, uint32_t aEcho,
if (mInitDone) {
int 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_echo &&
0 != (error = mVoEProcessing->SetEcStatus(mEchoOn, (webrtc::EcModes) aEcho))) {
LOG(("%s Error setting Echo Status: %d ",__FUNCTION__, error));
}
if (update_agc &&
0 != (error = mVoEProcessing->SetAgcStatus(mAgcOn, (webrtc::AgcModes) aAGC))) {

View File

@ -571,18 +571,6 @@ 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<MediaOperationRunnable> 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;
@ -613,6 +601,18 @@ 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<MediaOperationRunnable> 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;

View File

@ -413,27 +413,11 @@ WebrtcAudioConduit::ConfigureSendMediaCodec(const AudioCodecConfig* codecConfig)
nsCOMPtr<nsIPrefBranch> 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<webrtc::EcModes>(aec) != webrtc::kEcUnchanged)
mEchoCancel = static_cast<webrtc::EcModes>(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)
{

View File

@ -162,8 +162,6 @@ public:
mChannel(-1),
mCurSendCodecConfig(nullptr),
mCaptureDelay(150),
mEchoOn(true),
mEchoCancel(webrtc::kEcAec),
#ifdef MOZILLA_INTERNAL_API
mLastTimestamp(0),
#endif // MOZILLA_INTERNAL_API
@ -264,9 +262,6 @@ 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