OLD | NEW |
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/renderer_config.h" | 5 #include "media/mojo/services/renderer_config.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "media/audio/audio_manager_base.h" | 9 #include "media/audio/audio_manager_base.h" |
10 #include "media/audio/audio_output_stream_sink.h" | 10 #include "media/audio/audio_output_stream_sink.h" |
11 #include "media/audio/fake_audio_log_factory.h" | 11 #include "media/audio/fake_audio_log_factory.h" |
12 #include "media/base/media.h" | 12 #include "media/base/media.h" |
13 #include "media/filters/ffmpeg_audio_decoder.h" | 13 #include "media/filters/ffmpeg_audio_decoder.h" |
14 #include "media/filters/opus_audio_decoder.h" | 14 #include "media/filters/opus_audio_decoder.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 class DefaultRendererConfig : public PlatformRendererConfig { | 19 class DefaultRendererConfig : public PlatformRendererConfig { |
20 public: | 20 public: |
21 DefaultRendererConfig() { | 21 DefaultRendererConfig() { |
| 22 // TODO(dalecurtis): This will not work if the process is sandboxed... |
22 if (!media::IsMediaLibraryInitialized()) { | 23 if (!media::IsMediaLibraryInitialized()) { |
23 base::FilePath module_dir; | 24 base::FilePath module_dir; |
24 CHECK(PathService::Get(base::DIR_EXE, &module_dir)); | 25 CHECK(PathService::Get(base::DIR_EXE, &module_dir)); |
25 CHECK(media::InitializeMediaLibrary(module_dir)); | 26 CHECK(media::InitializeMediaLibrary(module_dir)); |
26 } | 27 } |
27 | 28 |
| 29 // TODO(dalecurtis): We should find a single owner per process for the audio |
| 30 // manager or make it a lazy instance. It's not safe to call Get()/Create() |
| 31 // across multiple threads... |
| 32 // |
| 33 // TODO(dalecurtis): Eventually we'll want something other than a fake audio |
| 34 // log factory here too. We should probably at least DVLOG() such info. |
28 AudioManager* audio_manager = AudioManager::Get(); | 35 AudioManager* audio_manager = AudioManager::Get(); |
29 if (!audio_manager) | 36 if (!audio_manager) |
30 audio_manager = media::AudioManager::Create(&fake_audio_log_factory_); | 37 audio_manager = media::AudioManager::Create(&fake_audio_log_factory_); |
31 | 38 |
32 audio_hardware_config_.reset(new AudioHardwareConfig( | 39 audio_hardware_config_.reset(new AudioHardwareConfig( |
33 audio_manager->GetInputStreamParameters( | 40 audio_manager->GetInputStreamParameters( |
34 AudioManagerBase::kDefaultDeviceId), | 41 AudioManagerBase::kDefaultDeviceId), |
35 audio_manager->GetDefaultOutputStreamParameters())); | 42 audio_manager->GetDefaultOutputStreamParameters())); |
36 } | 43 } |
37 | 44 |
(...skipping 25 matching lines...) Expand all Loading... |
63 | 70 |
64 DISALLOW_COPY_AND_ASSIGN(DefaultRendererConfig); | 71 DISALLOW_COPY_AND_ASSIGN(DefaultRendererConfig); |
65 }; | 72 }; |
66 | 73 |
67 scoped_ptr<PlatformRendererConfig> CreatePlatformRendererConfig() { | 74 scoped_ptr<PlatformRendererConfig> CreatePlatformRendererConfig() { |
68 return make_scoped_ptr(new DefaultRendererConfig()); | 75 return make_scoped_ptr(new DefaultRendererConfig()); |
69 } | 76 } |
70 | 77 |
71 } // namespace internal | 78 } // namespace internal |
72 } // namespace media | 79 } // namespace media |
OLD | NEW |