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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2610893004: [Media] Disable background video optimization for streaming videos (Closed)
Patch Set: Rebase Created 3 years, 11 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 | « media/blink/webmediaplayer_impl.h ('k') | no next file » | 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 4b8151a4076ce48a68c5b93fd2d18e267bb3d20f..e12813585a282ab060079c4496d47e3d765fc428 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -1349,7 +1349,7 @@ void WebMediaPlayerImpl::OnHidden() {
if (watch_time_reporter_)
watch_time_reporter_->OnHidden();
- if (IsBackgroundVideoTrackOptimizationEnabled()) {
+ if (!IsStreaming() && IsBackgroundVideoTrackOptimizationEnabled()) {
if (ShouldPauseWhenHidden()) {
// OnPause() will set |paused_when_hidden_| to false and call
// UpdatePlayState(), so set the flag to true after and then return.
@@ -1378,7 +1378,7 @@ void WebMediaPlayerImpl::OnShown() {
base::Bind(&VideoFrameCompositor::SetForegroundTime,
base::Unretained(compositor_), base::TimeTicks::Now()));
- if (IsBackgroundVideoTrackOptimizationEnabled()) {
+ if (!IsStreaming() && IsBackgroundVideoTrackOptimizationEnabled()) {
if (paused_when_hidden_) {
paused_when_hidden_ = false;
OnPlay(); // Calls UpdatePlayState() so return afterwards.
@@ -1679,7 +1679,7 @@ void WebMediaPlayerImpl::StartPipeline() {
// TODO(sandersd): FileSystem objects may also be non-static, but due to our
// caching layer such situations are broken already. http://crbug.com/593159
bool is_static = !chunk_demuxer_;
- bool is_streaming = data_source_ && data_source_->IsStreaming();
+ bool is_streaming = IsStreaming();
UMA_HISTOGRAM_BOOLEAN("Media.IsStreaming", is_streaming);
// ... and we're ready to go!
@@ -1768,7 +1768,7 @@ void WebMediaPlayerImpl::UpdatePlayState() {
bool is_streaming = false;
#else
bool is_remote = false;
- bool is_streaming = data_source_ && data_source_->IsStreaming();
+ bool is_streaming = IsStreaming();
#endif
bool is_suspended = pipeline_controller_.IsSuspended();
@@ -2061,6 +2061,10 @@ bool WebMediaPlayerImpl::IsHidden() const {
return delegate_ && delegate_->IsHidden();
}
+bool WebMediaPlayerImpl::IsStreaming() const {
+ return data_source_ && data_source_->IsStreaming();
+}
+
bool WebMediaPlayerImpl::DoesOverlaySupportMetadata() const {
return pipeline_metadata_.video_rotation == VIDEO_ROTATION_0;
}
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698