Index: media/audio/audio_output_controller.cc |
diff --git a/media/audio/audio_output_controller.cc b/media/audio/audio_output_controller.cc |
index 9e7893c06588860ca8b414e28c176e6cb28a2cd3..c3ab6ce8dce26a8d896f13192e1dbe18c4625163 100644 |
--- a/media/audio/audio_output_controller.cc |
+++ b/media/audio/audio_output_controller.cc |
@@ -309,20 +309,17 @@ int AudioOutputController::OnMoreIOData(AudioBus* source, |
void AudioOutputController::WaitTillDataReady() { |
// Most of the time the data is ready already. |
- if (sync_reader_->DataReady()) |
+ bool ready = sync_reader_->DataReady(); |
+ UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputController.DataReady", ready); |
DaleCurtis
2013/05/29 18:27:46
Instead of adding this new statistic we should fix
DaveMoore
2013/05/29 18:33:03
Done.
|
+ if (ready) |
return; |
base::TimeTicks start = base::TimeTicks::Now(); |
+ const base::TimeDelta kMaxWait = base::TimeDelta::FromMilliseconds(20); |
#if defined(OS_WIN) |
- // 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. |
- // TODO(davemoore): We think this can be reduced to 20ms based on |
- // http://crrev.com/180102 but will do that in separate cl for mergability. |
- const base::TimeDelta kMaxWait = base::TimeDelta::FromMilliseconds(683); |
+ // Sleep(0) on windows lets the other threads run. |
const base::TimeDelta kSleep = base::TimeDelta::FromMilliseconds(0); |
#else |
- const base::TimeDelta kMaxWait = base::TimeDelta::FromMilliseconds(20); |
// We want to sleep for a bit here, as otherwise a backgrounded renderer won't |
// get enough cpu to send the data and the high priority thread in the browser |
// will use up a core causing even more skips. |
@@ -333,7 +330,7 @@ void AudioOutputController::WaitTillDataReady() { |
base::PlatformThread::Sleep(kSleep); |
time_since_start = base::TimeTicks::Now() - start; |
} while (!sync_reader_->DataReady() && (time_since_start < kMaxWait)); |
- UMA_HISTOGRAM_CUSTOM_TIMES("Media.AudioOutputControllerDataNotReady", |
+ UMA_HISTOGRAM_CUSTOM_TIMES("Media.AudioOutputController.WaitForDataTime", |
time_since_start, |
base::TimeDelta::FromMilliseconds(1), |
base::TimeDelta::FromMilliseconds(1000), |