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 | 10 |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 if (data_source_) | 836 if (data_source_) |
837 data_source_->OnBufferingHaveEnough(); | 837 data_source_->OnBufferingHaveEnough(); |
838 | 838 |
839 // Blink expects a timeChanged() in response to a seek(). | 839 // Blink expects a timeChanged() in response to a seek(). |
840 if (should_notify_time_changed_) | 840 if (should_notify_time_changed_) |
841 client_->timeChanged(); | 841 client_->timeChanged(); |
842 } | 842 } |
843 | 843 |
844 void WebMediaPlayerImpl::OnDemuxerOpened() { | 844 void WebMediaPlayerImpl::OnDemuxerOpened() { |
845 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 845 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
846 client_->mediaSourceOpened(new WebMediaSourceImpl( | 846 client_->mediaSourceOpened( |
847 chunk_demuxer_, base::Bind(&MediaLog::AddLogEvent, media_log_))); | 847 new WebMediaSourceImpl(chunk_demuxer_, media_log_)); |
848 } | 848 } |
849 | 849 |
850 void WebMediaPlayerImpl::OnAddTextTrack( | 850 void WebMediaPlayerImpl::OnAddTextTrack( |
851 const TextTrackConfig& config, | 851 const TextTrackConfig& config, |
852 const AddTextTrackDoneCB& done_cb) { | 852 const AddTextTrackDoneCB& done_cb) { |
853 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 853 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
854 | 854 |
855 const WebInbandTextTrackImpl::Kind web_kind = | 855 const WebInbandTextTrackImpl::Kind web_kind = |
856 static_cast<WebInbandTextTrackImpl::Kind>(config.kind()); | 856 static_cast<WebInbandTextTrackImpl::Kind>(config.kind()); |
857 const blink::WebString web_label = | 857 const blink::WebString web_label = |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 DCHECK(data_source_); | 904 DCHECK(data_source_); |
905 | 905 |
906 demuxer_.reset(new FFmpegDemuxer(media_task_runner_, data_source_.get(), | 906 demuxer_.reset(new FFmpegDemuxer(media_task_runner_, data_source_.get(), |
907 encrypted_media_init_data_cb, media_log_)); | 907 encrypted_media_init_data_cb, media_log_)); |
908 } else { | 908 } else { |
909 DCHECK(!chunk_demuxer_); | 909 DCHECK(!chunk_demuxer_); |
910 DCHECK(!data_source_); | 910 DCHECK(!data_source_); |
911 | 911 |
912 chunk_demuxer_ = new ChunkDemuxer( | 912 chunk_demuxer_ = new ChunkDemuxer( |
913 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened), | 913 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened), |
914 encrypted_media_init_data_cb, | 914 encrypted_media_init_data_cb, media_log_, true); |
915 base::Bind(&MediaLog::AddLogEvent, media_log_), media_log_, true); | |
916 demuxer_.reset(chunk_demuxer_); | 915 demuxer_.reset(chunk_demuxer_); |
917 } | 916 } |
918 | 917 |
919 // ... and we're ready to go! | 918 // ... and we're ready to go! |
920 seeking_ = true; | 919 seeking_ = true; |
921 | 920 |
922 pipeline_.Start( | 921 pipeline_.Start( |
923 demuxer_.get(), | 922 demuxer_.get(), |
924 renderer_factory_->CreateRenderer( | 923 renderer_factory_->CreateRenderer( |
925 media_task_runner_, audio_source_provider_.get(), compositor_), | 924 media_task_runner_, audio_source_provider_.get(), compositor_), |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 | 1030 |
1032 // pause() may be called after playback has ended and the HTMLMediaElement | 1031 // pause() may be called after playback has ended and the HTMLMediaElement |
1033 // requires that currentTime() == duration() after ending. We want to ensure | 1032 // requires that currentTime() == duration() after ending. We want to ensure |
1034 // |paused_time_| matches currentTime() in this case or a future seek() may | 1033 // |paused_time_| matches currentTime() in this case or a future seek() may |
1035 // incorrectly discard what it thinks is a seek to the existing time. | 1034 // incorrectly discard what it thinks is a seek to the existing time. |
1036 paused_time_ = | 1035 paused_time_ = |
1037 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); | 1036 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); |
1038 } | 1037 } |
1039 | 1038 |
1040 } // namespace media | 1039 } // namespace media |
OLD | NEW |