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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 2294333004: Include playbacks which never underflow in underflow metrics. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) { 1077 void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
1078 DVLOG(1) << __func__ << "(" << state << ")"; 1078 DVLOG(1) << __func__ << "(" << state << ")";
1079 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1079 DCHECK(main_task_runner_->BelongsToCurrentThread());
1080 1080
1081 // Ignore buffering state changes until we've completed all outstanding 1081 // Ignore buffering state changes until we've completed all outstanding
1082 // operations. 1082 // operations.
1083 if (!pipeline_controller_.IsStable()) 1083 if (!pipeline_controller_.IsStable())
1084 return; 1084 return;
1085 1085
1086 if (state == BUFFERING_HAVE_ENOUGH) { 1086 if (state == BUFFERING_HAVE_ENOUGH) {
1087 if (data_source_ &&
1088 highest_ready_state_ < WebMediaPlayer::ReadyStateHaveEnoughData) {
1089 DCHECK_EQ(underflow_count_, 0);
1090 // Record a zero value for underflow histograms so that the histogram
1091 // includes playbacks which never encounter an underflow event.
1092 UMA_HISTOGRAM_COUNTS_100("Media.UnderflowCount", 0);
Steven Holte 2016/09/07 00:24:26 You should probably consolidate the macro calls fo
1093 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", base::TimeDelta());
1094 }
1095
1087 // TODO(chcunningham): Monitor playback position vs buffered. Potentially 1096 // TODO(chcunningham): Monitor playback position vs buffered. Potentially
1088 // transition to HAVE_FUTURE_DATA here if not enough is buffered. 1097 // transition to HAVE_FUTURE_DATA here if not enough is buffered.
1089 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); 1098 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
1090 1099
1091 // Let the DataSource know we have enough data. It may use this information 1100 // Let the DataSource know we have enough data. It may use this information
1092 // to release unused network connections. 1101 // to release unused network connections.
1093 if (data_source_) 1102 if (data_source_)
1094 data_source_->OnBufferingHaveEnough(false); 1103 data_source_->OnBufferingHaveEnough(false);
1095 1104
1096 // Blink expects a timeChanged() in response to a seek(). 1105 // Blink expects a timeChanged() in response to a seek().
(...skipping 15 matching lines...) Expand all
1112 // Buffering has underflowed. 1121 // Buffering has underflowed.
1113 DCHECK_EQ(state, BUFFERING_HAVE_NOTHING); 1122 DCHECK_EQ(state, BUFFERING_HAVE_NOTHING);
1114 // It shouldn't be possible to underflow if we've not advanced past 1123 // It shouldn't be possible to underflow if we've not advanced past
1115 // HAVE_CURRENT_DATA. 1124 // HAVE_CURRENT_DATA.
1116 DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData); 1125 DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData);
1117 SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData); 1126 SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData);
1118 1127
1119 // Report the number of times we've entered the underflow state. Only report 1128 // Report the number of times we've entered the underflow state. Only report
1120 // for src= playback since for MSE it's out of our control. 1129 // for src= playback since for MSE it's out of our control.
1121 if (data_source_) { 1130 if (data_source_) {
1122 UMA_HISTOGRAM_COUNTS_100("Media.UnderflowCount", ++underflow_count_); 1131 UMA_HISTOGRAM_COUNTS_100("Media.UnderflowCount", ++underflow_count_);
Steven Holte 2016/09/07 00:24:26 Generally not a good idea to have side-effecting l
1123 underflow_timer_.reset(new base::ElapsedTimer()); 1132 underflow_timer_.reset(new base::ElapsedTimer());
1124 } 1133 }
1125 } 1134 }
1126 1135
1127 UpdatePlayState(); 1136 UpdatePlayState();
1128 } 1137 }
1129 1138
1130 void WebMediaPlayerImpl::OnDurationChange() { 1139 void WebMediaPlayerImpl::OnDurationChange() {
1131 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1140 DCHECK(main_task_runner_->BelongsToCurrentThread());
1132 1141
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 pipeline_metadata_.natural_size, 1817 pipeline_metadata_.natural_size,
1809 base::Bind(&GetCurrentTimeInternal, this))); 1818 base::Bind(&GetCurrentTimeInternal, this)));
1810 watch_time_reporter_->OnVolumeChange(volume_); 1819 watch_time_reporter_->OnVolumeChange(volume_);
1811 if (delegate_ && delegate_->IsHidden()) 1820 if (delegate_ && delegate_->IsHidden())
1812 watch_time_reporter_->OnHidden(); 1821 watch_time_reporter_->OnHidden();
1813 else 1822 else
1814 watch_time_reporter_->OnShown(); 1823 watch_time_reporter_->OnShown();
1815 } 1824 }
1816 1825
1817 } // namespace media 1826 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698