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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 1029763002: Introduce CancelUponDeferral() to buffered media loaders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move cancelation. Created 5 years, 9 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 93f3bd43cf20d7f92c05ff5cc423e3a716159334..3d0557e9be4e5e59879f2faaef0bbd1cd6362929 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -789,8 +789,7 @@ void WebMediaPlayerImpl::OnPipelineMetadata(
pipeline_metadata_ = metadata;
- UMA_HISTOGRAM_ENUMERATION("Media.VideoRotation",
- metadata.video_rotation,
+ UMA_HISTOGRAM_ENUMERATION("Media.VideoRotation", metadata.video_rotation,
VIDEO_ROTATION_MAX + 1);
SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
@@ -824,6 +823,14 @@ void WebMediaPlayerImpl::OnPipelineBufferingStateChanged(
DCHECK_EQ(buffering_state, BUFFERING_HAVE_ENOUGH);
SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
+ // If we were only tasked to preload and a play request hasn't come in yet,
+ // cancel the DataSource once it reaches the deferred state if it isn't
+ // already. Subsequent play requests will restart the DataSource.
+ if (preload_ == BufferedDataSource::METADATA && data_source_ &&
+ !data_source_->IsStreaming() && !data_source_->media_has_played()) {
+ data_source_->CancelUponDeferral();
+ }
xhwang 2015/03/26 07:21:55 Seems like |data_source_| knows the preload type,
DaleCurtis 2015/03/26 17:22:00 Great idea!
+
// Blink expects a timeChanged() in response to a seek().
if (should_notify_time_changed_)
client_->timeChanged();
« media/blink/buffered_resource_loader.cc ('K') | « media/blink/run_all_unittests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698