OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/media/webmediaplayer_impl.h" | 5 #include "webkit/media/webmediaplayer_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 743 |
744 if (hasVideo()) { | 744 if (hasVideo()) { |
745 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", | 745 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", |
746 is_accelerated_compositing_active_); | 746 is_accelerated_compositing_active_); |
747 } | 747 } |
748 | 748 |
749 if (pipeline_->IsLoaded()) | 749 if (pipeline_->IsLoaded()) |
750 SetNetworkState(WebKit::WebMediaPlayer::Loaded); | 750 SetNetworkState(WebKit::WebMediaPlayer::Loaded); |
751 | 751 |
752 SetReadyState(WebKit::WebMediaPlayer::HaveMetadata); | 752 SetReadyState(WebKit::WebMediaPlayer::HaveMetadata); |
753 SetReadyState(WebKit::WebMediaPlayer::HaveFutureData); | 753 // Fire canplaythrough immediately after playback begins because of |
| 754 // crbug.com/105163. |
| 755 // TODO(vrk): set ready state to HaveFutureData when bug above is fixed. |
| 756 SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); |
754 } else { | 757 } else { |
755 // TODO(hclam): should use |status| to determine the state | 758 // TODO(hclam): should use |status| to determine the state |
756 // properly and reports error using MediaError. | 759 // properly and reports error using MediaError. |
757 // WebKit uses FormatError to indicate an error for bogus URL or bad file. | 760 // WebKit uses FormatError to indicate an error for bogus URL or bad file. |
758 // Since we are at the initialization stage we can safely treat every error | 761 // Since we are at the initialization stage we can safely treat every error |
759 // as format error. Should post a task to call to |webmediaplayer_|. | 762 // as format error. Should post a task to call to |webmediaplayer_|. |
760 SetNetworkState(WebKit::WebMediaPlayer::FormatError); | 763 SetNetworkState(WebKit::WebMediaPlayer::FormatError); |
761 } | 764 } |
762 | 765 |
763 // Repaint to trigger UI update. | 766 // Repaint to trigger UI update. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 void WebMediaPlayerImpl::OnNetworkEvent(NetworkEvent type) { | 835 void WebMediaPlayerImpl::OnNetworkEvent(NetworkEvent type) { |
833 DCHECK_EQ(main_loop_, MessageLoop::current()); | 836 DCHECK_EQ(main_loop_, MessageLoop::current()); |
834 switch(type) { | 837 switch(type) { |
835 case media::DOWNLOAD_CONTINUED: | 838 case media::DOWNLOAD_CONTINUED: |
836 SetNetworkState(WebKit::WebMediaPlayer::Loading); | 839 SetNetworkState(WebKit::WebMediaPlayer::Loading); |
837 break; | 840 break; |
838 case media::DOWNLOAD_PAUSED: | 841 case media::DOWNLOAD_PAUSED: |
839 SetNetworkState(WebKit::WebMediaPlayer::Idle); | 842 SetNetworkState(WebKit::WebMediaPlayer::Idle); |
840 break; | 843 break; |
841 case media::CAN_PLAY_THROUGH: | 844 case media::CAN_PLAY_THROUGH: |
842 SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); | 845 // Temporarily disable delayed firing of CAN_PLAY_THROUGH due to |
| 846 // crbug.com/105163. |
| 847 // TODO(vrk): uncomment code below when bug above is fixed. |
| 848 // SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); |
843 break; | 849 break; |
844 default: | 850 default: |
845 NOTREACHED(); | 851 NOTREACHED(); |
846 } | 852 } |
847 } | 853 } |
848 | 854 |
849 void WebMediaPlayerImpl::OnDemuxerOpened() { | 855 void WebMediaPlayerImpl::OnDemuxerOpened() { |
850 DCHECK_EQ(main_loop_, MessageLoop::current()); | 856 DCHECK_EQ(main_loop_, MessageLoop::current()); |
851 | 857 |
852 GetClient()->sourceOpened(); | 858 GetClient()->sourceOpened(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 return client_; | 914 return client_; |
909 } | 915 } |
910 | 916 |
911 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 917 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
912 DCHECK_EQ(main_loop_, MessageLoop::current()); | 918 DCHECK_EQ(main_loop_, MessageLoop::current()); |
913 incremented_externally_allocated_memory_ = true; | 919 incremented_externally_allocated_memory_ = true; |
914 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 920 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
915 } | 921 } |
916 | 922 |
917 } // namespace webkit_media | 923 } // namespace webkit_media |
OLD | NEW |