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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2696663002: Media Remoting: Don't auto suspend the media pipeline. (Closed)
Patch Set: Fix tests. Created 3 years, 10 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') | media/blink/webmediaplayer_impl_unittest.cc » ('j') | 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 a195bbffe433dd586df6ba14be3dffe79a5891dd..22382e9825d840a02aacb698e82f4e973a29c8a3 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -267,6 +267,9 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
// e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861
audio_source_provider_ =
new WebAudioSourceProviderImpl(params.audio_renderer_sink(), media_log_);
+
+ if (observer_)
+ observer_->SetClient(this);
}
WebMediaPlayerImpl::~WebMediaPlayerImpl() {
@@ -1835,16 +1838,16 @@ void WebMediaPlayerImpl::UpdatePlayState() {
#if defined(OS_ANDROID) // WMPI_CAST
bool is_remote = isRemote();
- bool is_streaming = false;
+ bool can_auto_suspend = true;
#else
bool is_remote = false;
- bool is_streaming = IsStreaming();
+ bool can_auto_suspend = !disable_pipeline_auto_suspend_ && !IsStreaming();
#endif
bool is_suspended = pipeline_controller_.IsSuspended();
bool is_backgrounded = IsBackgroundedSuspendEnabled() && IsHidden();
PlayState state = UpdatePlayState_ComputePlayState(
- is_remote, is_streaming, is_suspended, is_backgrounded);
+ is_remote, can_auto_suspend, is_suspended, is_backgrounded);
SetDelegateState(state.delegate_state, state.is_idle);
SetMemoryReportingState(state.is_memory_reporting_enabled);
SetSuspendState(state.is_suspended || pending_suspend_resume_cycle_);
@@ -1935,7 +1938,7 @@ void WebMediaPlayerImpl::SetSuspendState(bool is_suspended) {
WebMediaPlayerImpl::PlayState
WebMediaPlayerImpl::UpdatePlayState_ComputePlayState(bool is_remote,
- bool is_streaming,
+ bool can_auto_suspend,
bool is_suspended,
bool is_backgrounded) {
PlayState result;
@@ -1963,10 +1966,10 @@ WebMediaPlayerImpl::UpdatePlayState_ComputePlayState(bool is_remote,
bool can_play_backgrounded = is_backgrounded_video && !is_remote &&
hasAudio() && IsResumeBackgroundVideosEnabled();
bool is_background_playing = delegate_->IsBackgroundVideoPlaybackUnlocked();
- bool background_suspended = !is_streaming && is_backgrounded_video &&
+ bool background_suspended = can_auto_suspend && is_backgrounded_video &&
!(can_play_backgrounded && is_background_playing);
bool background_pause_suspended =
- !is_streaming && is_backgrounded && paused_ && have_future_data;
+ can_auto_suspend && is_backgrounded && paused_ && have_future_data;
// Idle suspension is allowed prior to have future data since there exist
// mechanisms to exit the idle state when the player is capable of reaching
@@ -1975,7 +1978,7 @@ WebMediaPlayerImpl::UpdatePlayState_ComputePlayState(bool is_remote,
// TODO(sandersd): Make the delegate suspend idle players immediately when
// hidden.
bool idle_suspended =
- !is_streaming && is_stale && paused_ && !seeking_ && !overlay_enabled_;
+ can_auto_suspend && is_stale && paused_ && !seeking_ && !overlay_enabled_;
// If we're already suspended, see if we can wait for user interaction. Prior
// to HaveFutureData, we require |is_stale| to remain suspended. |is_stale|
@@ -2287,4 +2290,10 @@ void WebMediaPlayerImpl::ReportTimeFromForegroundToFirstFrame(
}
}
+void WebMediaPlayerImpl::SwitchRenderer(bool disable_pipeline_auto_suspend) {
+ DCHECK(main_task_runner_->BelongsToCurrentThread());
+ disable_pipeline_auto_suspend_ = disable_pipeline_auto_suspend;
+ ScheduleRestart();
+}
+
} // namespace media
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698