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

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

Issue 1972783003: Disable idle suspend for Chromecast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted all content/ changes, API now in Renderer Created 4 years, 7 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
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 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 ReportMemoryUsage(); 1451 ReportMemoryUsage();
1452 } 1452 }
1453 } 1453 }
1454 1454
1455 void WebMediaPlayerImpl::SetSuspendState(bool is_suspended) { 1455 void WebMediaPlayerImpl::SetSuspendState(bool is_suspended) {
1456 // Do not change the state after an error has occurred. 1456 // Do not change the state after an error has occurred.
1457 // TODO(sandersd): Update PipelineController to remove the need for this. 1457 // TODO(sandersd): Update PipelineController to remove the need for this.
1458 if (IsNetworkStateError(network_state_)) 1458 if (IsNetworkStateError(network_state_))
1459 return; 1459 return;
1460 1460
1461 if (can_suspend_state_ == CanSuspendState::UNKNOWN) {
1461 #if defined(OS_MACOSX) || defined(OS_WIN) 1462 #if defined(OS_MACOSX) || defined(OS_WIN)
1462 // TODO(sandersd): Idle suspend is disabled on OSX and Windows for hardware 1463 // TODO(sandersd): Idle suspend is disabled on OSX and Windows for hardware
1463 // decoding / opaque video frames since these frames are owned by the decoder 1464 // decoding / opaque video frames since these frames are owned by the
1464 // in the GPU process. http://crbug.com/595716 and http://crbug.com/602708 1465 // decoder in the GPU process. http://crbug.com/595716 and
1465 if (can_suspend_state_ == CanSuspendState::UNKNOWN) { 1466 // http://crbug.com/602708
1466 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor(); 1467 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor();
1467 if (frame) { 1468 if (frame) {
1468 can_suspend_state_ = 1469 can_suspend_state_ =
1469 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME) 1470 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME)
1470 ? CanSuspendState::NO 1471 ? CanSuspendState::NO
1471 : CanSuspendState::YES; 1472 : CanSuspendState::YES;
1472 } 1473 }
1474 #else
1475 can_suspend_state_ = CanSuspendState::YES;
1476 #endif
1473 } 1477 }
1474 #else
1475 can_suspend_state_ = CanSuspendState::YES;
1476 #endif
1477 1478
1478 if (can_suspend_state_ == CanSuspendState::NO) 1479 if (can_suspend_state_ == CanSuspendState::NO || !pipeline_.CanSuspend())
sandersd (OOO until July 31) 2016/05/23 18:41:58 We should probably allow Resume() even if the pipe
1479 return; 1480 return;
1480 1481
1481 if (is_suspended) { 1482 if (is_suspended) {
1482 pipeline_controller_.Suspend(); 1483 pipeline_controller_.Suspend();
1483 } else { 1484 } else {
1484 pipeline_controller_.Resume(); 1485 pipeline_controller_.Resume();
1485 } 1486 }
1486 } 1487 }
1487 1488
1488 WebMediaPlayerImpl::PlayState 1489 WebMediaPlayerImpl::PlayState
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 << ", Video: " << stats.video_memory_usage << ", DataSource: " 1599 << ", Video: " << stats.video_memory_usage << ", DataSource: "
1599 << (data_source_ ? data_source_->GetMemoryUsage() : 0) 1600 << (data_source_ ? data_source_->GetMemoryUsage() : 0)
1600 << ", Demuxer: " << demuxer_memory_usage; 1601 << ", Demuxer: " << demuxer_memory_usage;
1601 1602
1602 const int64_t delta = current_memory_usage - last_reported_memory_usage_; 1603 const int64_t delta = current_memory_usage - last_reported_memory_usage_;
1603 last_reported_memory_usage_ = current_memory_usage; 1604 last_reported_memory_usage_ = current_memory_usage;
1604 adjust_allocated_memory_cb_.Run(delta); 1605 adjust_allocated_memory_cb_.Run(delta);
1605 } 1606 }
1606 1607
1607 } // namespace media 1608 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698