Commit 29ae1a90 authored by Thomas Guilbert's avatar Thomas Guilbert Committed by Commit Bot

Disable "pause on hide" when flinging videos

Currently, we sometimes pause videos when they are hidden, as an
optimization. This causes videos flung to cast devices to pause as well,
since the pause command sent to the FlingingRenderer is forwarded to the
cast device.

This CL fixes adds a new flag to track whether or not we are currently
flinging a video, and disables ShouldPauseVideoWhenHidden() when we are.

Bug: 790766
Change-Id: I7729ab2c8187ffd1c77ebb6c48301165dea1d90f
Reviewed-on: https://chromium-review.googlesource.com/c/1292820Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601386}
parent 9d39d8b9
...@@ -2262,6 +2262,8 @@ void WebMediaPlayerImpl::FlingingStarted() { ...@@ -2262,6 +2262,8 @@ void WebMediaPlayerImpl::FlingingStarted() {
DCHECK(!disable_pipeline_auto_suspend_); DCHECK(!disable_pipeline_auto_suspend_);
disable_pipeline_auto_suspend_ = true; disable_pipeline_auto_suspend_ = true;
is_flinging_ = true;
// Capabilities reporting should only be performed for local playbacks. // Capabilities reporting should only be performed for local playbacks.
video_decode_stats_reporter_.reset(); video_decode_stats_reporter_.reset();
...@@ -2275,6 +2277,8 @@ void WebMediaPlayerImpl::FlingingStopped() { ...@@ -2275,6 +2277,8 @@ void WebMediaPlayerImpl::FlingingStopped() {
DCHECK(disable_pipeline_auto_suspend_); DCHECK(disable_pipeline_auto_suspend_);
disable_pipeline_auto_suspend_ = false; disable_pipeline_auto_suspend_ = false;
is_flinging_ = false;
CreateVideoDecodeStatsReporter(); CreateVideoDecodeStatsReporter();
ScheduleRestart(); ScheduleRestart();
...@@ -3071,7 +3075,7 @@ bool WebMediaPlayerImpl::ShouldPauseVideoWhenHidden() const { ...@@ -3071,7 +3075,7 @@ bool WebMediaPlayerImpl::ShouldPauseVideoWhenHidden() const {
return false; return false;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
if (IsRemote()) if (IsRemote() || is_flinging_)
return false; return false;
#endif #endif
...@@ -3082,7 +3086,7 @@ bool WebMediaPlayerImpl::ShouldPauseVideoWhenHidden() const { ...@@ -3082,7 +3086,7 @@ bool WebMediaPlayerImpl::ShouldPauseVideoWhenHidden() const {
// Otherwise only pause if the optimization is on and it's a video-only // Otherwise only pause if the optimization is on and it's a video-only
// optimization candidate. // optimization candidate.
return IsBackgroundVideoPauseOptimizationEnabled() && !HasAudio() && return IsBackgroundVideoPauseOptimizationEnabled() && !HasAudio() &&
IsBackgroundOptimizationCandidate(); IsBackgroundOptimizationCandidate() && !is_flinging_;
} }
bool WebMediaPlayerImpl::ShouldDisableVideoWhenHidden() const { bool WebMediaPlayerImpl::ShouldDisableVideoWhenHidden() const {
......
...@@ -761,6 +761,12 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl ...@@ -761,6 +761,12 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// the pipeline. // the pipeline.
std::unique_ptr<CdmContextRef> pending_cdm_context_ref_; std::unique_ptr<CdmContextRef> pending_cdm_context_ref_;
// Tracks if we are currently flinging a video (e.g. in a RemotePlayback
// session). Used to prevent videos from being paused when hidden.
// TODO(https://crbug.com/839651): remove or rename this flag, when removing
// IsRemote().
bool is_flinging_ = false;
#if defined(OS_ANDROID) // WMPI_CAST #if defined(OS_ANDROID) // WMPI_CAST
WebMediaPlayerCast cast_impl_; WebMediaPlayerCast cast_impl_;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment