| 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 32c68c82993569c0efb0a819aa4654c409fe9da8..91d163af348ca11b160e937810ad831143a2d609 100644
|
| --- a/content/renderer/media/android/webmediaplayer_android.cc
|
| +++ b/content/renderer/media/android/webmediaplayer_android.cc
|
| @@ -144,6 +144,11 @@ bool AllocateSkBitmapTexture(GrContext* gr,
|
| return true;
|
| }
|
|
|
| +bool IsSuspendResumeEnabled() {
|
| + return !base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kDisableMediaSuspend);
|
| +}
|
| +
|
| class SyncTokenClientImpl : public media::VideoFrame::SyncTokenClient {
|
| public:
|
| explicit SyncTokenClientImpl(
|
| @@ -1513,21 +1518,24 @@ void WebMediaPlayerAndroid::OnWaitingForDecryptionKey() {
|
| encrypted_client_->didResumePlaybackBlockedForKey();
|
| }
|
|
|
| -void WebMediaPlayerAndroid::OnHidden(bool must_suspend) {
|
| - if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kDisableMediaSuspend)) {
|
| +void WebMediaPlayerAndroid::OnHidden() {
|
| + if (!IsSuspendResumeEnabled())
|
| return;
|
| - }
|
|
|
| // 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.
|
| - if (must_suspend || (paused() && playback_completed_) || hasVideo())
|
| + if ((paused() && playback_completed_) || hasVideo())
|
| SuspendAndReleaseResources();
|
| }
|
|
|
| void WebMediaPlayerAndroid::OnShown() {}
|
|
|
| +void WebMediaPlayerAndroid::OnSuspend(bool must_suspend) {
|
| + if (must_suspend)
|
| + SuspendAndReleaseResources();
|
| +}
|
| +
|
| void WebMediaPlayerAndroid::OnPlay() {
|
| play();
|
| client_->playbackStateChanged();
|
|
|