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

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

Issue 2477323003: Stop suspending the pipeline before HaveFutureData while decoding (Closed)
Patch Set: 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 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 } 1239 }
1240 1240
1241 OnSuspendRequested(false); 1241 OnSuspendRequested(false);
1242 } 1242 }
1243 1243
1244 void WebMediaPlayerAndroid::OnShown() { 1244 void WebMediaPlayerAndroid::OnShown() {
1245 if (is_play_pending_) 1245 if (is_play_pending_)
1246 play(); 1246 play();
1247 } 1247 }
1248 1248
1249 void WebMediaPlayerAndroid::OnSuspendRequested(bool must_suspend) { 1249 bool WebMediaPlayerAndroid::OnSuspendRequested(bool must_suspend) {
1250 if (!must_suspend && 1250 if (!must_suspend &&
1251 base::CommandLine::ForCurrentProcess()->HasSwitch( 1251 base::CommandLine::ForCurrentProcess()->HasSwitch(
1252 switches::kDisableMediaSuspend)) { 1252 switches::kDisableMediaSuspend)) {
1253 return; 1253 return true;
1254 } 1254 }
1255 1255
1256 // If we're idle or playing video, pause and release resources; audio only 1256 // If we're idle or playing video, pause and release resources; audio only
1257 // players are allowed to continue unless indicated otherwise by the call. 1257 // players are allowed to continue unless indicated otherwise by the call.
1258 if (must_suspend || (paused() && playback_completed_) || 1258 if (must_suspend || (paused() && playback_completed_) ||
1259 (hasVideo() && !IsBackgroundVideoCandidate())) { 1259 (hasVideo() && !IsBackgroundVideoCandidate())) {
1260 SuspendAndReleaseResources(); 1260 SuspendAndReleaseResources();
1261 } 1261 }
1262
1263 return true;
1262 } 1264 }
1263 1265
1264 void WebMediaPlayerAndroid::OnPlay() { 1266 void WebMediaPlayerAndroid::OnPlay() {
1265 play(); 1267 play();
1266 client_->playbackStateChanged(); 1268 client_->playbackStateChanged();
1267 } 1269 }
1268 1270
1269 void WebMediaPlayerAndroid::OnPause() { 1271 void WebMediaPlayerAndroid::OnPause() {
1270 pause(); 1272 pause();
1271 client_->playbackStateChanged(); 1273 client_->playbackStateChanged();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1338 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1337 switches::kDisableMediaSuspend)) { 1339 switches::kDisableMediaSuspend)) {
1338 return false; 1340 return false;
1339 } 1341 }
1340 1342
1341 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && 1343 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) &&
1342 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); 1344 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden();
1343 } 1345 }
1344 1346
1345 } // namespace content 1347 } // 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