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/test/pipeline_integration_test_base.h" | 5 #include "media/test/pipeline_integration_test_base.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 EmeInitDataType type, | 76 EmeInitDataType type, |
77 const std::vector<uint8_t>& init_data) { | 77 const std::vector<uint8_t>& init_data) { |
78 DCHECK(!init_data.empty()); | 78 DCHECK(!init_data.empty()); |
79 CHECK(!encrypted_media_init_data_cb_.is_null()); | 79 CHECK(!encrypted_media_init_data_cb_.is_null()); |
80 encrypted_media_init_data_cb_.Run(type, init_data); | 80 encrypted_media_init_data_cb_.Run(type, init_data); |
81 } | 81 } |
82 | 82 |
83 void PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB( | 83 void PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB( |
84 scoped_ptr<MediaTracks> tracks) { | 84 scoped_ptr<MediaTracks> tracks) { |
85 CHECK(tracks); | 85 CHECK(tracks); |
| 86 CHECK(demuxer_); |
| 87 |
| 88 // Generate track ids. |
| 89 std::vector<unsigned> track_ids; |
| 90 for (size_t track_id = 1; track_id <= tracks->tracks().size(); ++track_id) { |
| 91 track_ids.push_back(track_id); |
| 92 } |
| 93 |
| 94 demuxer_->OnTrackIdsAssigned(*tracks.get(), track_ids); |
86 } | 95 } |
87 | 96 |
88 void PipelineIntegrationTestBase::OnEnded() { | 97 void PipelineIntegrationTestBase::OnEnded() { |
89 DCHECK(!ended_); | 98 DCHECK(!ended_); |
90 ended_ = true; | 99 ended_ = true; |
91 pipeline_status_ = PIPELINE_OK; | 100 pipeline_status_ = PIPELINE_OK; |
92 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 101 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
93 } | 102 } |
94 | 103 |
95 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { | 104 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 base::Unretained(this), wait_time), | 275 base::Unretained(this), wait_time), |
267 base::TimeDelta::FromMilliseconds(10)); | 276 base::TimeDelta::FromMilliseconds(10)); |
268 message_loop_.Run(); | 277 message_loop_.Run(); |
269 return (pipeline_status_ == PIPELINE_OK); | 278 return (pipeline_status_ == PIPELINE_OK); |
270 } | 279 } |
271 | 280 |
272 void PipelineIntegrationTestBase::CreateDemuxer( | 281 void PipelineIntegrationTestBase::CreateDemuxer( |
273 scoped_ptr<DataSource> data_source) { | 282 scoped_ptr<DataSource> data_source) { |
274 data_source_ = std::move(data_source); | 283 data_source_ = std::move(data_source); |
275 | 284 |
276 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = | |
277 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB, | |
278 base::Unretained(this)); | |
279 | |
280 #if !defined(MEDIA_DISABLE_FFMPEG) | 285 #if !defined(MEDIA_DISABLE_FFMPEG) |
281 demuxer_ = scoped_ptr<Demuxer>(new FFmpegDemuxer( | 286 demuxer_ = scoped_ptr<Demuxer>(new FFmpegDemuxer( |
282 message_loop_.task_runner(), data_source_.get(), | 287 message_loop_.task_runner(), data_source_.get(), |
283 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, | 288 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, |
284 base::Unretained(this)), | 289 base::Unretained(this)), |
285 tracks_updated_cb, new MediaLog())); | 290 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB, |
| 291 base::Unretained(this)), |
| 292 new MediaLog())); |
286 #endif | 293 #endif |
287 } | 294 } |
288 | 295 |
289 scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { | 296 scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { |
290 ScopedVector<VideoDecoder> video_decoders; | 297 ScopedVector<VideoDecoder> video_decoders; |
291 #if !defined(MEDIA_DISABLE_LIBVPX) | 298 #if !defined(MEDIA_DISABLE_LIBVPX) |
292 video_decoders.push_back(new VpxVideoDecoder()); | 299 video_decoders.push_back(new VpxVideoDecoder()); |
293 #endif // !defined(MEDIA_DISABLE_LIBVPX) | 300 #endif // !defined(MEDIA_DISABLE_LIBVPX) |
294 | 301 |
295 #if !defined(MEDIA_DISABLE_FFMPEG) | 302 #if !defined(MEDIA_DISABLE_FFMPEG) |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 DCHECK(clockless_playback_); | 395 DCHECK(clockless_playback_); |
389 return clockless_audio_sink_->render_time(); | 396 return clockless_audio_sink_->render_time(); |
390 } | 397 } |
391 | 398 |
392 base::TimeTicks DummyTickClock::NowTicks() { | 399 base::TimeTicks DummyTickClock::NowTicks() { |
393 now_ += base::TimeDelta::FromSeconds(60); | 400 now_ += base::TimeDelta::FromSeconds(60); |
394 return now_; | 401 return now_; |
395 } | 402 } |
396 | 403 |
397 } // namespace media | 404 } // namespace media |
OLD | NEW |