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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 2445533002: Don't suspend the pipeline before HaveFutureData while decoding progressing (Closed)
Patch Set: fix compiler error from rebase Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/android/webmediaplayer_android.h" 5 #include "content/renderer/media/android/webmediaplayer_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 } 1211 }
1212 1212
1213 OnSuspendRequested(false); 1213 OnSuspendRequested(false);
1214 } 1214 }
1215 1215
1216 void WebMediaPlayerAndroid::OnShown() { 1216 void WebMediaPlayerAndroid::OnShown() {
1217 if (is_play_pending_) 1217 if (is_play_pending_)
1218 play(); 1218 play();
1219 } 1219 }
1220 1220
1221 void WebMediaPlayerAndroid::OnSuspendRequested(bool must_suspend) { 1221 bool WebMediaPlayerAndroid::OnSuspendRequested(bool must_suspend) {
1222 if (!must_suspend && 1222 if (!must_suspend &&
1223 base::CommandLine::ForCurrentProcess()->HasSwitch( 1223 base::CommandLine::ForCurrentProcess()->HasSwitch(
1224 switches::kDisableMediaSuspend)) { 1224 switches::kDisableMediaSuspend)) {
1225 return; 1225 return true;
1226 } 1226 }
1227 1227
1228 // If we're idle or playing video, pause and release resources; audio only 1228 // If we're idle or playing video, pause and release resources; audio only
1229 // players are allowed to continue unless indicated otherwise by the call. 1229 // players are allowed to continue unless indicated otherwise by the call.
1230 if (must_suspend || (paused() && playback_completed_) || 1230 if (must_suspend || (paused() && playback_completed_) ||
1231 (hasVideo() && !IsBackgroundVideoCandidate())) { 1231 (hasVideo() && !IsBackgroundVideoCandidate())) {
1232 SuspendAndReleaseResources(); 1232 SuspendAndReleaseResources();
1233 } 1233 }
1234
1235 return true;
1234 } 1236 }
1235 1237
1236 void WebMediaPlayerAndroid::OnPlay() { 1238 void WebMediaPlayerAndroid::OnPlay() {
1237 play(); 1239 play();
1238 client_->playbackStateChanged(); 1240 client_->playbackStateChanged();
1239 } 1241 }
1240 1242
1241 void WebMediaPlayerAndroid::OnPause() { 1243 void WebMediaPlayerAndroid::OnPause() {
1242 pause(); 1244 pause();
1243 client_->playbackStateChanged(); 1245 client_->playbackStateChanged();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1310 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1309 switches::kDisableMediaSuspend)) { 1311 switches::kDisableMediaSuspend)) {
1310 return false; 1312 return false;
1311 } 1313 }
1312 1314
1313 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && 1315 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) &&
1314 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); 1316 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden();
1315 } 1317 }
1316 1318
1317 } // namespace content 1319 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | content/renderer/media/renderer_webmediaplayer_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698