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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 video_weblayer_.reset(new cc_blink::WebLayerImpl(layer)); | 946 video_weblayer_.reset(new cc_blink::WebLayerImpl(layer)); |
947 video_weblayer_->layer()->SetContentsOpaque(opaque_); | 947 video_weblayer_->layer()->SetContentsOpaque(opaque_); |
948 video_weblayer_->SetContentsOpaqueIsFixed(true); | 948 video_weblayer_->SetContentsOpaqueIsFixed(true); |
949 client_->setWebLayer(video_weblayer_.get()); | 949 client_->setWebLayer(video_weblayer_.get()); |
950 | 950 |
951 // If there is video and the frame is hidden, then it may be time to suspend | 951 // If there is video and the frame is hidden, then it may be time to suspend |
952 // playback. | 952 // playback. |
953 if (delegate_ && delegate_->IsHidden()) | 953 if (delegate_ && delegate_->IsHidden()) |
954 OnHidden(); | 954 OnHidden(); |
955 } | 955 } |
| 956 |
| 957 // Tell the delegate we can now be safely suspended due to inactivity if a |
| 958 // subsequent play event does not occur. |
| 959 if (paused_) |
| 960 NotifyPlaybackPaused(); |
956 } | 961 } |
957 | 962 |
958 void WebMediaPlayerImpl::OnPipelineBufferingStateChanged( | 963 void WebMediaPlayerImpl::OnPipelineBufferingStateChanged( |
959 BufferingState buffering_state) { | 964 BufferingState buffering_state) { |
960 DVLOG(1) << __FUNCTION__ << "(" << buffering_state << ")"; | 965 DVLOG(1) << __FUNCTION__ << "(" << buffering_state << ")"; |
961 | 966 |
962 // Ignore buffering state changes until we've completed all outstanding | 967 // Ignore buffering state changes until we've completed all outstanding |
963 // operations. | 968 // operations. |
964 if (!pipeline_controller_.IsStable()) | 969 if (!pipeline_controller_.IsStable()) |
965 return; | 970 return; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { | 1464 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { |
1460 #if defined(OS_ANDROID) | 1465 #if defined(OS_ANDROID) |
1461 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); | 1466 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); |
1462 #else | 1467 #else |
1463 // On non-Android platforms Resume() is always allowed. | 1468 // On non-Android platforms Resume() is always allowed. |
1464 return true; | 1469 return true; |
1465 #endif | 1470 #endif |
1466 } | 1471 } |
1467 | 1472 |
1468 } // namespace media | 1473 } // namespace media |
OLD | NEW |