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

Unified Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 1766783003: Expand suspension of idle media players to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notify_pause
Patch Set: Fixup API comments. Created 4 years, 9 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
Index: content/renderer/media/android/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index 9e84f2d6a9358652452dc19e2294ac9399b89ae6..89e650c53da63b8928ae75fcbe3bda472dd1aa59 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -1511,21 +1511,24 @@ void WebMediaPlayerAndroid::OnWaitingForDecryptionKey() {
encrypted_client_->didResumePlaybackBlockedForKey();
}
-void WebMediaPlayerAndroid::OnHidden(bool must_suspend) {
+void WebMediaPlayerAndroid::OnHidden() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableMediaSuspend)) {
return;
}
+ OnSuspendRequested(false);
+}
+
+void WebMediaPlayerAndroid::OnShown() {}
+
+void WebMediaPlayerAndroid::OnSuspendRequested(bool must_suspend) {
// If we're idle or playing video, pause and release resources; audio only
- // players are allowed to continue playing in the background unless indicated
- // otherwise by the call.
+ // players are allowed to continue unless indicated otherwise by the call.
if (must_suspend || (paused() && playback_completed_) || hasVideo())
SuspendAndReleaseResources();
}
-void WebMediaPlayerAndroid::OnShown() {}
-
void WebMediaPlayerAndroid::OnPlay() {
play();
client_->playbackStateChanged();
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | content/renderer/media/renderer_webmediaplayer_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698