| 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 30 matching lines...) Expand all Loading... |
| 41 const char kNullVideoHash[] = "d41d8cd98f00b204e9800998ecf8427e"; | 41 const char kNullVideoHash[] = "d41d8cd98f00b204e9800998ecf8427e"; |
| 42 const char kNullAudioHash[] = "0.00,0.00,0.00,0.00,0.00,0.00,"; | 42 const char kNullAudioHash[] = "0.00,0.00,0.00,0.00,0.00,0.00,"; |
| 43 | 43 |
| 44 PipelineIntegrationTestBase::PipelineIntegrationTestBase() | 44 PipelineIntegrationTestBase::PipelineIntegrationTestBase() |
| 45 : hashing_enabled_(false), | 45 : hashing_enabled_(false), |
| 46 clockless_playback_(false), | 46 clockless_playback_(false), |
| 47 pipeline_(new PipelineImpl(message_loop_.task_runner(), new MediaLog())), | 47 pipeline_(new PipelineImpl(message_loop_.task_runner(), new MediaLog())), |
| 48 ended_(false), | 48 ended_(false), |
| 49 pipeline_status_(PIPELINE_OK), | 49 pipeline_status_(PIPELINE_OK), |
| 50 last_video_frame_format_(PIXEL_FORMAT_UNKNOWN), | 50 last_video_frame_format_(PIXEL_FORMAT_UNKNOWN), |
| 51 last_video_frame_color_space_(COLOR_SPACE_UNSPECIFIED), | 51 last_video_frame_color_space_(COLOR_SPACE_UNSPECIFIED) { |
| 52 hardware_config_(AudioParameters(), AudioParameters()) { | |
| 53 base::MD5Init(&md5_context_); | 52 base::MD5Init(&md5_context_); |
| 54 } | 53 } |
| 55 | 54 |
| 56 PipelineIntegrationTestBase::~PipelineIntegrationTestBase() { | 55 PipelineIntegrationTestBase::~PipelineIntegrationTestBase() { |
| 57 if (!pipeline_->IsRunning()) | 56 if (!pipeline_->IsRunning()) |
| 58 return; | 57 return; |
| 59 | 58 |
| 60 Stop(); | 59 Stop(); |
| 61 } | 60 } |
| 62 | 61 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 base::Bind(&PipelineIntegrationTestBase::OnVideoFramePaint, | 291 base::Bind(&PipelineIntegrationTestBase::OnVideoFramePaint, |
| 293 base::Unretained(this)), | 292 base::Unretained(this)), |
| 294 message_loop_.task_runner())); | 293 message_loop_.task_runner())); |
| 295 | 294 |
| 296 // Disable frame dropping if hashing is enabled. | 295 // Disable frame dropping if hashing is enabled. |
| 297 std::unique_ptr<VideoRenderer> video_renderer(new VideoRendererImpl( | 296 std::unique_ptr<VideoRenderer> video_renderer(new VideoRendererImpl( |
| 298 message_loop_.task_runner(), message_loop_.task_runner().get(), | 297 message_loop_.task_runner(), message_loop_.task_runner().get(), |
| 299 video_sink_.get(), std::move(video_decoders), false, nullptr, | 298 video_sink_.get(), std::move(video_decoders), false, nullptr, |
| 300 new MediaLog())); | 299 new MediaLog())); |
| 301 | 300 |
| 302 if (!clockless_playback_) { | |
| 303 audio_sink_ = new NullAudioSink(message_loop_.task_runner()); | |
| 304 } else { | |
| 305 clockless_audio_sink_ = new ClocklessAudioSink(); | |
| 306 } | |
| 307 | |
| 308 ScopedVector<AudioDecoder> audio_decoders; | 301 ScopedVector<AudioDecoder> audio_decoders; |
| 309 | 302 |
| 310 #if !defined(MEDIA_DISABLE_FFMPEG) | 303 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 311 audio_decoders.push_back( | 304 audio_decoders.push_back( |
| 312 new FFmpegAudioDecoder(message_loop_.task_runner(), new MediaLog())); | 305 new FFmpegAudioDecoder(message_loop_.task_runner(), new MediaLog())); |
| 313 #endif | 306 #endif |
| 314 | 307 |
| 315 audio_decoders.push_back(new OpusAudioDecoder(message_loop_.task_runner())); | 308 audio_decoders.push_back(new OpusAudioDecoder(message_loop_.task_runner())); |
| 316 | 309 |
| 317 // Don't allow the audio renderer to resample buffers if hashing is enabled. | 310 if (!clockless_playback_) { |
| 318 if (!hashing_enabled_) { | 311 audio_sink_ = new NullAudioSink(message_loop_.task_runner()); |
| 319 AudioParameters out_params(AudioParameters::AUDIO_PCM_LOW_LATENCY, | 312 } else { |
| 320 CHANNEL_LAYOUT_STEREO, 44100, 16, 512); | 313 clockless_audio_sink_ = new ClocklessAudioSink(OutputDeviceInfo( |
| 321 hardware_config_.UpdateOutputConfig(out_params); | 314 "", OUTPUT_DEVICE_STATUS_OK, |
| 315 // Don't allow the audio renderer to resample buffers if hashing is |
| 316 // enabled: |
| 317 hashing_enabled_ |
| 318 ? AudioParameters() |
| 319 : AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 320 CHANNEL_LAYOUT_STEREO, 44100, 16, 512))); |
| 322 } | 321 } |
| 323 | 322 |
| 324 std::unique_ptr<AudioRenderer> audio_renderer(new AudioRendererImpl( | 323 std::unique_ptr<AudioRenderer> audio_renderer(new AudioRendererImpl( |
| 325 message_loop_.task_runner(), | 324 message_loop_.task_runner(), |
| 326 (clockless_playback_) | 325 (clockless_playback_) |
| 327 ? static_cast<AudioRendererSink*>(clockless_audio_sink_.get()) | 326 ? static_cast<AudioRendererSink*>(clockless_audio_sink_.get()) |
| 328 : audio_sink_.get(), | 327 : audio_sink_.get(), |
| 329 std::move(audio_decoders), hardware_config_, new MediaLog())); | 328 std::move(audio_decoders), new MediaLog())); |
| 330 if (hashing_enabled_) { | 329 if (hashing_enabled_) { |
| 331 if (clockless_playback_) | 330 if (clockless_playback_) |
| 332 clockless_audio_sink_->StartAudioHashForTesting(); | 331 clockless_audio_sink_->StartAudioHashForTesting(); |
| 333 else | 332 else |
| 334 audio_sink_->StartAudioHashForTesting(); | 333 audio_sink_->StartAudioHashForTesting(); |
| 335 } | 334 } |
| 336 | 335 |
| 337 std::unique_ptr<RendererImpl> renderer_impl( | 336 std::unique_ptr<RendererImpl> renderer_impl( |
| 338 new RendererImpl(message_loop_.task_runner(), std::move(audio_renderer), | 337 new RendererImpl(message_loop_.task_runner(), std::move(audio_renderer), |
| 339 std::move(video_renderer))); | 338 std::move(video_renderer))); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 DCHECK(clockless_playback_); | 377 DCHECK(clockless_playback_); |
| 379 return clockless_audio_sink_->render_time(); | 378 return clockless_audio_sink_->render_time(); |
| 380 } | 379 } |
| 381 | 380 |
| 382 base::TimeTicks DummyTickClock::NowTicks() { | 381 base::TimeTicks DummyTickClock::NowTicks() { |
| 383 now_ += base::TimeDelta::FromSeconds(60); | 382 now_ += base::TimeDelta::FromSeconds(60); |
| 384 return now_; | 383 return now_; |
| 385 } | 384 } |
| 386 | 385 |
| 387 } // namespace media | 386 } // namespace media |
| OLD | NEW |