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

Side by Side Diff: media/mojo/services/test_mojo_media_client.cc

Issue 1806313003: Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/mojo/services/test_mojo_media_client.h" 5 #include "media/mojo/services/test_mojo_media_client.h"
6 6
7 #include "base/thread_task_runner_handle.h"
7 #include "media/audio/audio_manager_base.h" 8 #include "media/audio/audio_manager_base.h"
8 #include "media/audio/audio_output_stream_sink.h" 9 #include "media/audio/audio_output_stream_sink.h"
9 #include "media/base/audio_hardware_config.h" 10 #include "media/base/audio_hardware_config.h"
10 #include "media/base/media.h" 11 #include "media/base/media.h"
11 #include "media/base/null_video_sink.h" 12 #include "media/base/null_video_sink.h"
12 #include "media/cdm/default_cdm_factory.h" 13 #include "media/cdm/default_cdm_factory.h"
13 #include "media/renderers/default_renderer_factory.h" 14 #include "media/renderers/default_renderer_factory.h"
14 #include "media/renderers/gpu_video_accelerator_factories.h" 15 #include "media/renderers/gpu_video_accelerator_factories.h"
15 16
16 namespace media { 17 namespace media {
17 18
18 TestMojoMediaClient::TestMojoMediaClient() {} 19 TestMojoMediaClient::TestMojoMediaClient() {}
19 20
20 TestMojoMediaClient::~TestMojoMediaClient() {} 21 TestMojoMediaClient::~TestMojoMediaClient() {}
21 22
22 void TestMojoMediaClient::Initialize() { 23 void TestMojoMediaClient::Initialize() {
23 InitializeMediaLibrary(); 24 InitializeMediaLibrary();
24 // TODO(dalecurtis): We should find a single owner per process for the audio 25 // TODO(dalecurtis): We should find a single owner per process for the audio
25 // manager or make it a lazy instance. It's not safe to call Get()/Create() 26 // manager or make it a lazy instance. It's not safe to call Get()/Create()
26 // across multiple threads... 27 // across multiple threads...
27 //
28 // TODO(dalecurtis): Eventually we'll want something other than a fake audio
29 // log factory here too. We should probably at least DVLOG() such info.
30 AudioManager* audio_manager = AudioManager::Get(); 28 AudioManager* audio_manager = AudioManager::Get();
31 if (!audio_manager) 29 if (!audio_manager) {
32 audio_manager = media::AudioManager::Create(&fake_audio_log_factory_); 30 audio_manager_ = media::AudioManager::CreateForTesting(
31 base::ThreadTaskRunnerHandle::Get());
32 audio_manager = audio_manager_.get();
33 }
33 34
34 audio_hardware_config_.reset(new AudioHardwareConfig( 35 audio_hardware_config_.reset(new AudioHardwareConfig(
35 audio_manager->GetInputStreamParameters( 36 audio_manager->GetInputStreamParameters(
36 AudioManagerBase::kDefaultDeviceId), 37 AudioManagerBase::kDefaultDeviceId),
37 audio_manager->GetDefaultOutputStreamParameters())); 38 audio_manager->GetDefaultOutputStreamParameters()));
38 } 39 }
39 40
40 scoped_ptr<RendererFactory> TestMojoMediaClient::CreateRendererFactory( 41 scoped_ptr<RendererFactory> TestMojoMediaClient::CreateRendererFactory(
41 const scoped_refptr<MediaLog>& media_log) { 42 const scoped_refptr<MediaLog>& media_log) {
42 DVLOG(1) << __FUNCTION__; 43 DVLOG(1) << __FUNCTION__;
(...skipping 20 matching lines...) Expand all
63 return video_renderer_sink_.get(); 64 return video_renderer_sink_.get();
64 } 65 }
65 66
66 scoped_ptr<CdmFactory> TestMojoMediaClient::CreateCdmFactory( 67 scoped_ptr<CdmFactory> TestMojoMediaClient::CreateCdmFactory(
67 mojo::shell::mojom::InterfaceProvider* /* interface_provider */) { 68 mojo::shell::mojom::InterfaceProvider* /* interface_provider */) {
68 DVLOG(1) << __FUNCTION__; 69 DVLOG(1) << __FUNCTION__;
69 return make_scoped_ptr(new DefaultCdmFactory()); 70 return make_scoped_ptr(new DefaultCdmFactory());
70 } 71 }
71 72
72 } // namespace media 73 } // namespace media
OLDNEW
« media/audio/win/audio_output_win_unittest.cc ('K') | « media/mojo/services/test_mojo_media_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698