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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2320053004: Don't underflow for background rendering. Ensure accurate counts. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/renderers/video_renderer_impl.cc » ('j') | media/renderers/video_renderer_impl.cc » ('J')
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 a5587443b1e35a02a729b2098acbc131adcff7c3..c035e5ea7136976a2ce7510d04e116daf3b17973 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -1136,17 +1136,20 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
} else {
// Buffering has underflowed.
DCHECK_EQ(state, BUFFERING_HAVE_NOTHING);
- // It shouldn't be possible to underflow if we've not advanced past
- // 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_) {
+ // for src= playback since for MSE it's out of our control. Ensure we only
+ // report the value when transitioning from HAVE_ENOUGH to HAVE_NOTHING.
+ if (data_source_ &&
+ ready_state_ == WebMediaPlayer::ReadyStateHaveEnoughData) {
chcunningham 2016/09/09 21:27:05 I think this is fine, but I'm not sure it will hav
DaleCurtis 2016/09/09 21:51:41 Correct, that was my interpretation, but I wasn't
UMA_HISTOGRAM_COUNTS_100("Media.UnderflowCount", ++underflow_count_);
underflow_timer_.reset(new base::ElapsedTimer());
}
+
+ // It shouldn't be possible to underflow if we've not advanced past
+ // HAVE_CURRENT_DATA.
+ DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData);
+ SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData);
}
UpdatePlayState();
« no previous file with comments | « no previous file | media/renderers/video_renderer_impl.cc » ('j') | media/renderers/video_renderer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698