| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "init_webrtc.h" | 5 #include "init_webrtc.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/native_library.h" | 10 #include "base/native_library.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 bool InitializeWebRtcModule() { | 74 bool InitializeWebRtcModule() { |
| 75 TRACE_EVENT0("webrtc", "InitializeWebRtcModule"); | 75 TRACE_EVENT0("webrtc", "InitializeWebRtcModule"); |
| 76 | 76 |
| 77 if (g_create_webrtc_media_engine) | 77 if (g_create_webrtc_media_engine) |
| 78 return true; // InitializeWebRtcModule has already been called. | 78 return true; // InitializeWebRtcModule has already been called. |
| 79 | 79 |
| 80 base::FilePath path(GetLibPeerConnectionPath()); | 80 base::FilePath path(GetLibPeerConnectionPath()); |
| 81 DVLOG(1) << "Loading WebRTC module: " << path.value(); | 81 DVLOG(1) << "Loading WebRTC module: " << path.value(); |
| 82 | 82 |
| 83 std::string error; | 83 base::NativeLibraryLoadError error = 0; |
| 84 static base::NativeLibrary lib = | 84 static base::NativeLibrary lib = base::LoadNativeLibrary(path, &error); |
| 85 base::LoadNativeLibrary(path, &error); | |
| 86 CHECK(lib) << error; | 85 CHECK(lib) << error; |
| 87 | 86 |
| 88 InitializeModuleFunction initialize_module = | 87 InitializeModuleFunction initialize_module = |
| 89 reinterpret_cast<InitializeModuleFunction>( | 88 reinterpret_cast<InitializeModuleFunction>( |
| 90 base::GetFunctionPointerFromNativeLibrary( | 89 base::GetFunctionPointerFromNativeLibrary( |
| 91 lib, "InitializeModule")); | 90 lib, "InitializeModule")); |
| 92 | 91 |
| 93 // Initialize the proxy by supplying it with a pointer to our | 92 // Initialize the proxy by supplying it with a pointer to our |
| 94 // allocator/deallocator routines. | 93 // allocator/deallocator routines. |
| 95 // On mac we use malloc zones, which are global, so we provide NULLs for | 94 // On mac we use malloc zones, which are global, so we provide NULLs for |
| (...skipping 27 matching lines...) Expand all Loading... |
| 123 InitializeWebRtcModule(); | 122 InitializeWebRtcModule(); |
| 124 return g_create_webrtc_media_engine(adm, adm_sc, encoder_factory, | 123 return g_create_webrtc_media_engine(adm, adm_sc, encoder_factory, |
| 125 decoder_factory); | 124 decoder_factory); |
| 126 } | 125 } |
| 127 | 126 |
| 128 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) { | 127 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) { |
| 129 g_destroy_webrtc_media_engine(media_engine); | 128 g_destroy_webrtc_media_engine(media_engine); |
| 130 } | 129 } |
| 131 | 130 |
| 132 #endif // LIBPEERCONNECTION_LIB | 131 #endif // LIBPEERCONNECTION_LIB |
| OLD | NEW |