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

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: Created 4 years, 6 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
Index: media/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index c0cdfcc5c25245dd8da65c0ec0c301947fcd5b88..c7086b3e7dce6b673118f674c4eef6057d9df13d 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -1035,15 +1035,23 @@ 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);
+ } 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);
+ }
// Blink expects a timeChanged() in response to a seek().
if (should_notify_time_changed_)
« no previous file with comments | « no previous file | media/renderers/renderer_impl.cc » ('j') | third_party/WebKit/LayoutTests/http/tests/media/video-play-stall.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698