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); | |
95 } | 86 } |
96 | 87 |
97 void PipelineIntegrationTestBase::OnEnded() { | 88 void PipelineIntegrationTestBase::OnEnded() { |
98 DCHECK(!ended_); | 89 DCHECK(!ended_); |
99 ended_ = true; | 90 ended_ = true; |
100 pipeline_status_ = PIPELINE_OK; | 91 pipeline_status_ = PIPELINE_OK; |
101 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 92 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
102 } | 93 } |
103 | 94 |
104 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { | 95 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 base::Unretained(this), wait_time), | 266 base::Unretained(this), wait_time), |
276 base::TimeDelta::FromMilliseconds(10)); | 267 base::TimeDelta::FromMilliseconds(10)); |
277 message_loop_.Run(); | 268 message_loop_.Run(); |
278 return (pipeline_status_ == PIPELINE_OK); | 269 return (pipeline_status_ == PIPELINE_OK); |
279 } | 270 } |
280 | 271 |
281 void PipelineIntegrationTestBase::CreateDemuxer( | 272 void PipelineIntegrationTestBase::CreateDemuxer( |
282 scoped_ptr<DataSource> data_source) { | 273 scoped_ptr<DataSource> data_source) { |
283 data_source_ = std::move(data_source); | 274 data_source_ = std::move(data_source); |
284 | 275 |
| 276 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = |
| 277 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB, |
| 278 base::Unretained(this)); |
| 279 |
285 #if !defined(MEDIA_DISABLE_FFMPEG) | 280 #if !defined(MEDIA_DISABLE_FFMPEG) |
286 demuxer_ = scoped_ptr<Demuxer>(new FFmpegDemuxer( | 281 demuxer_ = scoped_ptr<Demuxer>(new FFmpegDemuxer( |
287 message_loop_.task_runner(), data_source_.get(), | 282 message_loop_.task_runner(), data_source_.get(), |
288 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, | 283 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, |
289 base::Unretained(this)), | 284 base::Unretained(this)), |
290 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB, | 285 tracks_updated_cb, new MediaLog())); |
291 base::Unretained(this)), | |
292 new MediaLog())); | |
293 #endif | 286 #endif |
294 } | 287 } |
295 | 288 |
296 scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { | 289 scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { |
297 ScopedVector<VideoDecoder> video_decoders; | 290 ScopedVector<VideoDecoder> video_decoders; |
298 #if !defined(MEDIA_DISABLE_LIBVPX) | 291 #if !defined(MEDIA_DISABLE_LIBVPX) |
299 video_decoders.push_back(new VpxVideoDecoder()); | 292 video_decoders.push_back(new VpxVideoDecoder()); |
300 #endif // !defined(MEDIA_DISABLE_LIBVPX) | 293 #endif // !defined(MEDIA_DISABLE_LIBVPX) |
301 | 294 |
302 #if !defined(MEDIA_DISABLE_FFMPEG) | 295 #if !defined(MEDIA_DISABLE_FFMPEG) |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 DCHECK(clockless_playback_); | 388 DCHECK(clockless_playback_); |
396 return clockless_audio_sink_->render_time(); | 389 return clockless_audio_sink_->render_time(); |
397 } | 390 } |
398 | 391 |
399 base::TimeTicks DummyTickClock::NowTicks() { | 392 base::TimeTicks DummyTickClock::NowTicks() { |
400 now_ += base::TimeDelta::FromSeconds(60); | 393 now_ += base::TimeDelta::FromSeconds(60); |
401 return now_; | 394 return now_; |
402 } | 395 } |
403 | 396 |
404 } // namespace media | 397 } // namespace media |
OLD | NEW |