Bug 1420162 - Remove USE_GRAPH_RATE because it's the default now, and we don't support anything else. r=jib
authorPaul Adenot <paul@paul.cx>
Tue, 16 Jan 2018 18:26:29 +0100
changeset 453766 66109b983e1be9e2162e832c5b7c2e07f1b8decf
parent 453765 47ef66d8992edf8ccb4b92ab4242e3385fb2dc1c
child 453767 2ab411552083446b4eabf10c2839f952baa95e88
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1420162
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1420162 - Remove USE_GRAPH_RATE because it's the default now, and we don't support anything else. r=jib
dom/media/webrtc/MediaEngine.h
dom/media/webrtc/MediaEngineWebRTCAudio.cpp
--- a/dom/media/webrtc/MediaEngine.h
+++ b/dom/media/webrtc/MediaEngine.h
@@ -48,21 +48,16 @@ public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaEngine)
 
   static const int DEFAULT_VIDEO_FPS = 30;
   static const int DEFAULT_43_VIDEO_WIDTH = 640;
   static const int DEFAULT_43_VIDEO_HEIGHT = 480;
   static const int DEFAULT_169_VIDEO_WIDTH = 1280;
   static const int DEFAULT_169_VIDEO_HEIGHT = 720;
 
-  // This allows using whatever rate the graph is using for the
-  // MediaStreamTrack. This is useful for microphone data, we know it's already
-  // at the correct rate for insertion in the MSG.
-  static const int USE_GRAPH_RATE = -1;
-
   /* Populate an array of video sources in the nsTArray. Also include devices
    * that are currently unavailable. */
   virtual void EnumerateVideoDevices(dom::MediaSourceEnum,
                                      nsTArray<RefPtr<MediaEngineVideoSource> >*) = 0;
 
   /* Populate an array of audio sources in the nsTArray. Also include devices
    * that are currently unavailable. */
   virtual void EnumerateAudioDevices(dom::MediaSourceEnum,
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -65,17 +65,16 @@ MediaEngineWebRTCMicrophoneSource::Media
   , mAudioInput(aAudioInput)
   , mAudioProcessing(AudioProcessing::Create())
   , mMonitor("WebRTCMic.Monitor")
   , mCapIndex(aIndex)
   , mDelayAgnostic(aDelayAgnostic)
   , mExtendedFilter(aExtendedFilter)
   , mTrackID(TRACK_NONE)
   , mStarted(false)
-  , mSampleFrequency(MediaEngine::USE_GRAPH_RATE)
   , mTotalFrames(0)
   , mLastLogFrames(0)
   , mSkipProcessing(false)
   , mInputDownmixBuffer(MAX_SAMPLING_FREQ * MAX_CHANNELS / 100)
 {
   MOZ_ASSERT(aAudioInput);
   mDeviceName.Assign(NS_ConvertUTF8toUTF16(name));
   mDeviceUUID.Assign(uuid);
@@ -476,19 +475,17 @@ MediaEngineWebRTCMicrophoneSource::Start
   {
     MonitorAutoLock lock(mMonitor);
     mSources.AppendElement(aStream);
     mPrincipalHandles.AppendElement(aPrincipalHandle);
     MOZ_ASSERT(mSources.Length() == mPrincipalHandles.Length());
   }
 
   AudioSegment* segment = new AudioSegment();
-  if (mSampleFrequency == MediaEngine::USE_GRAPH_RATE) {
-    mSampleFrequency = aStream->GraphRate();
-  }
+
   aStream->AddAudioTrack(aID, aStream->GraphRate(), 0, segment, SourceMediaStream::ADDTRACK_QUEUED);
 
   // XXX Make this based on the pref.
   aStream->RegisterForAudioMixing();
   LOG(("Start audio for stream %p", aStream));
 
   if (!mListener) {
     mListener = new mozilla::WebRTCAudioDataListener(this);
@@ -768,17 +765,17 @@ MediaEngineWebRTCMicrophoneSource::Inser
 {
   MonitorAutoLock lock(mMonitor);
   if (mState != kStarted) {
     return;
   }
 
   if (MOZ_LOG_TEST(AudioLogModule(), LogLevel::Debug)) {
     mTotalFrames += aFrames;
-    if (mTotalFrames > mLastLogFrames + mSampleFrequency) { // ~ 1 second
+    if (mTotalFrames > mLastLogFrames + mSources[0]->GraphRate()) { // ~ 1 second
       MOZ_LOG(AudioLogModule(), LogLevel::Debug,
               ("%p: Inserting %zu samples into graph, total frames = %" PRIu64,
                (void*)this, aFrames, mTotalFrames));
       mLastLogFrames = mTotalFrames;
     }
   }
 
   size_t len = mSources.Length();
@@ -889,19 +886,16 @@ MediaEngineWebRTCMicrophoneSource::FreeC
     MOZ_ASSERT(sChannelsOpen > 0);
     --sChannelsOpen;
   }
 }
 
 bool
 MediaEngineWebRTCMicrophoneSource::AllocChannel()
 {
-  mSampleFrequency = MediaEngine::USE_GRAPH_RATE;
-  LOG(("%s: sampling rate %u", __FUNCTION__, mSampleFrequency));
-
   mState = kAllocated;
   sChannelsOpen++;
   return true;
 }
 
 void
 MediaEngineWebRTCMicrophoneSource::Shutdown()
 {