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 "components/html_viewer/media_factory.h" | 5 #include "components/html_viewer/media_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 audio_manager_(media::AudioManager::Create(&fake_audio_log_factory_)), | 81 audio_manager_(media::AudioManager::Create(&fake_audio_log_factory_)), |
82 audio_hardware_config_( | 82 audio_hardware_config_( |
83 audio_manager_->GetInputStreamParameters( | 83 audio_manager_->GetInputStreamParameters( |
84 media::AudioManagerBase::kDefaultDeviceId), | 84 media::AudioManagerBase::kDefaultDeviceId), |
85 audio_manager_->GetDefaultOutputStreamParameters()), | 85 audio_manager_->GetDefaultOutputStreamParameters()), |
86 #endif | 86 #endif |
87 enable_mojo_media_renderer_(base::CommandLine::ForCurrentProcess() | 87 enable_mojo_media_renderer_(base::CommandLine::ForCurrentProcess() |
88 ->HasSwitch(kEnableMojoMediaRenderer)), | 88 ->HasSwitch(kEnableMojoMediaRenderer)), |
89 compositor_task_runner_(compositor_task_runner), | 89 compositor_task_runner_(compositor_task_runner), |
90 shell_(shell) { | 90 shell_(shell) { |
91 if (!media::IsMediaLibraryInitialized()) { | 91 media::InitializeMediaLibrary(); |
92 base::FilePath module_dir; | |
93 CHECK(PathService::Get(base::DIR_EXE, &module_dir)); | |
94 CHECK(media::InitializeMediaLibrary(module_dir)); | |
95 } | |
96 } | 92 } |
97 | 93 |
98 MediaFactory::~MediaFactory() { | 94 MediaFactory::~MediaFactory() { |
99 } | 95 } |
100 | 96 |
101 blink::WebMediaPlayer* MediaFactory::CreateMediaPlayer( | 97 blink::WebMediaPlayer* MediaFactory::CreateMediaPlayer( |
102 blink::WebLocalFrame* frame, | 98 blink::WebLocalFrame* frame, |
103 const blink::WebURL& url, | 99 const blink::WebURL& url, |
104 blink::WebMediaPlayerClient* client, | 100 blink::WebMediaPlayerClient* client, |
105 blink::WebContentDecryptionModule* initial_cdm, | 101 blink::WebContentDecryptionModule* initial_cdm, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 scoped_refptr<base::SingleThreadTaskRunner> | 182 scoped_refptr<base::SingleThreadTaskRunner> |
187 MediaFactory::GetMediaThreadTaskRunner() { | 183 MediaFactory::GetMediaThreadTaskRunner() { |
188 if (!media_thread_.IsRunning()) | 184 if (!media_thread_.IsRunning()) |
189 media_thread_.Start(); | 185 media_thread_.Start(); |
190 | 186 |
191 return media_thread_.task_runner(); | 187 return media_thread_.task_runner(); |
192 } | 188 } |
193 #endif // !defined(OS_ANDROID) | 189 #endif // !defined(OS_ANDROID) |
194 | 190 |
195 } // namespace html_viewer | 191 } // namespace html_viewer |
OLD | NEW |