OLD | NEW |
---|---|
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 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1445 ReportMemoryUsage(); | 1445 ReportMemoryUsage(); |
1446 } | 1446 } |
1447 } | 1447 } |
1448 | 1448 |
1449 void WebMediaPlayerImpl::SetSuspendState(bool is_suspended) { | 1449 void WebMediaPlayerImpl::SetSuspendState(bool is_suspended) { |
1450 // Do not change the state after an error has occurred. | 1450 // Do not change the state after an error has occurred. |
1451 // TODO(sandersd): Update PipelineController to remove the need for this. | 1451 // TODO(sandersd): Update PipelineController to remove the need for this. |
1452 if (IsNetworkStateError(network_state_)) | 1452 if (IsNetworkStateError(network_state_)) |
1453 return; | 1453 return; |
1454 | 1454 |
1455 #if defined(OS_MACOSX) || defined(OS_WIN) | 1455 #if !defined(OS_ANDROID) |
DaleCurtis
2016/05/28 00:23:32
OS_ANDROID, OS_CHROMEOS are worth keeping I think.
| |
1456 // TODO(sandersd): Idle suspend is disabled on OSX and Windows for hardware | 1456 // TODO(sandersd): idle suspend is disabled if decoder owns video frame: used |
1457 // decoding / opaque video frames since these frames are owned by the decoder | 1457 // on OSX+Windows hardware decoding/opaque video frames (decoder in GPU |
1458 // in the GPU process. http://crbug.com/595716 and http://crbug.com/602708 | 1458 // process) and on Chromecast (decoder in browser process). |
1459 // http://crbug.com/595716 and http://crbug.com/602708 | |
1459 if (can_suspend_state_ == CanSuspendState::UNKNOWN) { | 1460 if (can_suspend_state_ == CanSuspendState::UNKNOWN) { |
1460 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor(); | 1461 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor(); |
1461 if (frame) { | 1462 if (frame) { |
1462 can_suspend_state_ = | 1463 can_suspend_state_ = |
1463 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME) | 1464 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME) |
1464 ? CanSuspendState::NO | 1465 ? CanSuspendState::NO |
1465 : CanSuspendState::YES; | 1466 : CanSuspendState::YES; |
1466 } | 1467 } |
1467 } | 1468 } |
1468 #else | 1469 #else |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1592 << ", Video: " << stats.video_memory_usage << ", DataSource: " | 1593 << ", Video: " << stats.video_memory_usage << ", DataSource: " |
1593 << (data_source_ ? data_source_->GetMemoryUsage() : 0) | 1594 << (data_source_ ? data_source_->GetMemoryUsage() : 0) |
1594 << ", Demuxer: " << demuxer_memory_usage; | 1595 << ", Demuxer: " << demuxer_memory_usage; |
1595 | 1596 |
1596 const int64_t delta = current_memory_usage - last_reported_memory_usage_; | 1597 const int64_t delta = current_memory_usage - last_reported_memory_usage_; |
1597 last_reported_memory_usage_ = current_memory_usage; | 1598 last_reported_memory_usage_ = current_memory_usage; |
1598 adjust_allocated_memory_cb_.Run(delta); | 1599 adjust_allocated_memory_cb_.Run(delta); |
1599 } | 1600 } |
1600 | 1601 |
1601 } // namespace media | 1602 } // namespace media |
OLD | NEW |