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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2610893004: [Media] Disable background video optimization for streaming videos (Closed)
Patch Set: Check for infinite duration 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 b6a56c2cd26dce38c4fc4676e610e77460f315e6..8eb02693afd99a472a4c8fbe47977d8687dca320 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -1336,7 +1336,7 @@ void WebMediaPlayerImpl::OnVideoOpacityChange(bool opaque) {
void WebMediaPlayerImpl::OnHidden() {
DCHECK(main_task_runner_->BelongsToCurrentThread());
- if (IsBackgroundVideoTrackOptimizationEnabled())
+ if (!IsStreaming() && IsBackgroundVideoTrackOptimizationEnabled())
selectedVideoTrackChanged(nullptr);
if (watch_time_reporter_)
@@ -1354,7 +1354,7 @@ void WebMediaPlayerImpl::OnShown() {
if (watch_time_reporter_)
watch_time_reporter_->OnShown();
- if (IsBackgroundVideoTrackOptimizationEnabled() &&
+ if (!IsStreaming() && IsBackgroundVideoTrackOptimizationEnabled() &&
client_->hasSelectedVideoTrack()) {
WebMediaPlayer::TrackId trackId = client_->getSelectedVideoTrackId();
selectedVideoTrackChanged(&trackId);
@@ -1648,7 +1648,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!
@@ -1737,7 +1737,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();
@@ -2030,6 +2030,11 @@ bool WebMediaPlayerImpl::IsHidden() const {
return delegate_ && delegate_->IsHidden();
}
+bool WebMediaPlayerImpl::IsStreaming() const {
+ return !std::isfinite(duration()) ||
sandersd (OOO until July 31) 2017/01/06 21:20:28 FYI: I was just looking through this code, and eve
whywhat 2017/01/06 22:19:57 Hm, liveness seems to depend on the stream parser:
+ (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