diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-24 18:00:32 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-24 18:00:32 +0000 |
commit | 1328d55d94cf7b973da1a0a884735c8cbdeb2423 (patch) | |
tree | bbd05bc64668be46fc3804b8ce46d59ac8b44769 /media/audio/simple_sources.cc | |
parent | 21f659de19e3ea874a0958372a311746a0e764c2 (diff) | |
download | chromium_src-1328d55d94cf7b973da1a0a884735c8cbdeb2423.zip chromium_src-1328d55d94cf7b973da1a0a884735c8cbdeb2423.tar.gz chromium_src-1328d55d94cf7b973da1a0a884735c8cbdeb2423.tar.bz2 |
Providing unplayed bytes in audio hardware buffer
BUG=20007
TEST=WinAudioTest.PCMWaveStreamPendingBytes
We used to guess what is in the hardware audio buffer to
perform audio sync. But due the triple buffering and
other platforms has other buffering scheme we need to be
able to know how many bytes are left in the hardware buffer.
We provide this data via AudioCallback::OnMoreData(), so we
can predict when the requested buffer will be played.
Review URL: http://codereview.chromium.org/174243
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24114 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/simple_sources.cc')
-rw-r--r-- | media/audio/simple_sources.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/media/audio/simple_sources.cc b/media/audio/simple_sources.cc index eaf671d..d9b30c7 100644 --- a/media/audio/simple_sources.cc +++ b/media/audio/simple_sources.cc @@ -25,8 +25,8 @@ SineWaveAudioSource::SineWaveAudioSource(Format format, int channels, // The implementation could be more efficient if a lookup table is constructed // but it is efficient enough for our simple needs. -size_t SineWaveAudioSource::OnMoreData(AudioOutputStream* stream, - void* dest, size_t max_size) { +size_t SineWaveAudioSource::OnMoreData(AudioOutputStream* stream, void* dest, + size_t max_size, int pending_bytes) { const double kTwoPi = 2.0 * 3.141592653589; double f = freq_ / sample_freq_; int16* sin_tbl = reinterpret_cast<int16*>(dest); @@ -59,8 +59,8 @@ PushSource::~PushSource() { CleanUp(); } -size_t PushSource::OnMoreData(AudioOutputStream* stream, - void* dest, size_t max_size) { +size_t PushSource::OnMoreData(AudioOutputStream* stream, void* dest, + size_t max_size, int pending_bytes) { size_t copied = 0; while (copied < max_size) { AutoLock auto_lock(lock_); |