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

Unified Diff: chromecast/media/cma/base/buffering_controller.cc

Issue 652353003: Chromecast: adds class to help record complex histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resets initial buffering state on flush Created 6 years, 2 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 | « chromecast/media/cma/base/buffering_controller.h ('k') | chromecast/media/cma/test/run_all_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/media/cma/base/buffering_controller.cc
diff --git a/chromecast/media/cma/base/buffering_controller.cc b/chromecast/media/cma/base/buffering_controller.cc
index 2adaf820531c82ef142dff44920df4d45933b9c6..183b12628d2e1d26c519b407909780f651c2f3ef 100644
--- a/chromecast/media/cma/base/buffering_controller.cc
+++ b/chromecast/media/cma/base/buffering_controller.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/message_loop/message_loop_proxy.h"
+#include "chromecast/base/metrics/cast_metrics_helper.h"
#include "chromecast/media/cma/base/buffering_state.h"
#include "chromecast/media/cma/base/cma_logging.h"
#include "media/base/buffers.h"
@@ -21,6 +22,7 @@ BufferingController::BufferingController(
buffering_notification_cb_(buffering_notification_cb),
is_buffering_(false),
begin_buffering_time_(base::Time()),
+ initial_buffering_(true),
weak_factory_(this) {
weak_this_ = weak_factory_.GetWeakPtr();
thread_checker_.DetachFromThread();
@@ -106,6 +108,7 @@ void BufferingController::Reset() {
DCHECK(thread_checker_.CalledOnValidThread());
is_buffering_ = false;
+ initial_buffering_ = true;
stream_list_.clear();
}
@@ -147,6 +150,15 @@ void BufferingController::OnBufferingStateChanged(
CMALOG(kLogControl)
<< "Buffering took: "
<< buffering_user_time.InMilliseconds() << "ms";
+ chromecast::metrics::CastMetricsHelper::BufferingType buffering_type =
+ initial_buffering_ ?
+ chromecast::metrics::CastMetricsHelper::kInitialBuffering :
+ chromecast::metrics::CastMetricsHelper::kBufferingAfterUnderrun;
+ chromecast::metrics::CastMetricsHelper::GetInstance()->LogTimeToBufferAv(
+ buffering_type, buffering_user_time);
+
+ // Only the first buffering report is considered "initial buffering".
+ initial_buffering_ = false;
}
if (is_buffering_prv != is_buffering_ || force_notification)
« no previous file with comments | « chromecast/media/cma/base/buffering_controller.h ('k') | chromecast/media/cma/test/run_all_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698