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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2449873006: Don't background pause suspend until we have future data. (Closed)
Patch Set: Reword comments, remove test. Created 4 years, 2 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 fdb43c9b95f20f2f20306af96881bb45bbe2a27d..6b46be4e27904964e197de681c2dea9e7443ab67 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -1741,7 +1741,8 @@ WebMediaPlayerImpl::UpdatePlayState_ComputePlayState(bool is_remote,
// After HaveMetadata, we know which tracks are present and the duration.
bool have_metadata = ready_state_ >= WebMediaPlayer::ReadyStateHaveMetadata;
- // After HaveFutureData, Blink will call play() if the state is not paused.
+ // After HaveFutureData, Blink will call play() if the state is not paused;
+ // prior to this point |paused_| is not accurate.
bool have_future_data =
highest_ready_state_ >= WebMediaPlayer::ReadyStateHaveFutureData;
@@ -1756,8 +1757,13 @@ WebMediaPlayerImpl::UpdatePlayState_ComputePlayState(bool is_remote,
delegate_ && delegate_->IsPlayingBackgroundVideo();
bool background_suspended = is_backgrounded_video &&
!(can_play_backgrounded && is_background_playing);
- bool background_pause_suspended = is_backgrounded && paused_;
+ bool background_pause_suspended =
+ is_backgrounded && paused_ && have_future_data;
+ // Idle suspension is allowed prior to have future data since there exist
+ // mechanisms to exit the idle state when the player is capable of reaching
+ // the have future data state; see didLoadingProgress().
+ //
// TODO(sandersd): Make the delegate suspend idle players immediately when
// hidden.
bool idle_suspended = is_idle_ && paused_ && !seeking_ && !overlay_enabled_;
« 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