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