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

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

Issue 1880713002: media: Don't idle suspend the pipeline when in fullscreen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete newline Created 4 years, 8 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 | « media/blink/webmediaplayer_impl.h ('k') | media/blink/webmediaplayer_impl_unittest.cc » ('j') | 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 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 #if defined(OS_MACOSX) 1077 #if defined(OS_MACOSX)
1078 // TODO(sandersd): Idle suspend is disabled on OSX since hardware decoded 1078 // TODO(sandersd): Idle suspend is disabled on OSX since hardware decoded
1079 // frames are owned by the video decoder in the GPU process. A mechanism for 1079 // frames are owned by the video decoder in the GPU process. A mechanism for
1080 // detaching ownership from the decoder is needed. http://crbug.com/595716. 1080 // detaching ownership from the decoder is needed. http://crbug.com/595716.
1081 return; 1081 return;
1082 #endif 1082 #endif
1083 1083
1084 if (must_suspend) { 1084 if (must_suspend) {
1085 must_suspend_ = true; 1085 must_suspend_ = true;
1086 } else { 1086 } else {
1087 // TODO(sandersd): Remove this when |delegate_| becomes aware of this state. 1087 // TODO(sandersd): Remove this when idleness is separate from play state.
1088 if (delegate_state_ == DelegateState::PAUSED_SEEK) 1088 if (delegate_state_ == DelegateState::PAUSED_BUT_NOT_IDLE)
1089 return; 1089 return;
1090 is_idle_ = true; 1090 is_idle_ = true;
1091 } 1091 }
1092 1092
1093 UpdatePlayState(); 1093 UpdatePlayState();
1094 } 1094 }
1095 1095
1096 void WebMediaPlayerImpl::OnPlay() { 1096 void WebMediaPlayerImpl::OnPlay() {
1097 play(); 1097 play();
1098 client_->playbackStateChanged(); 1098 client_->playbackStateChanged();
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 case DelegateState::GONE: 1423 case DelegateState::GONE:
1424 delegate_->PlayerGone(delegate_id_); 1424 delegate_->PlayerGone(delegate_id_);
1425 break; 1425 break;
1426 case DelegateState::PLAYING: 1426 case DelegateState::PLAYING:
1427 delegate_->DidPlay(delegate_id_, hasVideo(), hasAudio(), false, 1427 delegate_->DidPlay(delegate_id_, hasVideo(), hasAudio(), false,
1428 pipeline_.GetMediaDuration()); 1428 pipeline_.GetMediaDuration());
1429 break; 1429 break;
1430 case DelegateState::PAUSED: 1430 case DelegateState::PAUSED:
1431 delegate_->DidPause(delegate_id_, false); 1431 delegate_->DidPause(delegate_id_, false);
1432 break; 1432 break;
1433 case DelegateState::PAUSED_SEEK: 1433 case DelegateState::PAUSED_BUT_NOT_IDLE:
1434 // It doesn't really matter what happens when we enter this state, only 1434 // It doesn't really matter what happens when we enter this state, only
1435 // that we reset the idle timer when leaving it. 1435 // that we reset the idle timer when leaving it.
1436 // 1436 //
1437 // TODO(sandersd): Ideally |delegate_| would understand this state and not 1437 // TODO(sandersd): Ideally the delegate would consider idleness and play
1438 // run the idle timer. 1438 // state as orthogonal properties so that we could avoid this.
1439 delegate_->DidPause(delegate_id_, false); 1439 delegate_->DidPause(delegate_id_, false);
1440 break; 1440 break;
1441 case DelegateState::ENDED: 1441 case DelegateState::ENDED:
1442 delegate_->DidPause(delegate_id_, true); 1442 delegate_->DidPause(delegate_id_, true);
1443 break; 1443 break;
1444 } 1444 }
1445 } 1445 }
1446 1446
1447 void WebMediaPlayerImpl::SetMemoryReportingState( 1447 void WebMediaPlayerImpl::SetMemoryReportingState(
1448 bool is_memory_reporting_enabled) { 1448 bool is_memory_reporting_enabled) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 // correctly configure the session. 1527 // correctly configure the session.
1528 // 1528 //
1529 // TODO(sandersd): If Blink told us the paused state sooner, we could create 1529 // TODO(sandersd): If Blink told us the paused state sooner, we could create
1530 // the media session sooner. 1530 // the media session sooner.
1531 bool can_play = !has_error && !is_remote && have_future_data; 1531 bool can_play = !has_error && !is_remote && have_future_data;
1532 bool has_session = can_play && !must_suspend_ && !background_suspended; 1532 bool has_session = can_play && !must_suspend_ && !background_suspended;
1533 1533
1534 if (!has_session) { 1534 if (!has_session) {
1535 result.delegate_state = DelegateState::GONE; 1535 result.delegate_state = DelegateState::GONE;
1536 } else if (paused_) { 1536 } else if (paused_) {
1537 if (seeking()) { 1537 if (seeking() || fullscreen_) {
1538 result.delegate_state = DelegateState::PAUSED_SEEK; 1538 result.delegate_state = DelegateState::PAUSED_BUT_NOT_IDLE;
1539 } else if (ended_) { 1539 } else if (ended_) {
1540 result.delegate_state = DelegateState::ENDED; 1540 result.delegate_state = DelegateState::ENDED;
1541 } else { 1541 } else {
1542 result.delegate_state = DelegateState::PAUSED; 1542 result.delegate_state = DelegateState::PAUSED;
1543 } 1543 }
1544 } else { 1544 } else {
1545 result.delegate_state = DelegateState::PLAYING; 1545 result.delegate_state = DelegateState::PLAYING;
1546 } 1546 }
1547 1547
1548 // It's not critical if some cases where memory usage can change are missed, 1548 // It's not critical if some cases where memory usage can change are missed,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 << ", Video: " << stats.video_memory_usage << ", DataSource: " 1587 << ", Video: " << stats.video_memory_usage << ", DataSource: "
1588 << (data_source_ ? data_source_->GetMemoryUsage() : 0) 1588 << (data_source_ ? data_source_->GetMemoryUsage() : 0)
1589 << ", Demuxer: " << demuxer_memory_usage; 1589 << ", Demuxer: " << demuxer_memory_usage;
1590 1590
1591 const int64_t delta = current_memory_usage - last_reported_memory_usage_; 1591 const int64_t delta = current_memory_usage - last_reported_memory_usage_;
1592 last_reported_memory_usage_ = current_memory_usage; 1592 last_reported_memory_usage_ = current_memory_usage;
1593 adjust_allocated_memory_cb_.Run(delta); 1593 adjust_allocated_memory_cb_.Run(delta);
1594 } 1594 }
1595 1595
1596 } // namespace media 1596 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698