Chromium Code Reviews| 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; |
| } |