Commit ffa21d14 authored by xians@chromium.org's avatar xians@chromium.org

Add AudioInputControllerCaptureStartupSuccess UMA.

This logs:
a boolean telling the AudioInputController is getting the recording data after an input stream was started.

This is symmetric to AudioOutputControllerPlaybackStartupSuccess on the output side.

NOTRY=true
BUG=357501

Review URL: https://codereview.chromium.org/271093002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269589 0039d316-1c4b-4281-b951-d872f2087c98
parent e677dfa5
......@@ -212,12 +212,12 @@ void AudioInputController::DoCreateForStream(
enable_nodata_timer = true;
if (enable_nodata_timer) {
// Create the data timer which will call DoCheckForNoData(). The timer
// Create the data timer which will call FirstCheckForNoData(). The timer
// is started in DoRecord() and restarted in each DoCheckForNoData()
// callback.
no_data_timer_.reset(new base::Timer(
FROM_HERE, base::TimeDelta::FromSeconds(kTimerInitialIntervalSeconds),
base::Bind(&AudioInputController::DoCheckForNoData,
base::Bind(&AudioInputController::FirstCheckForNoData,
base::Unretained(this)), false));
} else {
DVLOG(1) << "Disabled: timer check for no data.";
......@@ -247,7 +247,7 @@ void AudioInputController::DoRecord() {
if (no_data_timer_) {
// Start the data timer. Once |kTimerResetIntervalSeconds| have passed,
// a callback to DoCheckForNoData() is made.
// a callback to FirstCheckForNoData() is made.
no_data_timer_->Reset();
}
......@@ -318,6 +318,13 @@ void AudioInputController::DoSetAutomaticGainControl(bool enabled) {
stream_->SetAutomaticGainControl(enabled);
}
void AudioInputController::FirstCheckForNoData() {
DCHECK(task_runner_->BelongsToCurrentThread());
UMA_HISTOGRAM_BOOLEAN("Media.AudioInputControllerCaptureStartupSuccess",
GetDataIsActive());
DoCheckForNoData();
}
void AudioInputController::DoCheckForNoData() {
DCHECK(task_runner_->BelongsToCurrentThread());
......@@ -347,6 +354,10 @@ void AudioInputController::OnData(AudioInputStream* stream,
uint32 size,
uint32 hardware_delay_bytes,
double volume) {
// Mark data as active to ensure that the periodic calls to
// DoCheckForNoData() does not report an error to the event handler.
SetDataIsActive(true);
{
base::AutoLock auto_lock(lock_);
if (state_ != RECORDING)
......@@ -361,10 +372,6 @@ void AudioInputController::OnData(AudioInputStream* stream,
DVLOG_IF(6, key_pressed) << "Detected keypress.";
}
// Mark data as active to ensure that the periodic calls to
// DoCheckForNoData() does not report an error to the event handler.
SetDataIsActive(true);
// Use SharedMemory and SyncSocket if the client has created a SyncWriter.
// Used by all low-latency clients except WebSpeech.
if (SharedMemoryAndSyncSocketMode()) {
......
......@@ -253,6 +253,10 @@ class MEDIA_EXPORT AudioInputController
void DoSetAutomaticGainControl(bool enabled);
void DoOnData(scoped_ptr<uint8[]> data, uint32 size);
// Method to check if we get recorded data after a stream was started,
// and log the result to UMA.
void FirstCheckForNoData();
// Method which ensures that OnError() is triggered when data recording
// times out. Called on the audio thread.
void DoCheckForNoData();
......
......@@ -8789,6 +8789,14 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<summary>Measures the time taken for AudioInputController::</summary>
</histogram>
<histogram name="Media.AudioInputControllerCaptureStartupSuccess"
enum="BooleanSuccess">
<summary>
Whether capture started successfully after an input stream startup was
requested.
</summary>
</histogram>
<histogram name="Media.AudioInputDeviceManager" units="ms">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<summary>Measures the time taken for AudioInputDeviceManager::</summary>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment