Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: media/audio/audio_input_controller.cc

Issue 271093002: Add AudioInputControllerCaptureStartupSuccess UMA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed the comments. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/audio_input_controller.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_input_controller.cc
diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc
index 4cf948b1ad318d7b0b65c2e61c5fbb2ea07e2d2f..3bdec149bfc3c3605bdb7234edf522199fedb783 100644
--- a/media/audio/audio_input_controller.cc
+++ b/media/audio/audio_input_controller.cc
@@ -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()) {
« no previous file with comments | « media/audio/audio_input_controller.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698