Bug 1411742 Remove the pref media.getusermedia.playout_delay and the field as they are not used anywhere r=jib
authorTom Ritter <tom@mozilla.com>
Thu, 16 Nov 2017 21:57:07 -0600
changeset 436975 d82696a3e2596ed75ce7ce8c56b4d58b6215aed4
parent 436974 ef28f0994646603247bab4dab83aebdbb7914aa2
child 436976 36ee1d2ea39db4a934d23fd619511942f04a44e6
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersjib
bugs1411742
milestone59.0a1
Bug 1411742 Remove the pref media.getusermedia.playout_delay and the field as they are not used anywhere r=jib MozReview-Commit-ID: Gjbeg0zWtJ1
dom/media/MediaManager.cpp
dom/media/webrtc/MediaEngine.h
dom/media/webrtc/MediaEngineWebRTC.h
dom/media/webrtc/MediaEngineWebRTCAudio.cpp
media/webrtc/trunk/webrtc/voice_engine/include/voe_external_media.h
media/webrtc/trunk/webrtc/voice_engine/voe_external_media_impl.cc
media/webrtc/trunk/webrtc/voice_engine/voe_external_media_impl.h
modules/libpref/init/all.js
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -1802,35 +1802,34 @@ MediaManager::MediaManager()
   mPrefs.mAec          = webrtc::kEcUnchanged;
   mPrefs.mAgc          = webrtc::kAgcUnchanged;
   mPrefs.mNoise        = webrtc::kNsUnchanged;
 #else
   mPrefs.mAec          = 0;
   mPrefs.mAgc          = 0;
   mPrefs.mNoise        = 0;
 #endif
-  mPrefs.mPlayoutDelay = 0;
   mPrefs.mFullDuplex = false;
   mPrefs.mChannels     = 0; // max channels default
   nsresult rv;
   nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
   if (NS_SUCCEEDED(rv)) {
     nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);
     if (branch) {
       GetPrefs(branch, nullptr);
     }
   }
   LOG(("%s: default prefs: %dx%d @%dfps, %dHz test tones, aec: %s,"
        "agc: %s, noise: %s, aec level: %d, agc level: %d, noise level: %d,"
-       "playout delay: %d, %sfull_duplex, extended aec %s, delay_agnostic %s "
+       "%sfull_duplex, extended aec %s, delay_agnostic %s "
        "channels %d",
        __FUNCTION__, mPrefs.mWidth, mPrefs.mHeight,
        mPrefs.mFPS, mPrefs.mFreq, mPrefs.mAecOn ? "on" : "off",
        mPrefs.mAgcOn ? "on": "off", mPrefs.mNoiseOn ? "on": "off", mPrefs.mAec,
-       mPrefs.mAgc, mPrefs.mNoise, mPrefs.mPlayoutDelay, mPrefs.mFullDuplex ? "" : "not ",
+       mPrefs.mAgc, mPrefs.mNoise, mPrefs.mFullDuplex ? "" : "not ",
        mPrefs.mExtendedFilter ? "on" : "off", mPrefs.mDelayAgnostic ? "on" : "off",
        mPrefs.mChannels));
 }
 
 NS_IMPL_ISUPPORTS(MediaManager, nsIMediaManagerService, nsIObserver)
 
 /* static */ StaticRefPtr<MediaManager> MediaManager::sSingleton;
 
@@ -1892,17 +1891,16 @@ MediaManager::Get() {
       prefs->AddObserver("media.navigator.audio.full_duplex", sSingleton, false);
 #ifdef MOZ_WEBRTC
       prefs->AddObserver("media.getusermedia.aec_enabled", sSingleton, false);
       prefs->AddObserver("media.getusermedia.aec", sSingleton, false);
       prefs->AddObserver("media.getusermedia.agc_enabled", sSingleton, false);
       prefs->AddObserver("media.getusermedia.agc", sSingleton, false);
       prefs->AddObserver("media.getusermedia.noise_enabled", sSingleton, false);
       prefs->AddObserver("media.getusermedia.noise", sSingleton, false);
-      prefs->AddObserver("media.getusermedia.playout_delay", sSingleton, false);
       prefs->AddObserver("media.ondevicechange.fakeDeviceChangeEvent.enabled", sSingleton, false);
       prefs->AddObserver("media.getusermedia.channels", sSingleton, false);
 #endif
     }
 
     // Prepare async shutdown
 
     nsCOMPtr<nsIAsyncShutdownClient> shutdownPhase = GetShutdownPhase();
@@ -3071,17 +3069,16 @@ MediaManager::GetPrefs(nsIPrefBranch *aB
   GetPref(aBranch, "media.navigator.audio.fake_frequency", aData, &mPrefs.mFreq);
 #ifdef MOZ_WEBRTC
   GetPrefBool(aBranch, "media.getusermedia.aec_enabled", aData, &mPrefs.mAecOn);
   GetPrefBool(aBranch, "media.getusermedia.agc_enabled", aData, &mPrefs.mAgcOn);
   GetPrefBool(aBranch, "media.getusermedia.noise_enabled", aData, &mPrefs.mNoiseOn);
   GetPref(aBranch, "media.getusermedia.aec", aData, &mPrefs.mAec);
   GetPref(aBranch, "media.getusermedia.agc", aData, &mPrefs.mAgc);
   GetPref(aBranch, "media.getusermedia.noise", aData, &mPrefs.mNoise);
-  GetPref(aBranch, "media.getusermedia.playout_delay", aData, &mPrefs.mPlayoutDelay);
   GetPrefBool(aBranch, "media.getusermedia.aec_extended_filter", aData, &mPrefs.mExtendedFilter);
   GetPrefBool(aBranch, "media.getusermedia.aec_aec_delay_agnostic", aData, &mPrefs.mDelayAgnostic);
   GetPref(aBranch, "media.getusermedia.channels", aData, &mPrefs.mChannels);
   GetPrefBool(aBranch, "media.ondevicechange.fakeDeviceChangeEvent.enabled", aData, &mPrefs.mFakeDeviceChangeEventOn);
 #endif
   GetPrefBool(aBranch, "media.navigator.audio.full_duplex", aData, &mPrefs.mFullDuplex);
 }
 
@@ -3110,17 +3107,16 @@ MediaManager::Shutdown()
     prefs->RemoveObserver("media.navigator.audio.fake_frequency", this);
 #ifdef MOZ_WEBRTC
     prefs->RemoveObserver("media.getusermedia.aec_enabled", this);
     prefs->RemoveObserver("media.getusermedia.aec", this);
     prefs->RemoveObserver("media.getusermedia.agc_enabled", this);
     prefs->RemoveObserver("media.getusermedia.agc", this);
     prefs->RemoveObserver("media.getusermedia.noise_enabled", this);
     prefs->RemoveObserver("media.getusermedia.noise", this);
-    prefs->RemoveObserver("media.getusermedia.playout_delay", this);
     prefs->RemoveObserver("media.ondevicechange.fakeDeviceChangeEvent.enabled", this);
     prefs->RemoveObserver("media.getusermedia.channels", this);
 #endif
     prefs->RemoveObserver("media.navigator.audio.full_duplex", this);
   }
 
   // Close off any remaining active windows.
   GetActiveWindows()->Clear();
--- a/dom/media/webrtc/MediaEngine.h
+++ b/dom/media/webrtc/MediaEngine.h
@@ -89,17 +89,16 @@ public:
     , mFPS(0)
     , mFreq(0)
     , mAecOn(false)
     , mAgcOn(false)
     , mNoiseOn(false)
     , mAec(0)
     , mAgc(0)
     , mNoise(0)
-    , mPlayoutDelay(0)
     , mFullDuplex(false)
     , mExtendedFilter(false)
     , mDelayAgnostic(false)
     , mFakeDeviceChangeEventOn(false)
     , mChannels(0)
   {}
 
   int32_t mWidth;
@@ -107,17 +106,16 @@ public:
   int32_t mFPS;
   int32_t mFreq; // for test tones (fake:true)
   bool mAecOn;
   bool mAgcOn;
   bool mNoiseOn;
   int32_t mAec;
   int32_t mAgc;
   int32_t mNoise;
-  int32_t mPlayoutDelay;
   bool mFullDuplex;
   bool mExtendedFilter;
   bool mDelayAgnostic;
   bool mFakeDeviceChangeEventOn;
   int32_t mChannels;
 
   // mWidth and/or mHeight may be zero (=adaptive default), so use functions.
 
--- a/dom/media/webrtc/MediaEngineWebRTC.h
+++ b/dom/media/webrtc/MediaEngineWebRTC.h
@@ -629,17 +629,16 @@ private:
   bool mStarted;
 
   nsString mDeviceName;
   nsCString mDeviceUUID;
 
   int32_t mSampleFrequency;
   uint64_t mTotalFrames;
   uint64_t mLastLogFrames;
