| 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> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 9 #include "media/base/cdm_context.h" | 11 #include "media/base/cdm_context.h" |
| 10 #include "media/base/media_log.h" | 12 #include "media/base/media_log.h" |
| 11 #include "media/base/test_data_util.h" | 13 #include "media/base/test_data_util.h" |
| 12 #include "media/filters/chunk_demuxer.h" | 14 #include "media/filters/chunk_demuxer.h" |
| 13 #if !defined(MEDIA_DISABLE_FFMPEG) | 15 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 14 #include "media/filters/ffmpeg_audio_decoder.h" | 16 #include "media/filters/ffmpeg_audio_decoder.h" |
| 15 #include "media/filters/ffmpeg_demuxer.h" | 17 #include "media/filters/ffmpeg_demuxer.h" |
| 16 #include "media/filters/ffmpeg_video_decoder.h" | 18 #include "media/filters/ffmpeg_video_decoder.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // Simulate a 60Hz rendering sink. | 262 // Simulate a 60Hz rendering sink. |
| 261 video_sink_.reset(new NullVideoSink( | 263 video_sink_.reset(new NullVideoSink( |
| 262 clockless_playback_, base::TimeDelta::FromSecondsD(1.0 / 60), | 264 clockless_playback_, base::TimeDelta::FromSecondsD(1.0 / 60), |
| 263 base::Bind(&PipelineIntegrationTestBase::OnVideoFramePaint, | 265 base::Bind(&PipelineIntegrationTestBase::OnVideoFramePaint, |
| 264 base::Unretained(this)), | 266 base::Unretained(this)), |
| 265 message_loop_.task_runner())); | 267 message_loop_.task_runner())); |
| 266 | 268 |
| 267 // Disable frame dropping if hashing is enabled. | 269 // Disable frame dropping if hashing is enabled. |
| 268 scoped_ptr<VideoRenderer> video_renderer(new VideoRendererImpl( | 270 scoped_ptr<VideoRenderer> video_renderer(new VideoRendererImpl( |
| 269 message_loop_.task_runner(), message_loop_.task_runner().get(), | 271 message_loop_.task_runner(), message_loop_.task_runner().get(), |
| 270 video_sink_.get(), video_decoders.Pass(), false, nullptr, | 272 video_sink_.get(), std::move(video_decoders), false, nullptr, |
| 271 new MediaLog())); | 273 new MediaLog())); |
| 272 | 274 |
| 273 if (!clockless_playback_) { | 275 if (!clockless_playback_) { |
| 274 audio_sink_ = new NullAudioSink(message_loop_.task_runner()); | 276 audio_sink_ = new NullAudioSink(message_loop_.task_runner()); |
| 275 } else { | 277 } else { |
| 276 clockless_audio_sink_ = new ClocklessAudioSink(); | 278 clockless_audio_sink_ = new ClocklessAudioSink(); |
| 277 } | 279 } |
| 278 | 280 |
| 279 ScopedVector<AudioDecoder> audio_decoders; | 281 ScopedVector<AudioDecoder> audio_decoders; |
| 280 | 282 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 294 16, | 296 16, |
| 295 512); | 297 512); |
| 296 hardware_config_.UpdateOutputConfig(out_params); | 298 hardware_config_.UpdateOutputConfig(out_params); |
| 297 } | 299 } |
| 298 | 300 |
| 299 scoped_ptr<AudioRenderer> audio_renderer(new AudioRendererImpl( | 301 scoped_ptr<AudioRenderer> audio_renderer(new AudioRendererImpl( |
| 300 message_loop_.task_runner(), | 302 message_loop_.task_runner(), |
| 301 (clockless_playback_) | 303 (clockless_playback_) |
| 302 ? static_cast<AudioRendererSink*>(clockless_audio_sink_.get()) | 304 ? static_cast<AudioRendererSink*>(clockless_audio_sink_.get()) |
| 303 : audio_sink_.get(), | 305 : audio_sink_.get(), |
| 304 audio_decoders.Pass(), hardware_config_, new MediaLog())); | 306 std::move(audio_decoders), hardware_config_, new MediaLog())); |
| 305 if (hashing_enabled_) { | 307 if (hashing_enabled_) { |
| 306 if (clockless_playback_) | 308 if (clockless_playback_) |
| 307 clockless_audio_sink_->StartAudioHashForTesting(); | 309 clockless_audio_sink_->StartAudioHashForTesting(); |
| 308 else | 310 else |
| 309 audio_sink_->StartAudioHashForTesting(); | 311 audio_sink_->StartAudioHashForTesting(); |
| 310 } | 312 } |
| 311 | 313 |
| 312 scoped_ptr<RendererImpl> renderer_impl( | 314 scoped_ptr<RendererImpl> renderer_impl( |
| 313 new RendererImpl(message_loop_.task_runner(), | 315 new RendererImpl(message_loop_.task_runner(), std::move(audio_renderer), |
| 314 audio_renderer.Pass(), | 316 std::move(video_renderer))); |
| 315 video_renderer.Pass())); | |
| 316 | 317 |
| 317 // Prevent non-deterministic buffering state callbacks from firing (e.g., slow | 318 // Prevent non-deterministic buffering state callbacks from firing (e.g., slow |
| 318 // machine, valgrind). | 319 // machine, valgrind). |
| 319 renderer_impl->DisableUnderflowForTesting(); | 320 renderer_impl->DisableUnderflowForTesting(); |
| 320 | 321 |
| 321 if (clockless_playback_) | 322 if (clockless_playback_) |
| 322 renderer_impl->EnableClocklessVideoPlaybackForTesting(); | 323 renderer_impl->EnableClocklessVideoPlaybackForTesting(); |
| 323 | 324 |
| 324 return renderer_impl.Pass(); | 325 return std::move(renderer_impl); |
| 325 } | 326 } |
| 326 | 327 |
| 327 void PipelineIntegrationTestBase::OnVideoFramePaint( | 328 void PipelineIntegrationTestBase::OnVideoFramePaint( |
| 328 const scoped_refptr<VideoFrame>& frame) { | 329 const scoped_refptr<VideoFrame>& frame) { |
| 329 last_video_frame_format_ = frame->format(); | 330 last_video_frame_format_ = frame->format(); |
| 330 int result; | 331 int result; |
| 331 if (frame->metadata()->GetInteger(VideoFrameMetadata::COLOR_SPACE, &result)) | 332 if (frame->metadata()->GetInteger(VideoFrameMetadata::COLOR_SPACE, &result)) |
| 332 last_video_frame_color_space_ = static_cast<ColorSpace>(result); | 333 last_video_frame_color_space_ = static_cast<ColorSpace>(result); |
| 333 if (!hashing_enabled_) | 334 if (!hashing_enabled_) |
| 334 return; | 335 return; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 354 DCHECK(clockless_playback_); | 355 DCHECK(clockless_playback_); |
| 355 return clockless_audio_sink_->render_time(); | 356 return clockless_audio_sink_->render_time(); |
| 356 } | 357 } |
| 357 | 358 |
| 358 base::TimeTicks DummyTickClock::NowTicks() { | 359 base::TimeTicks DummyTickClock::NowTicks() { |
| 359 now_ += base::TimeDelta::FromSeconds(60); | 360 now_ += base::TimeDelta::FromSeconds(60); |
| 360 return now_; | 361 return now_; |
| 361 } | 362 } |
| 362 | 363 |
| 363 } // namespace media | 364 } // namespace media |
| OLD | NEW |