| 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" |
| 11 #include "media/base/cdm_context.h" | 11 #include "media/base/cdm_context.h" |
| 12 #include "media/base/media_log.h" | 12 #include "media/base/media_log.h" |
| 13 #include "media/base/media_tracks.h" |
| 13 #include "media/base/test_data_util.h" | 14 #include "media/base/test_data_util.h" |
| 14 #include "media/filters/chunk_demuxer.h" | 15 #include "media/filters/chunk_demuxer.h" |
| 15 #if !defined(MEDIA_DISABLE_FFMPEG) | 16 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 16 #include "media/filters/ffmpeg_audio_decoder.h" | 17 #include "media/filters/ffmpeg_audio_decoder.h" |
| 17 #include "media/filters/ffmpeg_demuxer.h" | 18 #include "media/filters/ffmpeg_demuxer.h" |
| 18 #include "media/filters/ffmpeg_video_decoder.h" | 19 #include "media/filters/ffmpeg_video_decoder.h" |
| 19 #endif | 20 #endif |
| 20 #include "media/filters/file_data_source.h" | 21 #include "media/filters/file_data_source.h" |
| 21 #include "media/filters/opus_audio_decoder.h" | 22 #include "media/filters/opus_audio_decoder.h" |
| 22 #include "media/renderers/audio_renderer_impl.h" | 23 #include "media/renderers/audio_renderer_impl.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 70 } |
| 70 | 71 |
| 71 void PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB( | 72 void PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB( |
| 72 EmeInitDataType type, | 73 EmeInitDataType type, |
| 73 const std::vector<uint8_t>& init_data) { | 74 const std::vector<uint8_t>& init_data) { |
| 74 DCHECK(!init_data.empty()); | 75 DCHECK(!init_data.empty()); |
| 75 CHECK(!encrypted_media_init_data_cb_.is_null()); | 76 CHECK(!encrypted_media_init_data_cb_.is_null()); |
| 76 encrypted_media_init_data_cb_.Run(type, init_data); | 77 encrypted_media_init_data_cb_.Run(type, init_data); |
| 77 } | 78 } |
| 78 | 79 |
| 80 void PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB( |
| 81 scoped_ptr<MediaTracks> tracks) { |
| 82 CHECK(tracks); |
| 83 } |
| 84 |
| 79 void PipelineIntegrationTestBase::OnEnded() { | 85 void PipelineIntegrationTestBase::OnEnded() { |
| 80 DCHECK(!ended_); | 86 DCHECK(!ended_); |
| 81 ended_ = true; | 87 ended_ = true; |
| 82 pipeline_status_ = PIPELINE_OK; | 88 pipeline_status_ = PIPELINE_OK; |
| 83 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 89 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 84 } | 90 } |
| 85 | 91 |
| 86 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { | 92 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { |
| 87 if (ended_) | 93 if (ended_) |
| 88 return (pipeline_status_ == PIPELINE_OK); | 94 return (pipeline_status_ == PIPELINE_OK); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 FileDataSource* file_data_source = new FileDataSource(); | 239 FileDataSource* file_data_source = new FileDataSource(); |
| 234 base::FilePath file_path(GetTestDataFilePath(filename)); | 240 base::FilePath file_path(GetTestDataFilePath(filename)); |
| 235 CHECK(file_data_source->Initialize(file_path)) << "Is " << file_path.value() | 241 CHECK(file_data_source->Initialize(file_path)) << "Is " << file_path.value() |
| 236 << " missing?"; | 242 << " missing?"; |
| 237 data_source_.reset(file_data_source); | 243 data_source_.reset(file_data_source); |
| 238 | 244 |
| 239 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = | 245 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = |
| 240 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, | 246 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, |
| 241 base::Unretained(this)); | 247 base::Unretained(this)); |
| 242 | 248 |
| 249 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = |
| 250 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB, |
| 251 base::Unretained(this)); |
| 252 |
| 243 #if !defined(MEDIA_DISABLE_FFMPEG) | 253 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 244 demuxer_ = scoped_ptr<Demuxer>( | 254 demuxer_ = scoped_ptr<Demuxer>(new FFmpegDemuxer( |
| 245 new FFmpegDemuxer(message_loop_.task_runner(), data_source_.get(), | 255 message_loop_.task_runner(), data_source_.get(), |
| 246 encrypted_media_init_data_cb, new MediaLog())); | 256 encrypted_media_init_data_cb, tracks_updated_cb, new MediaLog())); |
| 247 #endif | 257 #endif |
| 248 } | 258 } |
| 249 | 259 |
| 250 scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { | 260 scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { |
| 251 ScopedVector<VideoDecoder> video_decoders; | 261 ScopedVector<VideoDecoder> video_decoders; |
| 252 #if !defined(MEDIA_DISABLE_LIBVPX) | 262 #if !defined(MEDIA_DISABLE_LIBVPX) |
| 253 video_decoders.push_back(new VpxVideoDecoder()); | 263 video_decoders.push_back(new VpxVideoDecoder()); |
| 254 #endif // !defined(MEDIA_DISABLE_LIBVPX) | 264 #endif // !defined(MEDIA_DISABLE_LIBVPX) |
| 255 | 265 |
| 256 #if !defined(MEDIA_DISABLE_FFMPEG) | 266 #if !defined(MEDIA_DISABLE_FFMPEG) |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 DCHECK(clockless_playback_); | 359 DCHECK(clockless_playback_); |
| 350 return clockless_audio_sink_->render_time(); | 360 return clockless_audio_sink_->render_time(); |
| 351 } | 361 } |
| 352 | 362 |
| 353 base::TimeTicks DummyTickClock::NowTicks() { | 363 base::TimeTicks DummyTickClock::NowTicks() { |
| 354 now_ += base::TimeDelta::FromSeconds(60); | 364 now_ += base::TimeDelta::FromSeconds(60); |
| 355 return now_; | 365 return now_; |
| 356 } | 366 } |
| 357 | 367 |
| 358 } // namespace media | 368 } // namespace media |
| OLD | NEW |