Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: media/test/pipeline_integration_test_base.cc

Issue 1116473002: Introduce NullVideoSink for test classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/test/pipeline_integration_test_base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 17 matching lines...) Expand all
28 using ::testing::AtMost; 28 using ::testing::AtMost;
29 using ::testing::Invoke; 29 using ::testing::Invoke;
30 using ::testing::InvokeWithoutArgs; 30 using ::testing::InvokeWithoutArgs;
31 using ::testing::SaveArg; 31 using ::testing::SaveArg;
32 32
33 namespace media { 33 namespace media {
34 34
35 const char kNullVideoHash[] = "d41d8cd98f00b204e9800998ecf8427e"; 35 const char kNullVideoHash[] = "d41d8cd98f00b204e9800998ecf8427e";
36 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,";
37 37
38 MockVideoRendererSink::MockVideoRendererSink() {}
39 MockVideoRendererSink::~MockVideoRendererSink() {}
40
41 PipelineIntegrationTestBase::PipelineIntegrationTestBase() 38 PipelineIntegrationTestBase::PipelineIntegrationTestBase()
42 : hashing_enabled_(false), 39 : hashing_enabled_(false),
43 clockless_playback_(false), 40 clockless_playback_(false),
44 pipeline_( 41 pipeline_(
45 new Pipeline(message_loop_.message_loop_proxy(), new MediaLog())), 42 new Pipeline(message_loop_.message_loop_proxy(), new MediaLog())),
46 ended_(false), 43 ended_(false),
47 pipeline_status_(PIPELINE_OK), 44 pipeline_status_(PIPELINE_OK),
48 last_video_frame_format_(VideoFrame::UNKNOWN), 45 last_video_frame_format_(VideoFrame::UNKNOWN),
49 hardware_config_(AudioParameters(), AudioParameters()) { 46 hardware_config_(AudioParameters(), AudioParameters()) {
50 base::MD5Init(&md5_context_); 47 base::MD5Init(&md5_context_);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 #if !defined(MEDIA_DISABLE_LIBVPX) 230 #if !defined(MEDIA_DISABLE_LIBVPX)
234 video_decoders.push_back( 231 video_decoders.push_back(
235 new VpxVideoDecoder(message_loop_.message_loop_proxy())); 232 new VpxVideoDecoder(message_loop_.message_loop_proxy()));
236 #endif // !defined(MEDIA_DISABLE_LIBVPX) 233 #endif // !defined(MEDIA_DISABLE_LIBVPX)
237 234
238 #if !defined(MEDIA_DISABLE_FFMPEG) 235 #if !defined(MEDIA_DISABLE_FFMPEG)
239 video_decoders.push_back( 236 video_decoders.push_back(
240 new FFmpegVideoDecoder(message_loop_.message_loop_proxy())); 237 new FFmpegVideoDecoder(message_loop_.message_loop_proxy()));
241 #endif 238 #endif
242 239
243 EXPECT_CALL(video_sink_, PaintFrameUsingOldRenderingPath(_)) 240 // Simulate a 60Hz rendering sink.
244 .WillRepeatedly( 241 video_sink_.reset(new NullVideoSink(
245 Invoke(this, &PipelineIntegrationTestBase::OnVideoFramePaint)); 242 clockless_playback_, base::TimeDelta::FromSecondsD(1.0 / 60),
243 base::Bind(&PipelineIntegrationTestBase::OnVideoFramePaint,
244 base::Unretained(this)),
245 message_loop_.task_runner()));
246 246
247 // Disable frame dropping if hashing is enabled. 247 // Disable frame dropping if hashing is enabled.
248 scoped_ptr<VideoRenderer> video_renderer( 248 scoped_ptr<VideoRenderer> video_renderer(new VideoRendererImpl(
249 new VideoRendererImpl(message_loop_.message_loop_proxy(), &video_sink_, 249 message_loop_.message_loop_proxy(), video_sink_.get(),
250 video_decoders.Pass(), false, new MediaLog())); 250 video_decoders.Pass(), false, new MediaLog()));
251 251
252 if (!clockless_playback_) { 252 if (!clockless_playback_) {
253 audio_sink_ = new NullAudioSink(message_loop_.message_loop_proxy()); 253 audio_sink_ = new NullAudioSink(message_loop_.message_loop_proxy());
254 } else { 254 } else {
255 clockless_audio_sink_ = new ClocklessAudioSink(); 255 clockless_audio_sink_ = new ClocklessAudioSink();
256 } 256 }
257 257
258 ScopedVector<AudioDecoder> audio_decoders; 258 ScopedVector<AudioDecoder> audio_decoders;
259 259
260 #if !defined(MEDIA_DISABLE_FFMPEG) 260 #if !defined(MEDIA_DISABLE_FFMPEG)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 DCHECK(clockless_playback_); 320 DCHECK(clockless_playback_);
321 return clockless_audio_sink_->render_time(); 321 return clockless_audio_sink_->render_time();
322 } 322 }
323 323
324 base::TimeTicks DummyTickClock::NowTicks() { 324 base::TimeTicks DummyTickClock::NowTicks() {
325 now_ += base::TimeDelta::FromSeconds(60); 325 now_ += base::TimeDelta::FromSeconds(60);
326 return now_; 326 return now_;
327 } 327 }
328 328
329 } // namespace media 329 } // namespace media
OLDNEW
« no previous file with comments | « media/test/pipeline_integration_test_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698