Index: media/filters/audio_renderer_impl.cc |
diff --git a/media/filters/audio_renderer_impl.cc b/media/filters/audio_renderer_impl.cc |
index 9b0c098b191ecbdfae2fa85e03c60f2f855aed0b..9754793acb5a229619053907edbf2441bfdf8977 100644 |
--- a/media/filters/audio_renderer_impl.cc |
+++ b/media/filters/audio_renderer_impl.cc |
@@ -52,6 +52,7 @@ AudioRendererImpl::AudioRendererImpl( |
decoders.Pass(), |
set_decryptor_ready_cb)), |
hardware_config_(hardware_config), |
+ playback_rate_(0), |
state_(kUninitialized), |
buffering_state_(BUFFERING_HAVE_NOTHING), |
rendering_(false), |
@@ -80,7 +81,7 @@ void AudioRendererImpl::StartRendering() { |
base::AutoLock auto_lock(lock_); |
// Wait for an eventual call to SetPlaybackRate() to start rendering. |
- if (algorithm_->playback_rate() == 0) { |
+ if (playback_rate_ == 0) { |
DCHECK(!sink_playing_); |
return; |
} |
@@ -93,7 +94,7 @@ void AudioRendererImpl::StartRendering_Locked() { |
DCHECK(task_runner_->BelongsToCurrentThread()); |
DCHECK_EQ(state_, kPlaying); |
DCHECK(!sink_playing_); |
- DCHECK_NE(algorithm_->playback_rate(), 0); |
+ DCHECK_NE(playback_rate_, 0); |
lock_.AssertAcquired(); |
sink_playing_ = true; |
@@ -110,7 +111,7 @@ void AudioRendererImpl::StopRendering() { |
base::AutoLock auto_lock(lock_); |
// Rendering should have already been stopped with a zero playback rate. |
- if (algorithm_->playback_rate() == 0) { |
+ if (playback_rate_ == 0) { |
DCHECK(!sink_playing_); |
return; |
} |
@@ -343,7 +344,7 @@ void AudioRendererImpl::OnAudioBufferStreamInitialized(bool success) { |
// We're all good! Continue initializing the rest of the audio renderer |
// based on the decoder format. |
algorithm_.reset(new AudioRendererAlgorithm()); |
- algorithm_->Initialize(0, audio_parameters_); |
+ algorithm_->Initialize(audio_parameters_); |
ChangeState_Locked(kFlushed); |
@@ -530,8 +531,8 @@ void AudioRendererImpl::SetPlaybackRate(float playback_rate) { |
// We have two cases here: |
// Play: current_playback_rate == 0 && playback_rate != 0 |
// Pause: current_playback_rate != 0 && playback_rate == 0 |
- float current_playback_rate = algorithm_->playback_rate(); |
- algorithm_->SetPlaybackRate(playback_rate); |
+ float current_playback_rate = playback_rate_; |
+ playback_rate_ = playback_rate; |
if (!rendering_) |
return; |
@@ -572,8 +573,7 @@ int AudioRendererImpl::Render(AudioBus* audio_bus, |
return 0; |
} |
- float playback_rate = algorithm_->playback_rate(); |
- if (playback_rate == 0) { |
+ if (playback_rate_ == 0) { |
audio_clock_->WroteSilence(requested_frames, delay_frames); |
return 0; |
} |
@@ -599,9 +599,10 @@ int AudioRendererImpl::Render(AudioBus* audio_bus, |
const base::TimeDelta media_timestamp_before_filling = |
audio_clock_->CurrentMediaTimestamp(base::TimeDelta()); |
if (algorithm_->frames_buffered() > 0) { |
- frames_written = algorithm_->FillBuffer(audio_bus, requested_frames); |
+ frames_written = |
+ algorithm_->FillBuffer(audio_bus, requested_frames, playback_rate_); |
audio_clock_->WroteAudio( |
- frames_written, delay_frames, playback_rate, algorithm_->GetTime()); |
+ frames_written, delay_frames, playback_rate_, algorithm_->GetTime()); |
} |
audio_clock_->WroteSilence(requested_frames - frames_written, delay_frames); |