| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 347 |
| 348 return std::move(renderer_impl); | 348 return std::move(renderer_impl); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void PipelineIntegrationTestBase::OnVideoFramePaint( | 351 void PipelineIntegrationTestBase::OnVideoFramePaint( |
| 352 const scoped_refptr<VideoFrame>& frame) { | 352 const scoped_refptr<VideoFrame>& frame) { |
| 353 last_video_frame_format_ = frame->format(); | 353 last_video_frame_format_ = frame->format(); |
| 354 int result; | 354 int result; |
| 355 if (frame->metadata()->GetInteger(VideoFrameMetadata::COLOR_SPACE, &result)) | 355 if (frame->metadata()->GetInteger(VideoFrameMetadata::COLOR_SPACE, &result)) |
| 356 last_video_frame_color_space_ = static_cast<ColorSpace>(result); | 356 last_video_frame_color_space_ = static_cast<ColorSpace>(result); |
| 357 if (!hashing_enabled_) | 357 if (!hashing_enabled_ || last_frame_ == frame) |
| 358 return; | 358 return; |
| 359 last_frame_ = frame; |
| 359 VideoFrame::HashFrameForTesting(&md5_context_, frame); | 360 VideoFrame::HashFrameForTesting(&md5_context_, frame); |
| 360 } | 361 } |
| 361 | 362 |
| 362 std::string PipelineIntegrationTestBase::GetVideoHash() { | 363 std::string PipelineIntegrationTestBase::GetVideoHash() { |
| 363 DCHECK(hashing_enabled_); | 364 DCHECK(hashing_enabled_); |
| 364 base::MD5Digest digest; | 365 base::MD5Digest digest; |
| 365 base::MD5Final(&digest, &md5_context_); | 366 base::MD5Final(&digest, &md5_context_); |
| 366 return base::MD5DigestToBase16(digest); | 367 return base::MD5DigestToBase16(digest); |
| 367 } | 368 } |
| 368 | 369 |
| 369 std::string PipelineIntegrationTestBase::GetAudioHash() { | 370 std::string PipelineIntegrationTestBase::GetAudioHash() { |
| 370 DCHECK(hashing_enabled_); | 371 DCHECK(hashing_enabled_); |
| 371 | 372 |
| 372 if (clockless_playback_) | 373 if (clockless_playback_) |
| 373 return clockless_audio_sink_->GetAudioHashForTesting(); | 374 return clockless_audio_sink_->GetAudioHashForTesting(); |
| 374 return audio_sink_->GetAudioHashForTesting(); | 375 return audio_sink_->GetAudioHashForTesting(); |
| 375 } | 376 } |
| 376 | 377 |
| 377 base::TimeDelta PipelineIntegrationTestBase::GetAudioTime() { | 378 base::TimeDelta PipelineIntegrationTestBase::GetAudioTime() { |
| 378 DCHECK(clockless_playback_); | 379 DCHECK(clockless_playback_); |
| 379 return clockless_audio_sink_->render_time(); | 380 return clockless_audio_sink_->render_time(); |
| 380 } | 381 } |
| 381 | 382 |
| 382 base::TimeTicks DummyTickClock::NowTicks() { | 383 base::TimeTicks DummyTickClock::NowTicks() { |
| 383 now_ += base::TimeDelta::FromSeconds(60); | 384 now_ += base::TimeDelta::FromSeconds(60); |
| 384 return now_; | 385 return now_; |
| 385 } | 386 } |
| 386 | 387 |
| 387 } // namespace media | 388 } // namespace media |
| OLD | NEW |