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