Backed out changeset 78c3801aed19 (bug 825329) for intermittent orange.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 22 Feb 2013 11:45:32 -0500
changeset 122672 a1c344441241c219c441ded733f478192dc27b5c
parent 122671 dee88fe417fe364ebea9164c1f284908fba3b5f9
child 122673 1861d261f88fc6458995a74799f7ad898a640d21
push id24356
push usergszorc@mozilla.com
push dateSun, 24 Feb 2013 01:00:12 +0000
treeherdermozilla-central@195e706140d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs825329
milestone22.0a1
backs out78c3801aed19f0a30131d71ef69eff8aa7fd25e4
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
Backed out changeset 78c3801aed19 (bug 825329) for intermittent orange.
content/media/AudioStream.cpp
content/media/AudioStream.h
content/media/test/test_playback_rate.html
--- a/content/media/AudioStream.cpp
+++ b/content/media/AudioStream.cpp
@@ -1107,23 +1107,25 @@ AudioClock::AudioClock(AudioStream* aStr
   mOldBaseOffset(0),
   mOldBasePosition(0),
   mPlaybackRateChangeOffset(0),
   mPreviousPosition(0),
   mWritten(0),
   mOutRate(0),
   mInRate(0),
   mPreservesPitch(true),
+  mPlaybackRate(1.0),
   mCompensatingLatency(false)
 {}
 
 void AudioClock::Init()
 {
   mOutRate = mAudioStream->GetRate();
   mInRate = mAudioStream->GetRate();
+  mPlaybackRate = 1.0;
   mOldOutRate = mOutRate;
 }
 
 void AudioClock::UpdateWritePosition(uint32_t aCount)
 {
   mWritten += aCount;
 }
 
@@ -1183,17 +1185,17 @@ void AudioClock::SetPlaybackRate(double 
     mBaseOffset = position;
     mPlaybackRateChangeOffset = mWritten;
     mOutRate = static_cast<int>(mInRate / aPlaybackRate);
   }
 }
 
 double AudioClock::GetPlaybackRate()
 {
-  return static_cast<double>(mOutRate) / mInRate;
+  return mPlaybackRate;
 }
 
 void AudioClock::SetPreservesPitch(bool aPreservesPitch)
 {
   mPreservesPitch = aPreservesPitch;
 }
 
 bool AudioClock::GetPreservesPitch()
--- a/content/media/AudioStream.h
+++ b/content/media/AudioStream.h
@@ -72,16 +72,18 @@ class AudioClock
     // Number of samples effectivelly written in backend, i.e. write position.
     int64_t mWritten;
     // Output rate in Hz (characteristic of the playback rate)
     int mOutRate;
     // Input rate in Hz (characteristic of the media being played)
     int mInRate;
     // True if the we are timestretching, false if we are resampling.
     bool mPreservesPitch;
+    // The current playback rate.
+    double mPlaybackRate;
     // True if we are playing at the old playbackRate after it has been changed.
     bool mCompensatingLatency;
 };
 
 // Access to a single instance of this class must be synchronized by
 // callers, or made from a single thread.  One exception is that access to
 // GetPosition, GetPositionInFrames, SetVolume, and Get{Rate,Channels}
 // is thread-safe without external synchronization.
--- a/content/media/test/test_playback_rate.html
+++ b/content/media/test/test_playback_rate.html
@@ -102,51 +102,17 @@ function onended(e) {
 
   t.bufferingTime = 0;
   // We got "ended" too early, skip these tests.
   if (t.testedForSlowdown && t.testedForNull) {
     is(t.playbackRate, FAST_RATE, "The playback rate should still be "+FAST_RATE+".");
     ok(!t.muted, "The audio should be muted when playing at high speed, but should not appear as such.");
     is(t.currentTime, t.duration, "Current time should be equal to the duration (not change by playback rate).");
   }
-  testResetPlaybackRate(e);
-}
-
-function testResetPlaybackRate(e) {
-  var t = e.target;
-  t.addEventListener("timeupdate", ontimeupdate_resetPlabackRate);
-  t.currentTime = 0.0;
-  t.play();
-  t.timeUpdate = 0;
-}
-
-function ontimeupdate_resetPlabackRate(e) {
-  var t = e.target;
-  if (t.currentTime == 0.0) {
-    return;
-  }
-  if (t.timeUpdate == 0) {
-    t.playbackRate = 0.5;
-    t.timeUpdate++;
-  } else if (t.timeUpdate == 1){
-    t.playbackRate = 1.0;
-    t.startTimestamp = Date.now();
-    t.oldCurrentTime = t.currentTime;
-    t.timeUpdate++;
-  } else {
-    if (t.currentTime < 3 * t.duration / 4) {
-      return;
-    }
-    var delta = t.currentTime - t.oldCurrentTime,
-        delta_wallclock = (Date.now() - t.startTimestamp - t.bufferingTime) / 1000;
-
-    ok(checkPlaybackRate(delta_wallclock, delta, 1.0, 0.25), "PlaybackRate reset.");
-    t.removeEventListener("timeupdate", ontimeupdate_resetPlabackRate);
-    test_defaultPlaybackRate(e);
-  }
+  test_defaultPlaybackRate(e);
 }
 
 function test_defaultPlaybackRate(e) {
   var t = e.target;
   t.currentTime = 0.0;
   t.defaultPlaybackRate = SLOW_RATE;
   t.addEventListener("timeupdate", ontimeupdate_defaultPlaybackRate);
   t.startTimestamp = Date.now();
@@ -164,19 +130,19 @@ function ontimeupdate_defaultPlaybackRat
     t.bufferingTime = 0;
 
     is(t.playbackRate, SLOW_RATE,
         "The playback rate shoud be "+SLOW_RATE+"." + t.token + '\n');
     is(t.defaultPlaybackRate, SLOW_RATE,
         "The default playback rate shoud be "+SLOW_RATE+"." + t.token);
     ok(delta_wallclock > delta , "We are effectively slowing down playback. (" + delta_wallclock + ", " + delta + ")");
     if (t.skippedFastPart) {
-      is(t.ratechangecount, 10, "We should have received 10 \"ratechange\" events.");
+      is(t.ratechangecount, 7, "We should have received 7 \"ratechange\" events.");
     } else {
-      is(t.ratechangecount, 11, "We should have received 11 \"ratechange\" events.");
+      is(t.ratechangecount, 8, "We should have received 8 \"ratechange\" events.");
     }
     finish_test(t);
   }
 }
 
 function onratechange(e) {
   if (!e.target.ratechangecount) {
     e.target.ratechangecount = 0;