Bug 1187817. Part 2 - remove unused code. r=kinetik.
☠☠ backed out by 42521959e9b9 ☠ ☠
authorJW Wang <jwwang@mozilla.com>
Tue, 28 Jul 2015 20:21:26 +0800
changeset 286592 cf38bd59eb44ac9e78ac96c78b51a3b604f96e1a
parent 286591 264dad192c22bad82d56abbd50f20ff5055e7064
child 286593 d31a0c93969f3190cd8a148d13588335ddee82de
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<AudioDat
   , 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;
@@ -445,50 +436,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<AudioData>& 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