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