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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2707973005: Remove Media.UnderflowCount, add Media.UnderflowDuration for MSE. (Closed)
Patch Set: Created 3 years, 10 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 bea9a92a34c679b3dc60456d9d76b9d03d7d1536..f8c8d24f13ce728929938606f35f67c547e7243d 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -234,7 +234,6 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
suspend_enabled_(params.allow_suspend()),
use_fallback_path_(false),
is_encrypted_(false),
- underflow_count_(0),
preroll_attempt_pending_(false),
observer_(params.media_observer()),
max_keyframe_distance_to_disable_background_video_(
@@ -1111,9 +1110,9 @@ void WebMediaPlayerImpl::OnPipelineSeeked(bool time_updated) {
if (time_updated)
should_notify_time_changed_ = true;
- // Reset underflow count upon seek; this prevents looping videos and user
- // actions from artificially inflating the underflow count.
- underflow_count_ = 0;
+ // Reset underflow duration upon seek; this prevents looping videos and user
+ // actions from artificially inflating the duration.
+ underflow_timer_.reset();
// Background video optimizations are delayed when shown/hidden if pipeline
// is seeking.
@@ -1284,13 +1283,10 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
"pipeline_buffering_state", state));
if (state == BUFFERING_HAVE_ENOUGH) {
- if (data_source_ &&
- highest_ready_state_ < WebMediaPlayer::ReadyStateHaveEnoughData) {
- DCHECK_EQ(underflow_count_, 0);
- // Record a zero value for underflow histograms so that the histogram
+ if (highest_ready_state_ < WebMediaPlayer::ReadyStateHaveEnoughData) {
+ // Record a zero value for underflow histogram so that the histogram
// includes playbacks which never encounter an underflow event.
- UMA_HISTOGRAM_COUNTS_100("Media.UnderflowCount", 0);
- UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", base::TimeDelta());
+ RecordUnderflowDuration(base::TimeDelta());
}
// TODO(chcunningham): Monitor playback position vs buffered. Potentially
@@ -1312,11 +1308,9 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
// 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());
+ // Report the amount of time it took to leave the underflow state.
+ if (underflow_timer_) {
+ RecordUnderflowDuration(underflow_timer_->Elapsed());
underflow_timer_.reset();
}
} else {
@@ -1328,7 +1322,6 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
// report the value when transitioning from HAVE_ENOUGH to HAVE_NOTHING.
if (data_source_ &&
ready_state_ == WebMediaPlayer::ReadyStateHaveEnoughData) {
- UMA_HISTOGRAM_COUNTS_100("Media.UnderflowCount", ++underflow_count_);
underflow_timer_.reset(new base::ElapsedTimer());
}
@@ -2300,4 +2293,12 @@ void WebMediaPlayerImpl::SwitchRenderer(bool disable_pipeline_auto_suspend) {
ScheduleRestart();
}
+void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) {
+ DCHECK(data_source_ || chunk_demuxer_);
+ if (data_source_)
+ UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration);
+ else
+ UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration);
+}
+
} // namespace media
« 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