-  int32_t mPlayoutDelay;
 
   NullTransport *mNullTransport;
 
   nsTArray<int16_t> mInputBuffer;
   // mSkipProcessing is true if none of the processing passes are enabled,
   // because of prefs or constraints. This allows simply copying the audio into
   // the MSG, skipping resampling and the whole webrtc.org code.
   bool mSkipProcessing;
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -202,17 +202,16 @@ MediaEngineWebRTCMicrophoneSource::Media
   , mChannel(-1)
   , mDelayAgnostic(aDelayAgnostic)
   , mExtendedFilter(aExtendedFilter)
   , mTrackID(TRACK_NONE)
   , mStarted(false)
   , mSampleFrequency(MediaEngine::DEFAULT_SAMPLE_RATE)
   , mTotalFrames(0)
   , mLastLogFrames(0)
-  , mPlayoutDelay(0)
   , mNullTransport(nullptr)
   , mSkipProcessing(false)
   , mInputDownmixBuffer(MAX_SAMPLING_FREQ * MAX_CHANNELS / 100)
 {
   MOZ_ASSERT(aVoiceEnginePtr);
   MOZ_ASSERT(aAudioInput);
   mDeviceName.Assign(NS_ConvertUTF8toUTF16(name));
   mDeviceUUID.Assign(uuid);
@@ -304,25 +303,22 @@ MediaEngineWebRTCMicrophoneSource::Updat
   if (prefs.mChannels <= 0) {
     prefs.mChannels = static_cast<int32_t>(maxChannels);
   }
   prefs.mChannels = c.mChannelCount.Get(std::min(prefs.mChannels,
                                         static_cast<int32_t>(maxChannels)));
   // Clamp channelCount to a valid value
   prefs.mChannels = std::max(1, std::min(prefs.mChannels, static_cast<int32_t>(maxChannels)));
 
-  LOG(("Audio config: aec: %d, agc: %d, noise: %d, delay: %d, channels: %d",
+  LOG(("Audio config: aec: %d, agc: %d, noise: %d, channels: %d",
       prefs.mAecOn ? prefs.mAec : -1,
       prefs.mAgcOn ? prefs.mAgc : -1,
       prefs.mNoiseOn ? prefs.mNoise : -1,
-      prefs.mPlayoutDelay,
       prefs.mChannels));
 
-  mPlayoutDelay = prefs.mPlayoutDelay;
-
   switch (mState) {
     case kReleased:
       MOZ_ASSERT(aHandle);
       if (sChannelsOpen == 0) {
         if (!InitEngine()) {
           LOG(("Audio engine is not initalized"));
           return NS_ERROR_FAILURE;
         }
@@ -964,17 +960,16 @@ MediaEngineWebRTCMicrophoneSource::Proce
 
   while (mAudioOutputObserver->Size() > 0) {
     FarEndAudioChunk *buffer = mAudioOutputObserver->Pop(); // only call if size() > 0
     if (buffer) {
       int length = buffer->mSamples;
       int res = mVoERender->ExternalPlayoutData(buffer->mData,
                                                 mAudioOutputObserver->PlayoutFrequency(),
                                                 mAudioOutputObserver->PlayoutChannels(),
-                                                mPlayoutDelay,
                                                 length);
       free(buffer);
       if (res == -1) {
         return;
       }
     }
   }
 
--- a/media/webrtc/trunk/webrtc/voice_engine/include/voe_external_media.h
+++ b/media/webrtc/trunk/webrtc/voice_engine/include/voe_external_media.h
@@ -101,17 +101,17 @@ class WEBRTC_DLLEXPORT VoEExternalMedia 
 
 
   // This function inserts audio written to the OS audio drivers for use
   // as the far-end signal for AEC processing.  The length of the block
   // must be 160, 320, 441 or 480 samples (for 16000, 32000, 44100 or
   // 48000 kHz sampling rates respectively).
   virtual int ExternalPlayoutData(
                                   int16_t speechData10ms[], int samplingFreqHz, int num_channels,
-                                  int current_delay_ms, int& lengthSamples) = 0;
+                                  int& lengthSamples) = 0;
 
   // This function gets audio for an external playout sink.
   // During transmission, this function should be called every ~10 ms
   // to obtain a new 10 ms frame of audio. The length of the block will
   // be 160, 320, 441 or 480 samples (for 16000, 32000, 44100 or
   // 48000 kHz sampling rates respectively).
   virtual int ExternalPlayoutGetData(
                                      int16_t speechData10ms[], int samplingFreqHz,
--- a/media/webrtc/trunk/webrtc/voice_engine/voe_external_media_impl.cc
+++ b/media/webrtc/trunk/webrtc/voice_engine/voe_external_media_impl.cc
@@ -260,24 +260,22 @@ int VoEExternalMediaImpl::SetExternalPla
 // as the "far end" signal for the AEC.  Currently only 10ms chunks are
 // supported unfortunately.  Since we have to rechunk to 10ms to call this,
 // thre isn't much gained by allowing N*10ms here; external code can loop
 // if needed.
 int VoEExternalMediaImpl::ExternalPlayoutData(
     int16_t speechData10ms[],
     int samplingFreqHz,
     int num_channels,
-    int current_delay_ms,
     int& lengthSamples)
 {
     WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(shared_->instance_id(), -1),
                  "ExternalPlayoutData(speechData10ms=0x%x,"
-                 " lengthSamples=%u, samplingFreqHz=%d, current_delay_ms=%d)",
-                 &speechData10ms[0], lengthSamples, samplingFreqHz,
-                 current_delay_ms);
+                 " lengthSamples=%u, samplingFreqHz=%d)",
+                 &speechData10ms[0], lengthSamples, samplingFreqHz);
 
 #ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT
     if (!shared_->statistics().Initialized())
     {
         shared_->SetLastError(VE_NOT_INITED, kTraceError);
         return -1;
     }
     // FIX(jesup) - check if this is enabled?
@@ -289,22 +287,16 @@ int VoEExternalMediaImpl::ExternalPlayou
     }
     if ((16000 != samplingFreqHz) && (32000 != samplingFreqHz) &&
         (48000 != samplingFreqHz) && (44100 != samplingFreqHz))
     {
          shared_->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
              "SetExternalRecordingStatus() invalid sample rate");
         return -1;
     }
-    if (current_delay_ms < 0)
-    {
-        shared_->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
-            "SetExternalRecordingStatus() invalid delay)");
-        return -1;
-    }
 
     // Far-end data is inserted without going through neteq/etc.
     // Only supports 10ms chunks; AnalyzeReverseStream() enforces that
     // lower down.
     AudioFrame audioFrame;
     audioFrame.UpdateFrame(-1, 0xFFFFFFFF,
                            speechData10ms,
                            lengthSamples,
--- a/media/webrtc/trunk/webrtc/voice_engine/voe_external_media_impl.h
+++ b/media/webrtc/trunk/webrtc/voice_engine/voe_external_media_impl.h
@@ -36,17 +36,16 @@ class VoEExternalMediaImpl : public VoEE
         int samplingFreqHz,
         int current_delay_ms) override;
 
   // Insertion of far-end data as actually played out to the OS audio driver
   virtual int ExternalPlayoutData(
         int16_t speechData10ms[],
         int samplingFreqHz,
         int num_channels,
-        int current_delay_ms,
         int& lengthSamples) override;
 
   virtual int ExternalPlayoutGetData(int16_t speechData10ms[],
                                      int samplingFreqHz,
                                      int current_delay_ms,
                                      int& lengthSamples) override;
 
   int GetAudioFrame(int channel,
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -526,37 +526,32 @@ pref("media.getusermedia.aec_delay_agnos
 pref("media.getusermedia.noise", 1);
 pref("media.getusermedia.agc_enabled", false);
 pref("media.getusermedia.agc", 1);
 // capture_delay: Adjustments for OS-specific input delay (lower bound)
 // playout_delay: Adjustments for OS-specific AudioStream+cubeb+output delay (lower bound)
 // full_duplex: enable cubeb full-duplex capture/playback
 #if defined(XP_MACOSX)
 pref("media.peerconnection.capture_delay", 50);
-pref("media.getusermedia.playout_delay", 10);
 pref("media.navigator.audio.full_duplex", true);
 #elif defined(XP_WIN)
 pref("media.peerconnection.capture_delay", 50);
-pref("media.getusermedia.playout_delay", 40);
 pref("media.navigator.audio.full_duplex", true);
 #elif defined(ANDROID)
 pref("media.peerconnection.capture_delay", 100);
-pref("media.getusermedia.playout_delay", 100);
 pref("media.navigator.audio.full_duplex", true);
 pref("media.navigator.hardware.vp8_encode.acceleration_enabled", true);
 pref("media.navigator.hardware.vp8_encode.acceleration_remote_enabled", true);
 pref("media.navigator.hardware.vp8_decode.acceleration_enabled", false);
 #elif defined(XP_LINUX) || defined(MOZ_SNDIO)
 pref("media.peerconnection.capture_delay", 70);
-pref("media.getusermedia.playout_delay", 50);
 pref("media.navigator.audio.full_duplex", true);
 #else
 // *BSD, others - merely a guess for now
 pref("media.peerconnection.capture_delay", 50);
-pref("media.getusermedia.playout_delay", 50);
 pref("media.navigator.audio.full_duplex", false);
 #endif
 // Use MediaDataDecoder API for WebRTC, this includes hardware acceleration for
 // decoding.
 pref("media.navigator.mediadatadecoder_enabled", false);
 #endif
 
 pref("dom.webaudio.enabled", true);