| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "media/base/cdm_context.h" | 9 #include "media/base/cdm_context.h" |
| 10 #include "media/base/media_log.h" | 10 #include "media/base/media_log.h" |
| 11 #include "media/base/test_data_util.h" | 11 #include "media/base/test_data_util.h" |
| 12 #include "media/filters/chunk_demuxer.h" | 12 #include "media/filters/chunk_demuxer.h" |
| 13 #if !defined(MEDIA_DISABLE_FFMPEG) | 13 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 14 #include "media/filters/ffmpeg_audio_decoder.h" | 14 #include "media/filters/ffmpeg_audio_decoder.h" |
| 15 #include "media/filters/ffmpeg_demuxer.h" | 15 #include "media/filters/ffmpeg_demuxer.h" |
| 16 #include "media/filters/ffmpeg_video_decoder.h" | 16 #include "media/filters/ffmpeg_video_decoder.h" |
| 17 #endif | 17 #endif |
| 18 #include "media/filters/file_data_source.h" | 18 #include "media/filters/file_data_source.h" |
| 19 #include "media/filters/opus_audio_decoder.h" | 19 #include "media/filters/opus_audio_decoder.h" |
| 20 #include "media/renderers/audio_renderer_impl.h" | 20 #include "media/renderers/audio_renderer_impl.h" |
| 21 #include "media/renderers/renderer_impl.h" | 21 #include "media/renderers/renderer_impl.h" |
| 22 #if !defined(MEDIA_DISABLE_LIBVPX) | 22 #if !defined(MEDIA_DISABLE_LIBVPX) |
| 23 #include "media/filters/vpx_video_decoder.h" | 23 #include "media/filters/vpx_video_decoder.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 using ::testing::_; | 26 using ::testing::_; |
| 27 using ::testing::AnyNumber; | 27 using ::testing::AnyNumber; |
| 28 using ::testing::AtMost; | 28 using ::testing::AtMost; |
| 29 using ::testing::Invoke; | |
| 30 using ::testing::InvokeWithoutArgs; | 29 using ::testing::InvokeWithoutArgs; |
| 31 using ::testing::SaveArg; | 30 using ::testing::SaveArg; |
| 32 | 31 |
| 33 namespace media { | 32 namespace media { |
| 34 | 33 |
| 35 const char kNullVideoHash[] = "d41d8cd98f00b204e9800998ecf8427e"; | 34 const char kNullVideoHash[] = "d41d8cd98f00b204e9800998ecf8427e"; |
| 36 const char kNullAudioHash[] = "0.00,0.00,0.00,0.00,0.00,0.00,"; | 35 const char kNullAudioHash[] = "0.00,0.00,0.00,0.00,0.00,0.00,"; |
| 37 | 36 |
| 38 MockVideoRendererSink::MockVideoRendererSink() {} | |
| 39 MockVideoRendererSink::~MockVideoRendererSink() {} | |
| 40 | |
| 41 PipelineIntegrationTestBase::PipelineIntegrationTestBase() | 37 PipelineIntegrationTestBase::PipelineIntegrationTestBase() |
| 42 : hashing_enabled_(false), | 38 : hashing_enabled_(false), |
| 43 clockless_playback_(false), | 39 clockless_playback_(false), |
| 44 pipeline_( | 40 pipeline_( |
| 45 new Pipeline(message_loop_.message_loop_proxy(), new MediaLog())), | 41 new Pipeline(message_loop_.message_loop_proxy(), new MediaLog())), |
| 46 ended_(false), | 42 ended_(false), |
| 47 pipeline_status_(PIPELINE_OK), | 43 pipeline_status_(PIPELINE_OK), |
| 48 last_video_frame_format_(VideoFrame::UNKNOWN), | 44 last_video_frame_format_(VideoFrame::UNKNOWN), |
| 49 hardware_config_(AudioParameters(), AudioParameters()) { | 45 hardware_config_(AudioParameters(), AudioParameters()) { |
| 50 base::MD5Init(&md5_context_); | 46 base::MD5Init(&md5_context_); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 pipeline_->Start( | 128 pipeline_->Start( |
| 133 demuxer_.get(), CreateRenderer(), | 129 demuxer_.get(), CreateRenderer(), |
| 134 base::Bind(&PipelineIntegrationTestBase::OnEnded, base::Unretained(this)), | 130 base::Bind(&PipelineIntegrationTestBase::OnEnded, base::Unretained(this)), |
| 135 base::Bind(&PipelineIntegrationTestBase::OnError, base::Unretained(this)), | 131 base::Bind(&PipelineIntegrationTestBase::OnError, base::Unretained(this)), |
| 136 base::Bind(&PipelineIntegrationTestBase::OnStatusCallback, | 132 base::Bind(&PipelineIntegrationTestBase::OnStatusCallback, |
| 137 base::Unretained(this)), | 133 base::Unretained(this)), |
| 138 base::Bind(&PipelineIntegrationTestBase::OnMetadata, | 134 base::Bind(&PipelineIntegrationTestBase::OnMetadata, |
| 139 base::Unretained(this)), | 135 base::Unretained(this)), |
| 140 base::Bind(&PipelineIntegrationTestBase::OnBufferingStateChanged, | 136 base::Bind(&PipelineIntegrationTestBase::OnBufferingStateChanged, |
| 141 base::Unretained(this)), | 137 base::Unretained(this)), |
| 138 base::Bind(&PipelineIntegrationTestBase::OnVideoFramePaint, |
| 139 base::Unretained(this)), |
| 142 base::Closure(), base::Bind(&PipelineIntegrationTestBase::OnAddTextTrack, | 140 base::Closure(), base::Bind(&PipelineIntegrationTestBase::OnAddTextTrack, |
| 143 base::Unretained(this)), | 141 base::Unretained(this)), |
| 144 base::Bind(&PipelineIntegrationTestBase::OnWaitingForDecryptionKey, | 142 base::Bind(&PipelineIntegrationTestBase::OnWaitingForDecryptionKey, |
| 145 base::Unretained(this))); | 143 base::Unretained(this))); |
| 146 message_loop_.Run(); | 144 message_loop_.Run(); |
| 147 return pipeline_status_; | 145 return pipeline_status_; |
| 148 } | 146 } |
| 149 | 147 |
| 150 PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename, | 148 PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename, |
| 151 kTestType test_type) { | 149 kTestType test_type) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 #if !defined(MEDIA_DISABLE_LIBVPX) | 231 #if !defined(MEDIA_DISABLE_LIBVPX) |
| 234 video_decoders.push_back( | 232 video_decoders.push_back( |
| 235 new VpxVideoDecoder(message_loop_.message_loop_proxy())); | 233 new VpxVideoDecoder(message_loop_.message_loop_proxy())); |
| 236 #endif // !defined(MEDIA_DISABLE_LIBVPX) | 234 #endif // !defined(MEDIA_DISABLE_LIBVPX) |
| 237 | 235 |
| 238 #if !defined(MEDIA_DISABLE_FFMPEG) | 236 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 239 video_decoders.push_back( | 237 video_decoders.push_back( |
| 240 new FFmpegVideoDecoder(message_loop_.message_loop_proxy())); | 238 new FFmpegVideoDecoder(message_loop_.message_loop_proxy())); |
| 241 #endif | 239 #endif |
| 242 | 240 |
| 243 EXPECT_CALL(video_sink_, PaintFrameUsingOldRenderingPath(_)) | |
| 244 .WillRepeatedly( | |
| 245 Invoke(this, &PipelineIntegrationTestBase::OnVideoFramePaint)); | |
| 246 | |
| 247 // Disable frame dropping if hashing is enabled. | 241 // Disable frame dropping if hashing is enabled. |
| 248 scoped_ptr<VideoRenderer> video_renderer( | 242 scoped_ptr<VideoRenderer> video_renderer( |
| 249 new VideoRendererImpl(message_loop_.message_loop_proxy(), &video_sink_, | 243 new VideoRendererImpl(message_loop_.message_loop_proxy(), |
| 250 video_decoders.Pass(), false, new MediaLog())); | 244 video_decoders.Pass(), false, new MediaLog())); |
| 251 | 245 |
| 252 if (!clockless_playback_) { | 246 if (!clockless_playback_) { |
| 253 audio_sink_ = new NullAudioSink(message_loop_.message_loop_proxy()); | 247 audio_sink_ = new NullAudioSink(message_loop_.message_loop_proxy()); |
| 254 } else { | 248 } else { |
| 255 clockless_audio_sink_ = new ClocklessAudioSink(); | 249 clockless_audio_sink_ = new ClocklessAudioSink(); |
| 256 } | 250 } |
| 257 | 251 |
| 258 ScopedVector<AudioDecoder> audio_decoders; | 252 ScopedVector<AudioDecoder> audio_decoders; |
| 259 | 253 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 DCHECK(clockless_playback_); | 314 DCHECK(clockless_playback_); |
| 321 return clockless_audio_sink_->render_time(); | 315 return clockless_audio_sink_->render_time(); |
| 322 } | 316 } |
| 323 | 317 |
| 324 base::TimeTicks DummyTickClock::NowTicks() { | 318 base::TimeTicks DummyTickClock::NowTicks() { |
| 325 now_ += base::TimeDelta::FromSeconds(60); | 319 now_ += base::TimeDelta::FromSeconds(60); |
| 326 return now_; | 320 return now_; |
| 327 } | 321 } |
| 328 | 322 |
| 329 } // namespace media | 323 } // namespace media |
| OLD | NEW |