Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: media/base/pipeline_impl.cc

Issue 4991003: Revert 66125 -- Broke Windows build - Move FilterType into MediaFilterCollect... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/mock_filters.h ('k') | media/filters/decoder_base_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, 5 // TODO(scherkus): clean up PipelineImpl... too many crazy function names,
6 // potential deadlocks, etc... 6 // potential deadlocks, etc...
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/condition_variable.h" 10 #include "base/condition_variable.h"
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 filter->set_host(this); 947 filter->set_host(this);
948 filters_.push_back(make_scoped_refptr(filter.get())); 948 filters_.push_back(make_scoped_refptr(filter.get()));
949 } 949 }
950 950
951 void PipelineImpl::InitializeDataSource() { 951 void PipelineImpl::InitializeDataSource() {
952 DCHECK_EQ(MessageLoop::current(), message_loop_); 952 DCHECK_EQ(MessageLoop::current(), message_loop_);
953 DCHECK(IsPipelineOk()); 953 DCHECK(IsPipelineOk());
954 954
955 scoped_refptr<DataSource> data_source; 955 scoped_refptr<DataSource> data_source;
956 while (true) { 956 while (true) {
957 filter_collection_->SelectDataSource(&data_source); 957 filter_collection_->SelectFilter(&data_source);
958 if (!data_source || data_source->IsUrlSupported(url_)) 958 if (!data_source || data_source->IsUrlSupported(url_))
959 break; 959 break;
960 } 960 }
961 961
962 if (!data_source) { 962 if (!data_source) {
963 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); 963 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING);
964 return; 964 return;
965 } 965 }
966 966
967 PrepareFilter(data_source); 967 PrepareFilter(data_source);
968 pipeline_init_state_->data_source_ = data_source; 968 pipeline_init_state_->data_source_ = data_source;
969 data_source->Initialize( 969 data_source->Initialize(
970 url_, NewCallback(this, &PipelineImpl::OnFilterInitialize)); 970 url_, NewCallback(this, &PipelineImpl::OnFilterInitialize));
971 } 971 }
972 972
973 void PipelineImpl::InitializeDemuxer( 973 void PipelineImpl::InitializeDemuxer(
974 const scoped_refptr<DataSource>& data_source) { 974 const scoped_refptr<DataSource>& data_source) {
975 DCHECK_EQ(MessageLoop::current(), message_loop_); 975 DCHECK_EQ(MessageLoop::current(), message_loop_);
976 DCHECK(IsPipelineOk()); 976 DCHECK(IsPipelineOk());
977 977
978 scoped_refptr<Demuxer> demuxer; 978 scoped_refptr<Demuxer> demuxer;
979 979
980 CHECK(data_source); 980 CHECK(data_source);
981 981
982 filter_collection_->SelectDemuxer(&demuxer); 982 filter_collection_->SelectFilter(&demuxer);
983 if (!demuxer) { 983 if (!demuxer) {
984 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); 984 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING);
985 return; 985 return;
986 } 986 }
987 987
988 PrepareFilter(demuxer); 988 PrepareFilter(demuxer);
989 pipeline_init_state_->demuxer_ = demuxer; 989 pipeline_init_state_->demuxer_ = demuxer;
990 demuxer->Initialize(data_source, 990 demuxer->Initialize(data_source,
991 NewCallback(this, &PipelineImpl::OnFilterInitialize)); 991 NewCallback(this, &PipelineImpl::OnFilterInitialize));
992 } 992 }
993 993
994 bool PipelineImpl::InitializeAudioDecoder( 994 bool PipelineImpl::InitializeAudioDecoder(
995 const scoped_refptr<Demuxer>& demuxer) { 995 const scoped_refptr<Demuxer>& demuxer) {
996 DCHECK_EQ(MessageLoop::current(), message_loop_); 996 DCHECK_EQ(MessageLoop::current(), message_loop_);
997 DCHECK(IsPipelineOk()); 997 DCHECK(IsPipelineOk());
998 998
999 scoped_refptr<DemuxerStream> stream = 999 scoped_refptr<DemuxerStream> stream =
1000 FindDemuxerStream(demuxer, mime_type::kMajorTypeAudio); 1000 FindDemuxerStream(demuxer, mime_type::kMajorTypeAudio);
1001 1001
1002 if (stream) { 1002 if (stream) {
1003 scoped_refptr<AudioDecoder> audio_decoder; 1003 scoped_refptr<AudioDecoder> audio_decoder;
1004 filter_collection_->SelectAudioDecoder(&audio_decoder); 1004 filter_collection_->SelectFilter(&audio_decoder);
1005 1005
1006 if (audio_decoder) { 1006 if (audio_decoder) {
1007 PrepareFilter(audio_decoder); 1007 PrepareFilter(audio_decoder);
1008 pipeline_init_state_->audio_decoder_ = audio_decoder; 1008 pipeline_init_state_->audio_decoder_ = audio_decoder;
1009 audio_decoder->Initialize( 1009 audio_decoder->Initialize(
1010 stream, 1010 stream,
1011 NewCallback(this, &PipelineImpl::OnFilterInitialize)); 1011 NewCallback(this, &PipelineImpl::OnFilterInitialize));
1012 return true; 1012 return true;
1013 } else { 1013 } else {
1014 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); 1014 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING);
1015 } 1015 }
1016 } 1016 }
1017 1017
1018 return false; 1018 return false;
1019 } 1019 }
1020 1020
1021 bool PipelineImpl::InitializeVideoDecoder( 1021 bool PipelineImpl::InitializeVideoDecoder(
1022 const scoped_refptr<Demuxer>& demuxer) { 1022 const scoped_refptr<Demuxer>& demuxer) {
1023 DCHECK_EQ(MessageLoop::current(), message_loop_); 1023 DCHECK_EQ(MessageLoop::current(), message_loop_);
1024 DCHECK(IsPipelineOk()); 1024 DCHECK(IsPipelineOk());
1025 1025
1026 scoped_refptr<DemuxerStream> stream = 1026 scoped_refptr<DemuxerStream> stream =
1027 FindDemuxerStream(demuxer, mime_type::kMajorTypeVideo); 1027 FindDemuxerStream(demuxer, mime_type::kMajorTypeVideo);
1028 1028
1029 if (stream) { 1029 if (stream) {
1030 scoped_refptr<VideoDecoder> video_decoder; 1030 scoped_refptr<VideoDecoder> video_decoder;
1031 filter_collection_->SelectVideoDecoder(&video_decoder); 1031 filter_collection_->SelectFilter(&video_decoder);
1032 1032
1033 if (video_decoder) { 1033 if (video_decoder) {
1034 PrepareFilter(video_decoder); 1034 PrepareFilter(video_decoder);
1035 pipeline_init_state_->video_decoder_ = video_decoder; 1035 pipeline_init_state_->video_decoder_ = video_decoder;
1036 video_decoder->Initialize( 1036 video_decoder->Initialize(
1037 stream, 1037 stream,
1038 NewCallback(this, &PipelineImpl::OnFilterInitialize)); 1038 NewCallback(this, &PipelineImpl::OnFilterInitialize));
1039 return true; 1039 return true;
1040 } else { 1040 } else {
1041 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); 1041 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING);
1042 } 1042 }
1043 } 1043 }
1044 return false; 1044 return false;
1045 } 1045 }
1046 1046
1047 bool PipelineImpl::InitializeAudioRenderer( 1047 bool PipelineImpl::InitializeAudioRenderer(
1048 const scoped_refptr<AudioDecoder>& decoder) { 1048 const scoped_refptr<AudioDecoder>& decoder) {
1049 DCHECK_EQ(MessageLoop::current(), message_loop_); 1049 DCHECK_EQ(MessageLoop::current(), message_loop_);
1050 DCHECK(IsPipelineOk()); 1050 DCHECK(IsPipelineOk());
1051 1051
1052 if (decoder) { 1052 if (decoder) {
1053 filter_collection_->SelectAudioRenderer(&audio_renderer_); 1053 filter_collection_->SelectFilter(&audio_renderer_);
1054 1054
1055 if (audio_renderer_) { 1055 if (audio_renderer_) {
1056 PrepareFilter(audio_renderer_); 1056 PrepareFilter(audio_renderer_);
1057 audio_renderer_->Initialize( 1057 audio_renderer_->Initialize(
1058 decoder, NewCallback(this, &PipelineImpl::OnFilterInitialize)); 1058 decoder, NewCallback(this, &PipelineImpl::OnFilterInitialize));
1059 return true; 1059 return true;
1060 } else { 1060 } else {
1061 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); 1061 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING);
1062 } 1062 }
1063 } 1063 }
1064 return false; 1064 return false;
1065 } 1065 }
1066 1066
1067 bool PipelineImpl::InitializeVideoRenderer( 1067 bool PipelineImpl::InitializeVideoRenderer(
1068 const scoped_refptr<VideoDecoder>& decoder) { 1068 const scoped_refptr<VideoDecoder>& decoder) {
1069 DCHECK_EQ(MessageLoop::current(), message_loop_); 1069 DCHECK_EQ(MessageLoop::current(), message_loop_);
1070 DCHECK(IsPipelineOk()); 1070 DCHECK(IsPipelineOk());
1071 1071
1072 if (decoder) { 1072 if (decoder) {
1073 filter_collection_->SelectVideoRenderer(&video_renderer_); 1073 filter_collection_->SelectFilter(&video_renderer_);
1074 1074
1075 if (video_renderer_) { 1075 if (video_renderer_) {
1076 PrepareFilter(video_renderer_); 1076 PrepareFilter(video_renderer_);
1077 video_renderer_->Initialize( 1077 video_renderer_->Initialize(
1078 decoder, NewCallback(this, &PipelineImpl::OnFilterInitialize)); 1078 decoder, NewCallback(this, &PipelineImpl::OnFilterInitialize));
1079 return true; 1079 return true;
1080 } else { 1080 } else {
1081 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); 1081 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING);
1082 } 1082 }
1083 } 1083 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 this, &PipelineImpl::OnFilterStateTransition)); 1125 this, &PipelineImpl::OnFilterStateTransition));
1126 } 1126 }
1127 } else { 1127 } else {
1128 state_ = kStopped; 1128 state_ = kStopped;
1129 message_loop_->PostTask(FROM_HERE, 1129 message_loop_->PostTask(FROM_HERE,
1130 NewRunnableMethod(this, &PipelineImpl::FinishDestroyingFiltersTask)); 1130 NewRunnableMethod(this, &PipelineImpl::FinishDestroyingFiltersTask));
1131 } 1131 }
1132 } 1132 }
1133 1133
1134 } // namespace media 1134 } // namespace media
OLDNEW
« no previous file with comments | « media/base/mock_filters.h ('k') | media/filters/decoder_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698