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