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 <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 if (error == PIPELINE_ERROR_DECRYPT) | 782 if (error == PIPELINE_ERROR_DECRYPT) |
783 encrypted_media_support_.OnPipelineDecryptError(); | 783 encrypted_media_support_.OnPipelineDecryptError(); |
784 } | 784 } |
785 | 785 |
786 void WebMediaPlayerImpl::OnPipelineMetadata( | 786 void WebMediaPlayerImpl::OnPipelineMetadata( |
787 PipelineMetadata metadata) { | 787 PipelineMetadata metadata) { |
788 DVLOG(1) << __FUNCTION__; | 788 DVLOG(1) << __FUNCTION__; |
789 | 789 |
790 pipeline_metadata_ = metadata; | 790 pipeline_metadata_ = metadata; |
791 | 791 |
792 UMA_HISTOGRAM_ENUMERATION("Media.VideoRotation", | 792 UMA_HISTOGRAM_ENUMERATION("Media.VideoRotation", metadata.video_rotation, |
793 metadata.video_rotation, | |
794 VIDEO_ROTATION_MAX + 1); | 793 VIDEO_ROTATION_MAX + 1); |
795 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); | 794 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); |
796 | 795 |
797 if (hasVideo()) { | 796 if (hasVideo()) { |
798 DCHECK(!video_weblayer_); | 797 DCHECK(!video_weblayer_); |
799 scoped_refptr<cc::VideoLayer> layer = | 798 scoped_refptr<cc::VideoLayer> layer = |
800 cc::VideoLayer::Create(compositor_, pipeline_metadata_.video_rotation); | 799 cc::VideoLayer::Create(compositor_, pipeline_metadata_.video_rotation); |
801 | 800 |
802 if (pipeline_metadata_.video_rotation == VIDEO_ROTATION_90 || | 801 if (pipeline_metadata_.video_rotation == VIDEO_ROTATION_90 || |
803 pipeline_metadata_.video_rotation == VIDEO_ROTATION_270) { | 802 pipeline_metadata_.video_rotation == VIDEO_ROTATION_270) { |
(...skipping 13 matching lines...) Expand all Loading... |
817 | 816 |
818 // Ignore buffering state changes until we've completed all outstanding seeks. | 817 // Ignore buffering state changes until we've completed all outstanding seeks. |
819 if (seeking_ || pending_seek_) | 818 if (seeking_ || pending_seek_) |
820 return; | 819 return; |
821 | 820 |
822 // TODO(scherkus): Handle other buffering states when Pipeline starts using | 821 // TODO(scherkus): Handle other buffering states when Pipeline starts using |
823 // them and translate them ready state changes http://crbug.com/144683 | 822 // them and translate them ready state changes http://crbug.com/144683 |
824 DCHECK_EQ(buffering_state, BUFFERING_HAVE_ENOUGH); | 823 DCHECK_EQ(buffering_state, BUFFERING_HAVE_ENOUGH); |
825 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); | 824 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); |
826 | 825 |
| 826 // Let the DataSource know we have enough data. It may use this information to |
| 827 // release unused network connections. |
| 828 if (data_source_) |
| 829 data_source_->OnBufferingHaveEnough(); |
| 830 |
827 // Blink expects a timeChanged() in response to a seek(). | 831 // Blink expects a timeChanged() in response to a seek(). |
828 if (should_notify_time_changed_) | 832 if (should_notify_time_changed_) |
829 client_->timeChanged(); | 833 client_->timeChanged(); |
830 } | 834 } |
831 | 835 |
832 void WebMediaPlayerImpl::OnDemuxerOpened() { | 836 void WebMediaPlayerImpl::OnDemuxerOpened() { |
833 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 837 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
834 client_->mediaSourceOpened(new WebMediaSourceImpl( | 838 client_->mediaSourceOpened(new WebMediaSourceImpl( |
835 chunk_demuxer_, base::Bind(&LogMediaSourceError, media_log_))); | 839 chunk_demuxer_, base::Bind(&LogMediaSourceError, media_log_))); |
836 } | 840 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 | 1039 |
1036 // pause() may be called after playback has ended and the HTMLMediaElement | 1040 // pause() may be called after playback has ended and the HTMLMediaElement |
1037 // requires that currentTime() == duration() after ending. We want to ensure | 1041 // requires that currentTime() == duration() after ending. We want to ensure |
1038 // |paused_time_| matches currentTime() in this case or a future seek() may | 1042 // |paused_time_| matches currentTime() in this case or a future seek() may |
1039 // incorrectly discard what it thinks is a seek to the existing time. | 1043 // incorrectly discard what it thinks is a seek to the existing time. |
1040 paused_time_ = | 1044 paused_time_ = |
1041 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); | 1045 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); |
1042 } | 1046 } |
1043 | 1047 |
1044 } // namespace media | 1048 } // namespace media |
OLD | NEW |