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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2713883003: Merge M57: "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 1402ec4b22c09ee687ca344c391edac52cd2b4f5..6e4e376653908cfe641f4528e507bd54618c1d43 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -241,7 +241,6 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
can_suspend_state_(CanSuspendState::UNKNOWN),
use_fallback_path_(false),
is_encrypted_(false),
- underflow_count_(0),
preroll_attempt_pending_(false),
observer_(params.media_observer()) {
DCHECK(!adjust_allocated_memory_cb_.is_null());
@@ -1116,9 +1115,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.
@@ -1259,13 +1258,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
@@ -1287,11 +1283,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 {
@@ -1303,7 +1297,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());
}
@@ -2273,4 +2266,12 @@ void WebMediaPlayerImpl::ReportTimeFromForegroundToFirstFrame(
}
}
+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