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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2115143002: Transition media element to HAVE_CURRENT_DATA upon underflow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 4 years, 5 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/blink/webmediaplayer_impl_unittest.cc » ('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 c0cdfcc5c25245dd8da65c0ec0c301947fcd5b88..7eb3e70716f3e7c643380e70a44f5200f8df484d 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -1035,23 +1035,31 @@ void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
if (!pipeline_controller_.IsStable())
return;
- // TODO(scherkus): Handle other buffering states when Pipeline starts using
- // them and translate them ready state changes http://crbug.com/144683
- DCHECK_EQ(state, BUFFERING_HAVE_ENOUGH);
- SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
+ if (state == BUFFERING_HAVE_ENOUGH) {
+ // TODO(chcunningham): Monitor playback position vs buffered. Potentially
+ // transition to HAVE_FUTURE_DATA here if not enough is buffered.
+ SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
- // Let the DataSource know we have enough data. It may use this information to
- // release unused network connections.
- if (data_source_)
- data_source_->OnBufferingHaveEnough(false);
+ // Let the DataSource know we have enough data. It may use this information
+ // to release unused network connections.
+ if (data_source_)
+ data_source_->OnBufferingHaveEnough(false);
- // Blink expects a timeChanged() in response to a seek().
- if (should_notify_time_changed_)
- client_->timeChanged();
+ // Blink expects a timeChanged() in response to a seek().
+ if (should_notify_time_changed_)
+ client_->timeChanged();
- // Once we have enough, start reporting the total memory usage. We'll also
- // report once playback starts.
- ReportMemoryUsage();
+ // Once we have enough, start reporting the total memory usage. We'll also
+ // report once playback starts.
+ ReportMemoryUsage();
+ } 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);
+ }
UpdatePlayState();
}
« no previous file with comments | « no previous file | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698