| 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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 757 |
| 758 if (hasVideo()) { | 758 if (hasVideo()) { |
| 759 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", | 759 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", |
| 760 is_accelerated_compositing_active_); | 760 is_accelerated_compositing_active_); |
| 761 } | 761 } |
| 762 | 762 |
| 763 if (pipeline_->IsLocalSource()) | 763 if (pipeline_->IsLocalSource()) |
| 764 SetNetworkState(WebKit::WebMediaPlayer::Loaded); | 764 SetNetworkState(WebKit::WebMediaPlayer::Loaded); |
| 765 | 765 |
| 766 SetReadyState(WebKit::WebMediaPlayer::HaveMetadata); | 766 SetReadyState(WebKit::WebMediaPlayer::HaveMetadata); |
| 767 // Fire canplaythrough immediately after playback begins because of | 767 SetReadyState(WebKit::WebMediaPlayer::HaveFutureData); |
| 768 // crbug.com/106480. | |
| 769 // TODO(vrk): set ready state to HaveFutureData when bug above is fixed. | |
| 770 SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); | |
| 771 } else { | 768 } else { |
| 772 // TODO(hclam): should use |status| to determine the state | 769 // TODO(hclam): should use |status| to determine the state |
| 773 // properly and reports error using MediaError. | 770 // properly and reports error using MediaError. |
| 774 // WebKit uses FormatError to indicate an error for bogus URL or bad file. | 771 // WebKit uses FormatError to indicate an error for bogus URL or bad file. |
| 775 // Since we are at the initialization stage we can safely treat every error | 772 // Since we are at the initialization stage we can safely treat every error |
| 776 // as format error. Should post a task to call to |webmediaplayer_|. | 773 // as format error. Should post a task to call to |webmediaplayer_|. |
| 777 SetNetworkState(WebKit::WebMediaPlayer::FormatError); | 774 SetNetworkState(WebKit::WebMediaPlayer::FormatError); |
| 778 } | 775 } |
| 779 | 776 |
| 780 // Repaint to trigger UI update. | 777 // Repaint to trigger UI update. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 void WebMediaPlayerImpl::OnNetworkEvent(NetworkEvent type) { | 846 void WebMediaPlayerImpl::OnNetworkEvent(NetworkEvent type) { |
| 850 DCHECK_EQ(main_loop_, MessageLoop::current()); | 847 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 851 switch(type) { | 848 switch(type) { |
| 852 case media::DOWNLOAD_CONTINUED: | 849 case media::DOWNLOAD_CONTINUED: |
| 853 SetNetworkState(WebKit::WebMediaPlayer::Loading); | 850 SetNetworkState(WebKit::WebMediaPlayer::Loading); |
| 854 break; | 851 break; |
| 855 case media::DOWNLOAD_PAUSED: | 852 case media::DOWNLOAD_PAUSED: |
| 856 SetNetworkState(WebKit::WebMediaPlayer::Idle); | 853 SetNetworkState(WebKit::WebMediaPlayer::Idle); |
| 857 break; | 854 break; |
| 858 case media::CAN_PLAY_THROUGH: | 855 case media::CAN_PLAY_THROUGH: |
| 859 // Temporarily disable delayed firing of CAN_PLAY_THROUGH due to | 856 SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); |
| 860 // crbug.com/106480. | |
| 861 // TODO(vrk): uncomment code below when bug above is fixed. | |
| 862 // SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); | |
| 863 break; | 857 break; |
| 864 default: | 858 default: |
| 865 NOTREACHED(); | 859 NOTREACHED(); |
| 866 } | 860 } |
| 867 } | 861 } |
| 868 | 862 |
| 869 void WebMediaPlayerImpl::OnDemuxerOpened() { | 863 void WebMediaPlayerImpl::OnDemuxerOpened() { |
| 870 DCHECK_EQ(main_loop_, MessageLoop::current()); | 864 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 871 | 865 |
| 872 GetClient()->sourceOpened(); | 866 GetClient()->sourceOpened(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 return client_; | 928 return client_; |
| 935 } | 929 } |
| 936 | 930 |
| 937 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 931 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 938 DCHECK_EQ(main_loop_, MessageLoop::current()); | 932 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 939 incremented_externally_allocated_memory_ = true; | 933 incremented_externally_allocated_memory_ = true; |
| 940 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 934 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 941 } | 935 } |
| 942 | 936 |
| 943 } // namespace webkit_media | 937 } // namespace webkit_media |
| OLD | NEW |