Bug 1187817. Part 2 - remove unused code. r=kinetik.
authorJW Wang <jwwang@mozilla.com>
Fri, 31 Jul 2015 13:26:06 +0800
changeset 287251 f8721ef7b2b272369fde58ab1edfa4dc4d04c46a
parent 287250 ecf03b35eac02455ad1b8080f78400e5040329df
child 287252 6ea02f2b59af6736e4f2002297e03376de3c3c85
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1187817
milestone42.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 1187817. Part 2 - remove unused code. r=kinetik.
dom/media/AudioSink.cpp
dom/media/AudioSink.h
--- a/dom/media/AudioSink.cpp
+++ b/dom/media/AudioSink.cpp
@@ -31,23 +31,17 @@ AudioSink::AudioSink(MediaQueue<MediaDat
   , mMonitor("AudioSink::mMonitor")
   , mState(AUDIOSINK_STATE_INIT)
   , mAudioLoopScheduled(false)
   , mStartTime(aStartTime)
   , mWritten(0)
   , mLastGoodPosition(0)
   , mInfo(aInfo)
   , mChannel(aChannel)
-  , mVolume(1.0)
-  , mPlaybackRate(1.0)
-  , mPreservesPitch(false)
   , mStopAudioThread(false)
-  , mSetVolume(false)
-  , mSetPlaybackRate(false)
-  , mSetPreservesPitch(false)
   , mPlaying(true)
 {
 }
 
 void
 AudioSink::SetState(State aState)
 {
   AssertOnAudioThread();
@@ -221,17 +215,16 @@ AudioSink::InitializeAudioStream()
                                   mChannel, AudioStream::HighLatency);
   if (NS_FAILED(rv)) {
     audioStream->Shutdown();
     return rv;
   }
 
   ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
   mAudioStream = audioStream;
-  UpdateStreamSettings();
 
   return NS_OK;
 }
 
 void
 AudioSink::Drain()
 {
   MOZ_ASSERT(mPlaying && !mAudioStream->IsPaused());
@@ -285,18 +278,16 @@ AudioSink::IsPlaybackContinuing()
   }
 
   // If we're shutting down, captured, or at EOS, break out and exit the audio
   // thread.
   if (mStopAudioThread || AudioQueue().AtEndOfStream()) {
     return false;
   }
 
-  UpdateStreamSettings();
-
   return true;
 }
 
 void
 AudioSink::AudioLoop()
 {
   AssertOnAudioThread();
   mAudioLoopScheduled = false;
@@ -446,50 +437,16 @@ AudioSink::PlayFromAudioQueue()
   }
 
   StartAudioStreamPlaybackIfNeeded();
 
   return audio->mFrames;
 }
 
 void
-AudioSink::UpdateStreamSettings()
-{
-  AssertCurrentThreadInMonitor();
-
-  bool setVolume = mSetVolume;
-  bool setPlaybackRate = mSetPlaybackRate;
-  bool setPreservesPitch = mSetPreservesPitch;
-  double volume = mVolume;
-  double playbackRate = mPlaybackRate;
-  bool preservesPitch = mPreservesPitch;
-
-  mSetVolume = false;
-  mSetPlaybackRate = false;
-  mSetPreservesPitch = false;
-
-  {
-    ReentrantMonitorAutoExit exit(GetReentrantMonitor());
-    if (setVolume) {
-      mAudioStream->SetVolume(volume);
-    }
-
-    if (setPlaybackRate &&
-        NS_FAILED(mAudioStream->SetPlaybackRate(playbackRate))) {
-      NS_WARNING("Setting the playback rate failed in AudioSink.");
-    }
-
-    if (setPreservesPitch &&
-      NS_FAILED(mAudioStream->SetPreservesPitch(preservesPitch))) {
-      NS_WARNING("Setting the pitch preservation failed in AudioSink.");
-    }
-  }
-}
-
-void
 AudioSink::StartAudioStreamPlaybackIfNeeded()
 {
   // This value has been chosen empirically.
   const uint32_t MIN_WRITE_BEFORE_START_USECS = 200000;
 
   // We want to have enough data in the buffer to start the stream.
   if (static_cast<double>(mAudioStream->GetWritten()) / mAudioStream->GetRate() >=
       static_cast<double>(MIN_WRITE_BEFORE_START_USECS) / USECS_PER_S) {
--- a/dom/media/AudioSink.h
+++ b/dom/media/AudioSink.h
@@ -109,18 +109,16 @@ private:
   // impossibly large chunk of memory in order to play back silence. Called
   // on the audio thread.
   uint32_t PlaySilence(uint32_t aFrames);
 
   // Pops an audio chunk from the front of the audio queue, and pushes its
   // audio data to the audio hardware.  Called on the audio thread.
   uint32_t PlayFromAudioQueue();
 
-  void UpdateStreamSettings();
-
   // If we have already written enough frames to the AudioStream, start the
   // playback.
   void StartAudioStreamPlaybackIfNeeded();
   void WriteSilence(uint32_t aFrames);
 
   MediaQueue<MediaData>& AudioQueue() const {
     return mAudioQueue;
   }
@@ -167,26 +165,18 @@ private:
   // position returned by GetPosition() is mono-increasing in spite of audio
   // stream error.
   int64_t mLastGoodPosition;
 
   const AudioInfo mInfo;
 
   dom::AudioChannel mChannel;
 
-  double mVolume;
-  double mPlaybackRate;
-  bool mPreservesPitch;
-
   bool mStopAudioThread;
 
-  bool mSetVolume;
-  bool mSetPlaybackRate;
-  bool mSetPreservesPitch;
-
   bool mPlaying;
 
   MozPromiseHolder<GenericPromise> mEndPromise;
 };
 
 } // namespace mozilla
 
 #endif