Commit 69e8f306 authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Always preroll unless we've reached kReadyStateHaveFutureData.

Even though we'd like to stop earlier if an element isn't playing, we
can't know if the page is waiting for canplaythrough, so we must buffer
until that point so the event fires.

This is a partial revert of d71061f0's
behavior. We still handle play/pause at kReadyStateHaveMetaData, but
unfortunately the preroll attempt is still needed.

TODO: Instead of prerolling non-playing tags past metadata, we might
instead signal kReadyStateHaveFutureData upon suspend to avoid wasting
resources.

TODO: Clearly this behavior is missing a test. :|

BUG=879406
TBR=sandersd

Change-Id: I967ab2c4f8297f8f2e7f9ea91dab7e04f9b88880
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1623668Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662084}
parent 4dc6fad7
...@@ -1148,7 +1148,14 @@ bool WebMediaPlayerImpl::IsPrerollAttemptNeeded() { ...@@ -1148,7 +1148,14 @@ bool WebMediaPlayerImpl::IsPrerollAttemptNeeded() {
// TODO(sandersd): Replace with |highest_ready_state_since_seek_| if we need // TODO(sandersd): Replace with |highest_ready_state_since_seek_| if we need
// to ensure that preroll always gets a chance to complete. // to ensure that preroll always gets a chance to complete.
// See http://crbug.com/671525. // See http://crbug.com/671525.
if (highest_ready_state_ >= ReadyState::kReadyStateHaveMetadata) //
// Note: Even though we get play/pause signals at kReadyStateHaveMetadata, we
// must attempt to preroll until kReadyStateHaveFutureData so that the
// canplaythrough event will be fired to the page (which may be waiting).
//
// TODO(dalecurtis): We should try signaling kReadyStateHaveFutureData upon
// automatic-suspend of a non-playing element to avoid wasting resources.
if (highest_ready_state_ >= ReadyState::kReadyStateHaveFutureData)
return false; return false;
// To suspend before we reach kReadyStateHaveCurrentData is only ok // To suspend before we reach kReadyStateHaveCurrentData is only ok
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment