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

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

Issue 1942803002: Caching AudioOutputDevice instances in mixer manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make WebAudioSourceProvider to always return real sink info reguardless the client - to avoid behavior change. Created 4 years, 6 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 <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
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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 DCHECK(clockless_playback_); 378 DCHECK(clockless_playback_);
380 return clockless_audio_sink_->render_time(); 379 return clockless_audio_sink_->render_time();
381 } 380 }
382 381
383 base::TimeTicks DummyTickClock::NowTicks() { 382 base::TimeTicks DummyTickClock::NowTicks() {
384 now_ += base::TimeDelta::FromSeconds(60); 383 now_ += base::TimeDelta::FromSeconds(60);
385 return now_; 384 return now_;
386 } 385 }
387 386
388 } // namespace media 387 } // 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