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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 1813883002: Disable idle player suspend on OSX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: if/else. 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 1098
1099 void WebMediaPlayerImpl::OnSuspendRequested(bool must_suspend) { 1099 void WebMediaPlayerImpl::OnSuspendRequested(bool must_suspend) {
1100 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1100 DCHECK(main_task_runner_->BelongsToCurrentThread());
1101 1101
1102 #if defined(OS_ANDROID) // WMPI_CAST 1102 #if defined(OS_ANDROID) // WMPI_CAST
1103 // If we're remote, the pipeline should already be suspended. 1103 // If we're remote, the pipeline should already be suspended.
1104 if (isRemote()) 1104 if (isRemote())
1105 return; 1105 return;
1106 #endif 1106 #endif
1107 1107
1108 #if defined(OS_MACOSX)
1109 // TODO(sandersd): Idle suspend is disabled on OSX since hardware decoded
1110 // frames are owned by the video decoder in the GPU process. A mechanism for
1111 // detaching ownership from the decoder is needed. http://crbug.com/595716.
1112 return;
1113 #else
1108 // Suspend should never be requested unless required or we're already in an 1114 // Suspend should never be requested unless required or we're already in an
1109 // idle state (paused or ended). 1115 // idle state (paused or ended).
1110 DCHECK(must_suspend || paused_ || ended_); 1116 DCHECK(must_suspend || paused_ || ended_);
1111 1117
1112 // Always suspend, but only notify the delegate if we must; this allows any 1118 // Always suspend, but only notify the delegate if we must; this allows any
1113 // exposed UI for player controls to continue to function even though the 1119 // exposed UI for player controls to continue to function even though the
1114 // player has now been suspended. 1120 // player has now been suspended.
1115 pipeline_controller_.Suspend(); 1121 pipeline_controller_.Suspend();
1116 if (must_suspend && delegate_) 1122 if (must_suspend && delegate_)
1117 delegate_->PlayerGone(delegate_id_); 1123 delegate_->PlayerGone(delegate_id_);
1124 #endif
1118 } 1125 }
1119 1126
1120 void WebMediaPlayerImpl::OnPlay() { 1127 void WebMediaPlayerImpl::OnPlay() {
1121 play(); 1128 play();
1122 client_->playbackStateChanged(); 1129 client_->playbackStateChanged();
1123 } 1130 }
1124 1131
1125 void WebMediaPlayerImpl::OnPause() { 1132 void WebMediaPlayerImpl::OnPause() {
1126 pause(); 1133 pause();
1127 client_->playbackStateChanged(); 1134 client_->playbackStateChanged();
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { 1512 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() {
1506 #if defined(OS_ANDROID) 1513 #if defined(OS_ANDROID)
1507 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); 1514 return !hasVideo() || (delegate_ && !delegate_->IsHidden());
1508 #else 1515 #else
1509 // On non-Android platforms Resume() is always allowed. 1516 // On non-Android platforms Resume() is always allowed.
1510 return true; 1517 return true;
1511 #endif 1518 #endif
1512 } 1519 }
1513 1520
1514 } // namespace media 1521 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698