Fix playback rate w/o audio.  Remove unused SetPlaybackRate().

NullAudioSink doesn't need to worry about playback rate since
AudioRendererAlgorithm already compresses/expands the data as
necessary.

The issue is easily seen by playing any of the sync clips and
timing how fast it takes for each rotation of the "clock" in
the video.  Setting playback rate to 2 will actually end up
being 4x as fast currently.

As a bonus, dropping this allows us to remove the now unused
AudioRendererSink::SetPlaybackRate() method.

BUG=none (?)
TEST=Play sync clip, time "clock" rotation at various speeds.


Review URL: https://chromiumcodereview.appspot.com/10837032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149452 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/renderer/media/render_audiosourceprovider.cc b/content/renderer/media/render_audiosourceprovider.cc
index d450d9d..a1051e0 100644
--- a/content/renderer/media/render_audiosourceprovider.cc
+++ b/content/renderer/media/render_audiosourceprovider.cc
@@ -115,12 +115,6 @@
   is_running_ = false;
 }
 
-void RenderAudioSourceProvider::SetPlaybackRate(float rate) {
-  base::AutoLock auto_lock(sink_lock_);
-  if (!client_)
-    default_sink_->SetPlaybackRate(rate);
-}
-
 bool RenderAudioSourceProvider::SetVolume(double volume) {
   base::AutoLock auto_lock(sink_lock_);
   if (!client_)
diff --git a/content/renderer/media/render_audiosourceprovider.h b/content/renderer/media/render_audiosourceprovider.h
index bc19fc3..006a30f5 100644
--- a/content/renderer/media/render_audiosourceprovider.h
+++ b/content/renderer/media/render_audiosourceprovider.h
@@ -56,7 +56,6 @@
   virtual void Stop() OVERRIDE;
   virtual void Play() OVERRIDE;
   virtual void Pause(bool flush) OVERRIDE;
-  virtual void SetPlaybackRate(float rate) OVERRIDE;
   virtual bool SetVolume(double volume) OVERRIDE;
   virtual void Initialize(const media::AudioParameters& params,
                           RenderCallback* renderer) OVERRIDE;
diff --git a/media/audio/null_audio_sink.cc b/media/audio/null_audio_sink.cc
index 6c16464..d98aa63 100644
--- a/media/audio/null_audio_sink.cc
+++ b/media/audio/null_audio_sink.cc
@@ -13,7 +13,6 @@
 
 NullAudioSink::NullAudioSink()
     : initialized_(false),
-      playback_rate_(0.0),
       playing_(false),
       callback_(NULL),
       thread_("NullAudioThread"),
@@ -62,11 +61,6 @@
   SetPlaying(false);
 }
 
-void NullAudioSink::SetPlaybackRate(float rate) {
-  base::AutoLock auto_lock(lock_);
-  playback_rate_ = rate;
-}
-
 bool NullAudioSink::SetVolume(double volume) {
   // Audio is always muted.
   return volume == 0.0;
@@ -89,7 +83,6 @@
   base::TimeDelta delay;
   // Only consume buffers when actually playing.
   if (playing_)  {
-    DCHECK_GT(playback_rate_, 0.0f);
     int requested_frames = params_.frames_per_buffer();
     int frames_received = callback_->Render(audio_data_, requested_frames, 0);
     int frames_per_millisecond =
@@ -111,9 +104,9 @@
       }
     }
 
-    // Calculate our sleep duration, taking playback rate into consideration.
+    // Calculate our sleep duration.
     delay = base::TimeDelta::FromMilliseconds(
-        frames_received / (frames_per_millisecond * playback_rate_));
+        frames_received / frames_per_millisecond);
   } else {
     // If paused, sleep for 10 milliseconds before polling again.
     delay = base::TimeDelta::FromMilliseconds(10);
diff --git a/media/audio/null_audio_sink.h b/media/audio/null_audio_sink.h
index b17b7c7..db32df0e 100644
--- a/media/audio/null_audio_sink.h
+++ b/media/audio/null_audio_sink.h
@@ -33,7 +33,6 @@
   virtual void Stop() OVERRIDE;
   virtual void Pause(bool flush) OVERRIDE;
   virtual void Play() OVERRIDE;
-  virtual void SetPlaybackRate(float rate) OVERRIDE;
   virtual bool SetVolume(double volume) OVERRIDE;
 
   // Enables audio frame hashing and reinitializes the MD5 context.  Must be
@@ -58,7 +57,6 @@
 
   AudioParameters params_;
   bool initialized_;
-  float playback_rate_;
   bool playing_;
   RenderCallback* callback_;
 
diff --git a/media/base/audio_renderer_sink.h b/media/base/audio_renderer_sink.h
index 3756daaf..8786fe1 100644
--- a/media/base/audio_renderer_sink.h
+++ b/media/base/audio_renderer_sink.h
@@ -55,10 +55,6 @@
   // Resumes playback after calling Pause().
   virtual void Play() = 0;
 
-  // Called to inform the sink of a change in playback rate. Override if
-  // subclass needs the playback rate.
-  virtual void SetPlaybackRate(float rate) {}
-
   // Sets the playback volume, with range [0.0, 1.0] inclusive.
   // Returns |true| on success.
   virtual bool SetVolume(double volume) = 0;
diff --git a/media/filters/audio_renderer_impl.cc b/media/filters/audio_renderer_impl.cc
index 70363d50..af376a4 100644
--- a/media/filters/audio_renderer_impl.cc
+++ b/media/filters/audio_renderer_impl.cc
@@ -306,9 +306,6 @@
   DCHECK_LE(0.0f, playback_rate);
 
   if (!stopped_) {
-    // Notify sink of new playback rate.
-    sink_->SetPlaybackRate(playback_rate);
-
     // We have two cases here:
     // Play: GetPlaybackRate() == 0.0 && playback_rate != 0.0
     // Pause: GetPlaybackRate() != 0.0 && playback_rate == 0.0