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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2286843003: Add metrics for tracking underflow during src= playback. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « media/blink/webmediaplayer_impl.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/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index 4127fba19f4e0b98416be476f33d64d379fa81ac..212e5520cff2d2483311e37ac2a56445e8fdf1a2 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -225,7 +225,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
overlay_surface_id_(SurfaceManager::kNoSurfaceID),
suppress_destruction_errors_(false),
can_suspend_state_(CanSuspendState::UNKNOWN),
- is_encrypted_(false) {
+ is_encrypted_(false),
+ underflow_count_(0) {
DCHECK(!adjust_allocated_memory_cb_.is_null());
DCHECK(renderer_factory_);
DCHECK(client_);
@@ -1098,6 +1099,14 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
// Once we have enough, start reporting the total memory usage. We'll also
// report once playback starts.
ReportMemoryUsage();
+
+ // Report the amount of time it took to leave the underflow state. Don't
+ // bother to report this for MSE playbacks since it's out of our control.
+ if (underflow_timer_ && data_source_) {
+ UMA_HISTOGRAM_TIMES("Media.UnderflowDuration",
+ underflow_timer_->Elapsed());
+ underflow_timer_.reset();
+ }
} else {
// Buffering has underflowed.
DCHECK_EQ(state, BUFFERING_HAVE_NOTHING);
@@ -1105,6 +1114,13 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
// HAVE_CURRENT_DATA.
DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData);
SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData);
+
+ // Report the number of times we've entered the underflow state. Only report
+ // for src= playback since for MSE it's out of our control.
+ if (data_source_) {
+ UMA_HISTOGRAM_COUNTS_100("Media.UnderflowCount", ++underflow_count_);
+ underflow_timer_.reset(new base::ElapsedTimer());
+ }
}
UpdatePlayState();
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698