summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/media
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 00:09:53 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 00:09:53 +0000
commit89ce4597eeb392be29e8e7e58d991742cfd38a41 (patch)
treeecd7dadb4358a57cc149f8ad71cb407c29573734 /chrome/renderer/media
parent8e334099687557dcdca8128626ef46c857db2dcc (diff)
downloadchromium_src-89ce4597eeb392be29e8e7e58d991742cfd38a41.zip
chromium_src-89ce4597eeb392be29e8e7e58d991742cfd38a41.tar.gz
chromium_src-89ce4597eeb392be29e8e7e58d991742cfd38a41.tar.bz2
Make audio and video in sync while playback rate != 1.0
BUG=20290 TEST=play a video with rate 0.5, audio and video should be in sync This change use the playback rate as a scaling factor for delay introduced in the audio hardware buffer. After we scaled the amount of audio buffer not played, we'll be able to make audio / video in sync again. Review URL: http://codereview.chromium.org/174584 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24568 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/media')
-rw-r--r--chrome/renderer/media/audio_renderer_impl.cc7
1 files changed, 7 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);