diff --git a/content/media/webrtc/MediaEngine.h b/content/media/webrtc/MediaEngine.h index 28d766654459..bb3f2ccbf134 100644 --- a/content/media/webrtc/MediaEngine.h +++ b/content/media/webrtc/MediaEngine.h @@ -101,7 +101,8 @@ public: /* Change device configuration. */ virtual nsresult Config(bool aEchoOn, uint32_t aEcho, bool aAgcOn, uint32_t aAGC, - bool aNoiseOn, uint32_t aNoise) = 0; + bool aNoiseOn, uint32_t aNoise, + int32_t aPlayoutDelay) = 0; /* Returns true if a source represents a fake capture device and * false otherwise diff --git a/content/media/webrtc/MediaEngineDefault.h b/content/media/webrtc/MediaEngineDefault.h index ef19c6ad0099..16ff49c213ca 100644 --- a/content/media/webrtc/MediaEngineDefault.h +++ b/content/media/webrtc/MediaEngineDefault.h @@ -48,7 +48,8 @@ public: virtual nsresult Snapshot(uint32_t aDuration, nsIDOMFile** aFile); virtual nsresult Config(bool aEchoOn, uint32_t aEcho, bool aAgcOn, uint32_t aAGC, - bool aNoiseOn, uint32_t aNoise) { return NS_OK; }; + bool aNoiseOn, uint32_t aNoise, + int32_t aPlayoutDelay) { return NS_OK; }; virtual void NotifyPull(MediaStreamGraph* aGraph, SourceMediaStream *aSource, TrackID aId, @@ -100,7 +101,8 @@ public: virtual nsresult Snapshot(uint32_t aDuration, nsIDOMFile** aFile); virtual nsresult Config(bool aEchoOn, uint32_t aEcho, bool aAgcOn, uint32_t aAGC, - bool aNoiseOn, uint32_t aNoise) { return NS_OK; }; + bool aNoiseOn, uint32_t aNoise, + int32_t aPlayoutDelay) { return NS_OK; }; virtual void NotifyPull(MediaStreamGraph* aGraph, SourceMediaStream *aSource, TrackID aId, diff --git a/content/media/webrtc/MediaEngineTabVideoSource.cpp b/content/media/webrtc/MediaEngineTabVideoSource.cpp index a9382902c080..6a65350a5b8b 100644 --- a/content/media/webrtc/MediaEngineTabVideoSource.cpp +++ b/content/media/webrtc/MediaEngineTabVideoSource.cpp @@ -288,7 +288,7 @@ MediaEngineTabVideoSource::Stop(mozilla::SourceMediaStream*, mozilla::TrackID) } nsresult -MediaEngineTabVideoSource::Config(bool, uint32_t, bool, uint32_t, bool, uint32_t) +MediaEngineTabVideoSource::Config(bool, uint32_t, bool, uint32_t, bool, uint32_t, int32_t) { return NS_OK; } diff --git a/content/media/webrtc/MediaEngineTabVideoSource.h b/content/media/webrtc/MediaEngineTabVideoSource.h index 058b47dec46a..9bf8c177f3b4 100644 --- a/content/media/webrtc/MediaEngineTabVideoSource.h +++ b/content/media/webrtc/MediaEngineTabVideoSource.h @@ -26,7 +26,7 @@ class MediaEngineTabVideoSource : public MediaEngineVideoSource, nsIDOMEventList virtual nsresult Snapshot(uint32_t, nsIDOMFile**); virtual void NotifyPull(mozilla::MediaStreamGraph*, mozilla::SourceMediaStream*, mozilla::TrackID, mozilla::StreamTime, mozilla::TrackTicks&); virtual nsresult Stop(mozilla::SourceMediaStream*, mozilla::TrackID); - virtual nsresult Config(bool, uint32_t, bool, uint32_t, bool, uint32_t); + virtual nsresult Config(bool, uint32_t, bool, uint32_t, bool, uint32_t, int32_t); virtual bool IsFake(); void Draw(); diff --git a/content/media/webrtc/MediaEngineWebRTC.h b/content/media/webrtc/MediaEngineWebRTC.h index b9d63e830500..f94747095c44 100644 --- a/content/media/webrtc/MediaEngineWebRTC.h +++ b/content/media/webrtc/MediaEngineWebRTC.h @@ -148,7 +148,8 @@ public: virtual nsresult Snapshot(uint32_t aDuration, nsIDOMFile** aFile); virtual nsresult Config(bool aEchoOn, uint32_t aEcho, bool aAgcOn, uint32_t aAGC, - bool aNoiseOn, uint32_t aNoise) { return NS_OK; }; + bool aNoiseOn, uint32_t aNoise, + int32_t aPlayoutDelay) { return NS_OK; }; virtual void NotifyPull(MediaStreamGraph* aGraph, SourceMediaStream *aSource, TrackID aId, @@ -264,6 +265,7 @@ public: , mEchoCancel(webrtc::kEcDefault) , mAGC(webrtc::kAgcDefault) , mNoiseSuppress(webrtc::kNsDefault) + , mPlayoutDelay(0) , mNullTransport(nullptr) { MOZ_ASSERT(aVoiceEnginePtr); mState = kReleased; @@ -283,7 +285,8 @@ public: virtual nsresult Snapshot(uint32_t aDuration, nsIDOMFile** aFile); virtual nsresult Config(bool aEchoOn, uint32_t aEcho, bool aAgcOn, uint32_t aAGC, - bool aNoiseOn, uint32_t aNoise); + bool aNoiseOn, uint32_t aNoise, + int32_t aPlayoutDelay); virtual void NotifyPull(MediaStreamGraph* aGraph, SourceMediaStream *aSource, @@ -334,6 +337,7 @@ private: webrtc::EcModes mEchoCancel; webrtc::AgcModes mAGC; webrtc::NsModes mNoiseSuppress; + int32_t mPlayoutDelay; NullTransport *mNullTransport; }; diff --git a/content/media/webrtc/MediaEngineWebRTCAudio.cpp b/content/media/webrtc/MediaEngineWebRTCAudio.cpp index 057dfdea5439..eb163c364494 100644 --- a/content/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/content/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -180,7 +180,8 @@ MediaEngineWebRTCAudioSource::GetUUID(nsAString& aUUID) nsresult MediaEngineWebRTCAudioSource::Config(bool aEchoOn, uint32_t aEcho, bool aAgcOn, uint32_t aAGC, - bool aNoiseOn, uint32_t aNoise) + bool aNoiseOn, uint32_t aNoise, + int32_t aPlayoutDelay) { LOG(("Audio config: aec: %d, agc: %d, noise: %d", aEchoOn ? aEcho : -1, @@ -204,6 +205,7 @@ MediaEngineWebRTCAudioSource::Config(bool aEchoOn, uint32_t aEcho, mNoiseSuppress = (webrtc::NsModes) aNoise; } } + mPlayoutDelay = aPlayoutDelay; if (mInitDone) { int error; diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 0ff975fe3236..a31b1ce459ee 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -595,6 +595,7 @@ public: int32_t agc = (int32_t) webrtc::kAgcUnchanged; int32_t noise = (int32_t) webrtc::kNsUnchanged; bool aec_on = false, agc_on = false, noise_on = false; + int32_t playout_delay = 0; branch->GetBoolPref("media.peerconnection.aec_enabled", &aec_on); branch->GetIntPref("media.peerconnection.aec", &aec); @@ -602,10 +603,12 @@ public: branch->GetIntPref("media.peerconnection.agc", &agc); branch->GetBoolPref("media.peerconnection.noise_enabled", &noise_on); branch->GetIntPref("media.peerconnection.noise", &noise); + branch->GetIntPref("media.peerconnection.playout_delay", &playout_delay); mListener->AudioConfig(aec_on, (uint32_t) aec, agc_on, (uint32_t) agc, - noise_on, (uint32_t) noise); + noise_on, (uint32_t) noise, + playout_delay); } } #endif diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index 5f07421ec161..b1b9bc6a2c2e 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -128,7 +128,8 @@ public: void AudioConfig(bool aEchoOn, uint32_t aEcho, bool aAgcOn, uint32_t aAGC, - bool aNoiseOn, uint32_t aNoise) + bool aNoiseOn, uint32_t aNoise, + int32_t aPlayoutDelay) { if (mAudioSource) { #ifdef MOZ_WEBRTC @@ -136,7 +137,7 @@ public: RUN_ON_THREAD(mMediaThread, WrapRunnable(nsRefPtr(mAudioSource), // threadsafe &MediaEngineSource::Config, - aEchoOn, aEcho, aAgcOn, aAGC, aNoiseOn, aNoise), + aEchoOn, aEcho, aAgcOn, aAGC, aNoiseOn, aNoise, aPlayoutDelay), NS_DISPATCH_NORMAL); #endif }