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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // on what platform we're on. | 54 // on what platform we're on. |
55 static base::FilePath GetLibPeerConnectionPath() { | 55 static base::FilePath GetLibPeerConnectionPath() { |
56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
57 base::FilePath path(FILE_PATH_LITERAL("libpeerconnection.dll")); | 57 base::FilePath path(FILE_PATH_LITERAL("libpeerconnection.dll")); |
58 #elif defined(OS_MACOSX) | 58 #elif defined(OS_MACOSX) |
59 // Simulate '@loader_path/Libraries'. | 59 // Simulate '@loader_path/Libraries'. |
60 base::FilePath path; | 60 base::FilePath path; |
61 CHECK(PathService::Get(base::DIR_MODULE, &path)); | 61 CHECK(PathService::Get(base::DIR_MODULE, &path)); |
62 path = path.Append(FILE_PATH_LITERAL("Libraries")) | 62 path = path.Append(FILE_PATH_LITERAL("Libraries")) |
63 .Append(FILE_PATH_LITERAL("libpeerconnection.so")); | 63 .Append(FILE_PATH_LITERAL("libpeerconnection.so")); |
64 #elif defined(OS_ANDROID) | |
65 base::FilePath path; | |
66 CHECK(PathService::Get(base::DIR_MODULE, &path)); | |
67 path = path.Append(FILE_PATH_LITERAL("libpeerconnection.so")); | |
68 #else | 64 #else |
69 base::FilePath path; | 65 base::FilePath path; |
70 CHECK(PathService::Get(base::DIR_MODULE, &path)); | 66 CHECK(PathService::Get(base::DIR_MODULE, &path)); |
71 path = path.Append(FILE_PATH_LITERAL("lib")) | 67 path = path.Append(FILE_PATH_LITERAL("lib")) |
72 .Append(FILE_PATH_LITERAL("libpeerconnection.so")); | 68 .Append(FILE_PATH_LITERAL("libpeerconnection.so")); |
73 #endif | 69 #endif |
74 return path; | 70 return path; |
75 } | 71 } |
76 | 72 |
77 bool InitializeWebRtcModule() { | 73 bool InitializeWebRtcModule() { |
(...skipping 13 matching lines...) Expand all Loading... |
91 base::GetFunctionPointerFromNativeLibrary( | 87 base::GetFunctionPointerFromNativeLibrary( |
92 lib, "InitializeModule")); | 88 lib, "InitializeModule")); |
93 | 89 |
94 // Initialize the proxy by supplying it with a pointer to our | 90 // Initialize the proxy by supplying it with a pointer to our |
95 // allocator/deallocator routines. | 91 // allocator/deallocator routines. |
96 // On mac we use malloc zones, which are global, so we provide NULLs for | 92 // On mac we use malloc zones, which are global, so we provide NULLs for |
97 // the alloc/dealloc functions. | 93 // the alloc/dealloc functions. |
98 // PS: This function is actually implemented in allocator_proxy.cc with the | 94 // PS: This function is actually implemented in allocator_proxy.cc with the |
99 // new/delete overrides. | 95 // new/delete overrides. |
100 return initialize_module(*CommandLine::ForCurrentProcess(), | 96 return initialize_module(*CommandLine::ForCurrentProcess(), |
101 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 97 #if !defined(OS_MACOSX) |
102 &Allocate, &Dellocate, | 98 &Allocate, &Dellocate, |
103 #endif | 99 #endif |
104 logging::GetLogMessageHandler(), | 100 logging::GetLogMessageHandler(), |
105 &GetCategoryGroupEnabled, &AddTraceEvent, | 101 &GetCategoryGroupEnabled, &AddTraceEvent, |
106 &g_create_webrtc_media_engine, &g_destroy_webrtc_media_engine); | 102 &g_create_webrtc_media_engine, &g_destroy_webrtc_media_engine); |
107 } | 103 } |
108 | 104 |
109 cricket::MediaEngineInterface* CreateWebRtcMediaEngine( | 105 cricket::MediaEngineInterface* CreateWebRtcMediaEngine( |
110 webrtc::AudioDeviceModule* adm, | 106 webrtc::AudioDeviceModule* adm, |
111 webrtc::AudioDeviceModule* adm_sc, | 107 webrtc::AudioDeviceModule* adm_sc, |
112 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 108 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
113 cricket::WebRtcVideoDecoderFactory* decoder_factory) { | 109 cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
114 // For convenience of tests etc, we call InitializeWebRtcModule here. | 110 // For convenience of tests etc, we call InitializeWebRtcModule here. |
115 // For Chrome however, InitializeWebRtcModule must be called | 111 // For Chrome however, InitializeWebRtcModule must be called |
116 // explicitly before the sandbox is initialized. In that case, this call is | 112 // explicitly before the sandbox is initialized. In that case, this call is |
117 // effectively a noop. | 113 // effectively a noop. |
118 InitializeWebRtcModule(); | 114 InitializeWebRtcModule(); |
119 return g_create_webrtc_media_engine(adm, adm_sc, encoder_factory, | 115 return g_create_webrtc_media_engine(adm, adm_sc, encoder_factory, |
120 decoder_factory); | 116 decoder_factory); |
121 } | 117 } |
122 | 118 |
123 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) { | 119 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) { |
124 g_destroy_webrtc_media_engine(media_engine); | 120 g_destroy_webrtc_media_engine(media_engine); |
125 } | 121 } |
126 | 122 |
127 #endif // LIBPEERCONNECTION_LIB | 123 #endif // LIBPEERCONNECTION_LIB |
OLD | NEW |