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

Unified Diff: media/audio/audio_input_controller.cc

Issue 495983002: Improve logging related to start/stop and failure of audio input streams in Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: xians@ Created 6 years, 4 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
Index: media/audio/audio_input_controller.cc
diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc
index c49cb34f342a90baf88fa0eac38b70886db84486..72fb83b49ae26a4f4f57761bbda7ef449e96c801 100644
--- a/media/audio/audio_input_controller.cc
+++ b/media/audio/audio_input_controller.cc
@@ -120,9 +120,13 @@ scoped_refptr<AudioInputController> AudioInputController::Create(
// Create and open a new audio input stream from the existing
// audio-device thread.
- if (!controller->task_runner_->PostTask(FROM_HERE,
- base::Bind(&AudioInputController::DoCreate, controller,
- base::Unretained(audio_manager), params, device_id))) {
+ if (!controller->task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AudioInputController::DoCreate,
+ controller,
+ base::Unretained(audio_manager),
+ params,
+ device_id))) {
controller = NULL;
}
@@ -151,9 +155,13 @@ scoped_refptr<AudioInputController> AudioInputController::CreateLowLatency(
// Create and open a new audio input stream from the existing
// audio-device thread. Use the provided audio-input device.
- if (!controller->task_runner_->PostTask(FROM_HERE,
- base::Bind(&AudioInputController::DoCreateForLowLatency, controller,
- base::Unretained(audio_manager), params, device_id))) {
+ if (!controller->task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AudioInputController::DoCreateForLowLatency,
+ controller,
+ base::Unretained(audio_manager),
+ params,
+ device_id))) {
controller = NULL;
}
@@ -220,12 +228,15 @@ void AudioInputController::DoCreate(AudioManager* audio_manager,
const std::string& device_id) {
DCHECK(task_runner_->BelongsToCurrentThread());
SCOPED_UMA_HISTOGRAM_TIMER("Media.AudioInputController.CreateTime");
+ if (handler_)
+ handler_->OnLog(this, "AIC::DoCreate");
#if defined(AUDIO_POWER_MONITORING)
// Create the audio (power) level meter given the provided audio parameters.
// An AudioBus is also needed to wrap the raw data buffer from the native
// layer to match AudioPowerMonitor::Scan().
// TODO(henrika): Remove use of extra AudioBus. See http://crbug.com/375155.
+ last_audio_level_log_time_ = base::TimeTicks::Now();
audio_level_.reset(new media::AudioPowerMonitor(
params.sample_rate(),
TimeDelta::FromMilliseconds(kPowerMeasurementTimeConstantMilliseconds)));
@@ -315,6 +326,9 @@ void AudioInputController::DoRecord() {
state_ = RECORDING;
}
+ if (handler_)
+ handler_->OnLog(this, "AIC::DoRecord");
+
if (no_data_timer_) {
// Start the data timer. Once |kTimerResetIntervalSeconds| have passed,
// a callback to FirstCheckForNoData() is made.
@@ -333,6 +347,9 @@ void AudioInputController::DoClose() {
if (state_ == CLOSED)
return;
+ if (handler_)
+ handler_->OnLog(this, "AIC::DoClose");
+
// Delete the timer on the same thread that created it.
no_data_timer_.reset();
@@ -400,6 +417,11 @@ void AudioInputController::FirstCheckForNoData() {
LogCaptureStartupResult(GetDataIsActive() ?
CAPTURE_STARTUP_OK :
CAPTURE_STARTUP_NO_DATA_CALLBACK);
+ if (handler_) {
+ handler_->OnLog(this, GetDataIsActive() ?
+ "AIC::FirstCheckForNoData => data is active" :
+ "AIC::FirstCheckForNoData => data is NOT active");
+ }
DoCheckForNoData();
}

Powered by Google App Engine
This is Rietveld 408576698