Index: chrome/service/service_process.cc |
diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc |
index f490fb50c82f5f63a0a6bae23f81eb428f736b82..c46bb97f92bd930baf465c4f357a357f862bb4c6 100644 |
--- a/chrome/service/service_process.cc |
+++ b/chrome/service/service_process.cc |
@@ -27,6 +27,7 @@ |
#include "chrome/service/service_process_prefs.h" |
#include "grit/chromium_strings.h" |
#include "grit/generated_resources.h" |
+#include "media/base/media.h" |
#include "net/base/network_change_notifier.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/resource/resource_bundle.h" |
@@ -34,6 +35,9 @@ |
#if defined(ENABLE_REMOTING) |
#include "chrome/service/remoting/chromoting_host_manager.h" |
+#if defined(OS_MACOSX) |
+#include "base/mac/mac_util.h" |
+#endif // defined(OS_MACOSX) |
#endif // defined(ENABLED_REMOTING) |
ServiceProcess* g_service_process = NULL; |
@@ -160,11 +164,25 @@ bool ServiceProcess::Initialize(MessageLoop* message_loop, |
PrepareRestartOnCrashEnviroment(command_line); |
#if defined(ENABLE_REMOTING) |
+ // Load media codecs, required by the Chromoting host |
+ bool initialized_media_library = false; |
+#if defined(OS_MACOSX) |
+ FilePath bundle_path = base::mac::MainAppBundlePath(); |
+ |
+ initialized_media_library = |
+ media::InitializeMediaLibrary(bundle_path.Append("Libraries")); |
+#else |
+ FilePath module_path; |
+ initialized_media_library = |
+ PathService::Get(base::DIR_MODULE, &module_path) && |
+ media::InitializeMediaLibrary(module_path); |
+#endif |
+ |
// Initialize chromoting host manager. |
remoting_host_manager_ = new remoting::ChromotingHostManager(this); |
remoting_host_manager_->Initialize(message_loop, |
file_thread_->message_loop_proxy()); |
-#endif |
+#endif // ENABLE_REMOTING |
// Enable Cloud Print if needed. First check the command-line. |
bool cloud_print_proxy_enabled = |
@@ -224,8 +242,10 @@ void ServiceProcess::Shutdown() { |
#if defined(ENABLE_REMOTING) |
// During shutdown of remoting host it has some left over operations on |
// the UI thread. So we let the teardown to proceed asynchronously |
- remoting_host_manager_->Teardown( |
- NewRunnableFunction(&QuitMessageLoop, main_message_loop_)); |
+ if (remoting_host_manager_.get()) { |
+ remoting_host_manager_->Teardown( |
+ NewRunnableFunction(&QuitMessageLoop, main_message_loop_)); |
+ } |
#else |
// Quit the main message loop. |
main_message_loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |