diff options
author | dalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-02 01:38:35 +0000 |
---|---|---|
committer | dalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-02 01:38:35 +0000 |
commit | bd29641c4e11f18183cec46508e51e7e10620b72 (patch) | |
tree | a900d3167629fc309720b55be729bdb9486cc8d5 /media/audio | |
parent | 421cdcd6598d9ed9c21f6ac00a967be79626a5e1 (diff) | |
download | chromium_src-bd29641c4e11f18183cec46508e51e7e10620b72.zip chromium_src-bd29641c4e11f18183cec46508e51e7e10620b72.tar.gz chromium_src-bd29641c4e11f18183cec46508e51e7e10620b72.tar.bz2 |
Wait for the renderer even on WASAPI.
After weeks of investigation, Henrik has been unable find a WASAPI
buffer size that works for all users. Many users are still reporting
glitches. Thus its time to put the WaitTillDataReady() back. :(
BUG=171651
TEST=none
Review URL: https://codereview.chromium.org/12380074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185650 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio')
-rw-r--r-- | media/audio/audio_output_controller.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/media/audio/audio_output_controller.cc b/media/audio/audio_output_controller.cc index 9990389..9120706 100644 --- a/media/audio/audio_output_controller.cc +++ b/media/audio/audio_output_controller.cc @@ -273,6 +273,16 @@ int AudioOutputController::OnMoreIOData(AudioBus* source, DisallowEntryToOnMoreIOData(); TRACE_EVENT0("audio", "AudioOutputController::OnMoreIOData"); + // The OS level audio APIs on Linux and Windows all have problems requesting + // data on a fixed interval. Sometimes they will issue calls back to back + // which can cause glitching, so wait until the renderer is ready for Read(). + // + // See many bugs for context behind this decision: http://crbug.com/170498, + // http://crbug.com/171651, http://crbug.com/174985, and more. +#if defined(OS_WIN) || defined(OS_LINUX) + WaitTillDataReady(); +#endif + const int frames = sync_reader_->Read(source, dest); DCHECK_LE(0, frames); sync_reader_->UpdatePendingBytes( @@ -284,13 +294,12 @@ int AudioOutputController::OnMoreIOData(AudioBus* source, void AudioOutputController::WaitTillDataReady() { base::Time start = base::Time::Now(); - // Wait for up to 1.5 seconds for DataReady(). 1.5 seconds was chosen because - // it's larger than the playback time of the WaveOut buffer size using the - // minimum supported sample rate: 4096 / 3000 = ~1.4 seconds. Even a client - // expecting real time playout should be able to fill in this time. - const base::TimeDelta max_wait = base::TimeDelta::FromMilliseconds(1500); + // Wait for up to 683ms for DataReady(). 683ms was chosen because it's larger + // than the playback time of the WaveOut buffer size using the minimum + // supported sample rate: 2048 / 3000 = ~683ms. + const base::TimeDelta kMaxWait = base::TimeDelta::FromMilliseconds(683); while (!sync_reader_->DataReady() && - ((base::Time::Now() - start) < max_wait)) { + ((base::Time::Now() - start) < kMaxWait)) { base::PlatformThread::YieldCurrentThread(); } } |