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

Unified Diff: media/audio/audio_input_controller.cc

Issue 537573002: Adding Media.InputStreamDuration to UMA histograms for low-latency input audio streams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now builds on all platforms Created 6 years, 3 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 72fb83b49ae26a4f4f57761bbda7ef449e96c801..6308ead59d10ed71de1c6f50587980bfcc20adbf 100644
--- a/media/audio/audio_input_controller.cc
+++ b/media/audio/audio_input_controller.cc
@@ -5,6 +5,7 @@
#include "media/audio/audio_input_controller.h"
#include "base/bind.h"
+#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
@@ -263,6 +264,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 +349,20 @@ 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);
+ if (handler_) {
+ std::string log_string =
+ base::StringPrintf("AIC::DoClose: stream duration=");
+ log_string += base::Int64ToString(duration.InSeconds());
+ log_string += " seconds";
+ handler_->OnLog(this, log_string);
+ }
+ }
// Delete the timer on the same thread that created it.
no_data_timer_.reset();
« 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