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 "media/base/pipeline.h" | 5 #include "media/base/pipeline.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); | 1168 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); |
1169 return false; | 1169 return false; |
1170 } | 1170 } |
1171 | 1171 |
1172 if (!PrepareFilter(audio_decoder)) | 1172 if (!PrepareFilter(audio_decoder)) |
1173 return false; | 1173 return false; |
1174 | 1174 |
1175 pipeline_init_state_->audio_decoder_ = audio_decoder; | 1175 pipeline_init_state_->audio_decoder_ = audio_decoder; |
1176 audio_decoder->Initialize( | 1176 audio_decoder->Initialize( |
1177 stream, | 1177 stream, |
1178 base::Bind(&Pipeline::OnFilterInitialize, this, PIPELINE_OK), | 1178 base::Bind(&Pipeline::OnFilterInitialize, this), |
1179 base::Bind(&Pipeline::OnUpdateStatistics, this)); | 1179 base::Bind(&Pipeline::OnUpdateStatistics, this)); |
1180 return true; | 1180 return true; |
1181 } | 1181 } |
1182 | 1182 |
1183 bool Pipeline::InitializeVideoDecoder( | 1183 bool Pipeline::InitializeVideoDecoder( |
1184 const scoped_refptr<Demuxer>& demuxer) { | 1184 const scoped_refptr<Demuxer>& demuxer) { |
1185 DCHECK_EQ(MessageLoop::current(), message_loop_); | 1185 DCHECK_EQ(MessageLoop::current(), message_loop_); |
1186 DCHECK(IsPipelineOk()); | 1186 DCHECK(IsPipelineOk()); |
1187 | 1187 |
1188 scoped_refptr<DemuxerStream> stream; | 1188 scoped_refptr<DemuxerStream> stream; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 if (!audio_renderer_) { | 1224 if (!audio_renderer_) { |
1225 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); | 1225 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); |
1226 return false; | 1226 return false; |
1227 } | 1227 } |
1228 | 1228 |
1229 if (!PrepareFilter(audio_renderer_)) | 1229 if (!PrepareFilter(audio_renderer_)) |
1230 return false; | 1230 return false; |
1231 | 1231 |
1232 audio_renderer_->Initialize( | 1232 audio_renderer_->Initialize( |
1233 decoder, | 1233 decoder, |
1234 base::Bind(&Pipeline::OnFilterInitialize, this, PIPELINE_OK), | 1234 base::Bind(&Pipeline::OnFilterInitialize, this), |
1235 base::Bind(&Pipeline::OnAudioUnderflow, this)); | 1235 base::Bind(&Pipeline::OnAudioUnderflow, this)); |
1236 return true; | 1236 return true; |
1237 } | 1237 } |
1238 | 1238 |
1239 bool Pipeline::InitializeVideoRenderer( | 1239 bool Pipeline::InitializeVideoRenderer( |
1240 const scoped_refptr<VideoDecoder>& decoder) { | 1240 const scoped_refptr<VideoDecoder>& decoder) { |
1241 DCHECK_EQ(MessageLoop::current(), message_loop_); | 1241 DCHECK_EQ(MessageLoop::current(), message_loop_); |
1242 DCHECK(IsPipelineOk()); | 1242 DCHECK(IsPipelineOk()); |
1243 | 1243 |
1244 if (!decoder) | 1244 if (!decoder) |
1245 return false; | 1245 return false; |
1246 | 1246 |
1247 filter_collection_->SelectVideoRenderer(&video_renderer_); | 1247 filter_collection_->SelectVideoRenderer(&video_renderer_); |
1248 if (!video_renderer_) { | 1248 if (!video_renderer_) { |
1249 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); | 1249 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); |
1250 return false; | 1250 return false; |
1251 } | 1251 } |
1252 | 1252 |
1253 if (!PrepareFilter(video_renderer_)) | 1253 if (!PrepareFilter(video_renderer_)) |
1254 return false; | 1254 return false; |
1255 | 1255 |
1256 video_renderer_->Initialize( | 1256 video_renderer_->Initialize( |
1257 decoder, | 1257 decoder, |
1258 base::Bind(&Pipeline::OnFilterInitialize, this, PIPELINE_OK), | 1258 base::Bind(&Pipeline::OnFilterInitialize, this), |
1259 base::Bind(&Pipeline::OnUpdateStatistics, this)); | 1259 base::Bind(&Pipeline::OnUpdateStatistics, this)); |
1260 return true; | 1260 return true; |
1261 } | 1261 } |
1262 | 1262 |
1263 void Pipeline::TearDownPipeline() { | 1263 void Pipeline::TearDownPipeline() { |
1264 DCHECK_EQ(MessageLoop::current(), message_loop_); | 1264 DCHECK_EQ(MessageLoop::current(), message_loop_); |
1265 DCHECK_NE(kStopped, state_); | 1265 DCHECK_NE(kStopped, state_); |
1266 | 1266 |
1267 DCHECK(!tearing_down_ || // Teardown on Stop(). | 1267 DCHECK(!tearing_down_ || // Teardown on Stop(). |
1268 (tearing_down_ && error_caused_teardown_) || // Teardown on error. | 1268 (tearing_down_ && error_caused_teardown_) || // Teardown on error. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { | 1412 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { |
1413 lock_.AssertAcquired(); | 1413 lock_.AssertAcquired(); |
1414 if (!waiting_for_clock_update_) | 1414 if (!waiting_for_clock_update_) |
1415 return; | 1415 return; |
1416 | 1416 |
1417 waiting_for_clock_update_ = false; | 1417 waiting_for_clock_update_ = false; |
1418 clock_->Play(); | 1418 clock_->Play(); |
1419 } | 1419 } |
1420 | 1420 |
1421 } // namespace media | 1421 } // namespace media |
OLD | NEW |