Chromium Code Reviews| Index: media/blink/webmediaplayer_impl.cc |
| diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc |
| index a105327d0635b16c4d2fdc937a2cb7a89c32fa91..cccbcf8dc79e7d037d2e362999e394df37088b91 100644 |
| --- a/media/blink/webmediaplayer_impl.cc |
| +++ b/media/blink/webmediaplayer_impl.cc |
| @@ -1714,7 +1714,7 @@ void WebMediaPlayerImpl::UpdatePlayState() { |
| #endif |
| bool is_suspended = pipeline_controller_.IsSuspended(); |
| - bool is_backgrounded = IsBackgroundedSuspendEnabled() && IsHidden(); |
| + bool is_backgrounded = IsHidden(); |
| PlayState state = UpdatePlayState_ComputePlayState( |
| is_remote, is_streaming, is_suspended, is_backgrounded); |
| SetDelegateState(state.delegate_state); |
| @@ -1837,7 +1837,11 @@ WebMediaPlayerImpl::UpdatePlayState_ComputePlayState(bool is_remote, |
| hasAudio() && IsResumeBackgroundVideosEnabled(); |
| bool is_background_playing = |
| delegate_ && delegate_->IsPlayingBackgroundVideo(); |
| - bool background_suspended = !is_streaming && is_backgrounded_video && |
| + // Video-only media should always be suspended when in background. |
| + bool should_suspend_background_media = |
| + IsBackgroundedSuspendEnabled() || !hasAudio(); |
| + bool background_suspended = should_suspend_background_media && |
| + !is_streaming && is_backgrounded_video && |
| !(can_play_backgrounded && is_background_playing); |
| bool background_pause_suspended = |
| !is_streaming && is_backgrounded && paused_ && have_future_data; |
| @@ -1951,8 +1955,9 @@ void WebMediaPlayerImpl::FinishMemoryUsageReport(int64_t demuxer_memory_usage) { |
| } |
| void WebMediaPlayerImpl::ScheduleIdlePauseTimer() { |
| - // Only schedule the pause timer if we're playing and are suspended. |
| - if (paused_ || !pipeline_controller_.IsSuspended()) |
| + // Only schedule the pause timer if we're playing, are suspended and |
| + // have audio. |
| + if (paused_ || !pipeline_controller_.IsSuspended() || !hasAudio()) |
|
sandersd (OOO until July 31)
2016/12/15 01:09:47
This doesn't look quite right to me. The purpose o
whywhat
2016/12/16 01:20:24
Well, it might be - AFAIK it only affects Android
whywhat
2016/12/16 20:09:37
Dan, am I correct that the timer would only trigge
|
| return; |
| #if defined(OS_ANDROID) |