| 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 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 } | 1754 } |
| 1755 | 1755 |
| 1756 void WebMediaPlayerImpl::SetSuspendState(bool is_suspended) { | 1756 void WebMediaPlayerImpl::SetSuspendState(bool is_suspended) { |
| 1757 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1757 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 1758 | 1758 |
| 1759 // Do not change the state after an error has occurred. | 1759 // Do not change the state after an error has occurred. |
| 1760 // TODO(sandersd): Update PipelineController to remove the need for this. | 1760 // TODO(sandersd): Update PipelineController to remove the need for this. |
| 1761 if (IsNetworkStateError(network_state_)) | 1761 if (IsNetworkStateError(network_state_)) |
| 1762 return; | 1762 return; |
| 1763 | 1763 |
| 1764 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && !defined(OS_MACOSX) | 1764 #if defined(OS_LINUX) |
| 1765 // TODO(sandersd): idle suspend is disabled if decoder owns video frame. | 1765 // TODO(sandersd): idle suspend is disabled if decoder owns video frame. |
| 1766 // Used on Windows+Chromecast. Since GetCurrentFrameFromCompositor is a | 1766 // Used on Chromecast. Since GetCurrentFrameFromCompositor is a synchronous |
| 1767 // synchronous cross-thread post, avoid the cost on platforms that always | 1767 // cross-thread post, avoid the cost on platforms that always allow suspend. |
| 1768 // allow suspend. Need to find a better mechanism for this. See | 1768 // Need to find a better mechanism for this. See http://crbug.com/602708 |
| 1769 // http://crbug.com/602708 | |
| 1770 if (can_suspend_state_ == CanSuspendState::UNKNOWN) { | 1769 if (can_suspend_state_ == CanSuspendState::UNKNOWN) { |
| 1771 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor(); | 1770 scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor(); |
| 1772 if (frame) { | 1771 if (frame) { |
| 1773 can_suspend_state_ = | 1772 can_suspend_state_ = |
| 1774 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME) | 1773 frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME) |
| 1775 ? CanSuspendState::NO | 1774 ? CanSuspendState::NO |
| 1776 : CanSuspendState::YES; | 1775 : CanSuspendState::YES; |
| 1777 } | 1776 } |
| 1778 } | 1777 } |
| 1779 #else | 1778 #else |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1952 pipeline_metadata_.natural_size, | 1951 pipeline_metadata_.natural_size, |
| 1953 base::Bind(&GetCurrentTimeInternal, this))); | 1952 base::Bind(&GetCurrentTimeInternal, this))); |
| 1954 watch_time_reporter_->OnVolumeChange(volume_); | 1953 watch_time_reporter_->OnVolumeChange(volume_); |
| 1955 if (delegate_ && delegate_->IsHidden()) | 1954 if (delegate_ && delegate_->IsHidden()) |
| 1956 watch_time_reporter_->OnHidden(); | 1955 watch_time_reporter_->OnHidden(); |
| 1957 else | 1956 else |
| 1958 watch_time_reporter_->OnShown(); | 1957 watch_time_reporter_->OnShown(); |
| 1959 } | 1958 } |
| 1960 | 1959 |
| 1961 } // namespace media | 1960 } // namespace media |
| OLD | NEW |