Index: media/blink/webmediaplayer_impl.cc |
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc |
index b4ac7396574ddf0f96e24852279038e3dd3f6ede..0c00b97351d446b4f6230a40d44d9ee4841dca24 100644 |
--- a/media/blink/webmediaplayer_impl.cc |
+++ b/media/blink/webmediaplayer_impl.cc |
@@ -1820,6 +1820,11 @@ void WebMediaPlayerImpl::DataSourceInitialized(bool success) { |
return; |
} |
+ // No point in preloading data as we'll probably just throw it away anyways. |
+ if (IsStreaming() && preload_ > MultibufferDataSource::METADATA) { |
+ data_source_->SetPreload(MultibufferDataSource::METADATA); |
+ } |
+ |
StartPipeline(); |
} |
@@ -2100,7 +2105,18 @@ void WebMediaPlayerImpl::UpdatePlayState() { |
bool can_auto_suspend = true; |
#else |
bool is_remote = false; |
- bool can_auto_suspend = !disable_pipeline_auto_suspend_ && !IsStreaming(); |
+ bool can_auto_suspend = !disable_pipeline_auto_suspend_; |
+ // For streaming videos, we only allow suspending at the very beginning of the |
+ // video, and only if we know the length of the video. (If we don't know |
+ // the length, it might be a dynamically generated video, and suspending |
+ // will not work at all.) |
+ if (IsStreaming()) { |
+ bool at_beginning = |
+ ready_state_ == WebMediaPlayer::kReadyStateHaveNothing || |
+ CurrentTime() == 0.0; |
+ if (!at_beginning || GetPipelineMediaDuration() == kInfiniteDuration) |
+ can_auto_suspend = false; |
+ } |
#endif |
bool is_suspended = pipeline_controller_.IsSuspended(); |