diff options
-rw-r--r-- | chrome/renderer/media/audio_renderer_impl.cc | 7 | ||||
-rw-r--r-- | media/filters/audio_renderer_impl.cc | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/chrome/renderer/media/audio_renderer_impl.cc b/chrome/renderer/media/audio_renderer_impl.cc index 783acf3..6b1ecf0 100644 --- a/chrome/renderer/media/audio_renderer_impl.cc +++ b/chrome/renderer/media/audio_renderer_impl.cc @@ -291,6 +291,13 @@ void AudioRendererImpl::OnNotifyPacketReady() { } } + // Finally we need to adjust the delay according to playback rate. + if (GetPlaybackRate() != 1.0f) { + request_delay = base::TimeDelta::FromMicroseconds( + static_cast<int64>(ceil(request_delay.InMicroseconds() * + GetPlaybackRate()))); + } + size_t filled = FillBuffer(static_cast<uint8*>(shared_memory_->memory()), shared_memory_size_, request_delay); diff --git a/media/filters/audio_renderer_impl.cc b/media/filters/audio_renderer_impl.cc index cf31af7..180dc35 100644 --- a/media/filters/audio_renderer_impl.cc +++ b/media/filters/audio_renderer_impl.cc @@ -57,6 +57,7 @@ size_t AudioRendererImpl::OnMoreData(AudioOutputStream* stream, void* dest_void, // TODO(scherkus): Maybe change OnMoreData to pass in char/uint8 or similar. // TODO(fbarchard): Waveout_output_win.h should handle zero length buffers // without clicking. + pending_bytes = static_cast<int>(ceil(pending_bytes * GetPlaybackRate())); base::TimeDelta delay = base::TimeDelta::FromMicroseconds( base::Time::kMicrosecondsPerSecond * pending_bytes / bytes_per_second_); return FillBuffer(static_cast<uint8*>(dest_void), len, delay); |