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/ptr_util.h" | 10 #include "base/memory/ptr_util.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 std::unique_ptr<MediaTracks> tracks) { | 84 std::unique_ptr<MediaTracks> tracks) { |
85 CHECK(tracks); | 85 CHECK(tracks); |
| 86 CHECK_GT(tracks->tracks().size(), 0u); |
| 87 |
| 88 // Verify that track ids are unique. |
| 89 std::set<MediaTrack::TrackId> track_ids; |
| 90 for (const auto& track : tracks->tracks()) { |
| 91 EXPECT_EQ(track_ids.end(), track_ids.find(track->id())); |
| 92 track_ids.insert(track->id()); |
| 93 } |
86 } | 94 } |
87 | 95 |
88 void PipelineIntegrationTestBase::OnEnded() { | 96 void PipelineIntegrationTestBase::OnEnded() { |
89 DCHECK(!ended_); | 97 DCHECK(!ended_); |
90 ended_ = true; | 98 ended_ = true; |
91 pipeline_status_ = PIPELINE_OK; | 99 pipeline_status_ = PIPELINE_OK; |
92 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 100 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
93 } | 101 } |
94 | 102 |
95 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { | 103 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 base::Unretained(this), wait_time), | 266 base::Unretained(this), wait_time), |
259 base::TimeDelta::FromMilliseconds(10)); | 267 base::TimeDelta::FromMilliseconds(10)); |
260 message_loop_.Run(); | 268 message_loop_.Run(); |
261 return (pipeline_status_ == PIPELINE_OK); | 269 return (pipeline_status_ == PIPELINE_OK); |
262 } | 270 } |
263 | 271 |
264 void PipelineIntegrationTestBase::CreateDemuxer( | 272 void PipelineIntegrationTestBase::CreateDemuxer( |
265 std::unique_ptr<DataSource> data_source) { | 273 std::unique_ptr<DataSource> data_source) { |
266 data_source_ = std::move(data_source); | 274 data_source_ = std::move(data_source); |
267 | 275 |
268 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = | |
269 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB, | |
270 base::Unretained(this)); | |
271 | |
272 #if !defined(MEDIA_DISABLE_FFMPEG) | 276 #if !defined(MEDIA_DISABLE_FFMPEG) |
273 demuxer_ = std::unique_ptr<Demuxer>(new FFmpegDemuxer( | 277 demuxer_ = std::unique_ptr<Demuxer>(new FFmpegDemuxer( |
274 message_loop_.task_runner(), data_source_.get(), | 278 message_loop_.task_runner(), data_source_.get(), |
275 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, | 279 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, |
276 base::Unretained(this)), | 280 base::Unretained(this)), |
277 tracks_updated_cb, new MediaLog())); | 281 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB, |
| 282 base::Unretained(this)), |
| 283 new MediaLog())); |
278 #endif | 284 #endif |
279 } | 285 } |
280 | 286 |
281 std::unique_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { | 287 std::unique_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { |
282 ScopedVector<VideoDecoder> video_decoders; | 288 ScopedVector<VideoDecoder> video_decoders; |
283 #if !defined(MEDIA_DISABLE_LIBVPX) | 289 #if !defined(MEDIA_DISABLE_LIBVPX) |
284 video_decoders.push_back(new VpxVideoDecoder()); | 290 video_decoders.push_back(new VpxVideoDecoder()); |
285 #endif // !defined(MEDIA_DISABLE_LIBVPX) | 291 #endif // !defined(MEDIA_DISABLE_LIBVPX) |
286 | 292 |
287 #if !defined(MEDIA_DISABLE_FFMPEG) | 293 #if !defined(MEDIA_DISABLE_FFMPEG) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 DCHECK(clockless_playback_); | 387 DCHECK(clockless_playback_); |
382 return clockless_audio_sink_->render_time(); | 388 return clockless_audio_sink_->render_time(); |
383 } | 389 } |
384 | 390 |
385 base::TimeTicks DummyTickClock::NowTicks() { | 391 base::TimeTicks DummyTickClock::NowTicks() { |
386 now_ += base::TimeDelta::FromSeconds(60); | 392 now_ += base::TimeDelta::FromSeconds(60); |
387 return now_; | 393 return now_; |
388 } | 394 } |
389 | 395 |
390 } // namespace media | 396 } // namespace media |
OLD | NEW |