Index: media/audio/audio_input_controller.cc |
diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc |
index 72fb83b49ae26a4f4f57761bbda7ef449e96c801..d4ccd2eddd4bb17310c4997fdd167a30d1dc3bf7 100644 |
--- a/media/audio/audio_input_controller.cc |
+++ b/media/audio/audio_input_controller.cc |
@@ -263,6 +263,7 @@ void AudioInputController::DoCreateForLowLatency(AudioManager* audio_manager, |
log_silence_state_ = true; |
#endif |
+ low_latency_create_time_ = base::TimeTicks::Now(); |
DoCreate(audio_manager, params, device_id); |
} |
@@ -347,8 +348,19 @@ void AudioInputController::DoClose() { |
if (state_ == CLOSED) |
return; |
- if (handler_) |
- handler_->OnLog(this, "AIC::DoClose"); |
+ // If this is a low-latency stream, log the total duration (since DoCreate) |
+ // and add it to a UMA histogram. |
+ if (!low_latency_create_time_.is_null()) { |
+ base::TimeDelta duration = |
+ base::TimeTicks::Now() - low_latency_create_time_; |
+ UMA_HISTOGRAM_LONG_TIMES("Media.InputStreamDuration", duration); |
Henrik Grunell
2014/09/04 06:32:17
I think it should be called Media.AudioInputContro
henrika (OOO until Aug 14)
2014/09/04 12:27:37
Discussed off-line. Henrik G is OK with excluding
|
+ if (handler_) { |
+ std::ostringstream oss; |
tommi (sloooow) - chröme
2014/09/03 13:50:03
use StringPrintf (stringstream should only be used
henrika (OOO until Aug 14)
2014/09/04 12:27:37
I tried to use it but was not able to come up with
henrika (OOO until Aug 14)
2014/09/04 12:54:13
Anyhow, fixed now ;-)
tommi (sloooow) - chröme
2014/09/04 16:53:21
It's because of the style guide. stringstream is
|
+ oss << "AIC::DoClose: stream duration=" |
+ << duration.InSeconds() << " seconds"; |
+ handler_->OnLog(this, oss.str()); |
+ } |
+ } |
// Delete the timer on the same thread that created it. |
no_data_timer_.reset(); |