| 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 "allocator_shim/allocator_stub.h" | 5 #include "allocator_shim/allocator_stub.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "init_webrtc.h" |
| 9 #include "talk/base/basictypes.h" | 10 #include "talk/base/basictypes.h" |
| 10 #include "talk/media/webrtc/webrtcmediaengine.h" | 11 #include "talk/media/webrtc/webrtcmediaengine.h" |
| 11 | 12 |
| 12 #if !defined(LIBPEERCONNECTION_IMPLEMENTATION) || defined(LIBPEERCONNECTION_LIB) | 13 #if !defined(LIBPEERCONNECTION_IMPLEMENTATION) || defined(LIBPEERCONNECTION_LIB) |
| 13 #error "Only compile the allocator proxy with the shared_library implementation" | 14 #error "Only compile the allocator proxy with the shared_library implementation" |
| 14 #endif | 15 #endif |
| 15 | 16 |
| 16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 17 #define ALLOC_EXPORT __declspec(dllexport) | 18 #define ALLOC_EXPORT __declspec(dllexport) |
| 18 #else | 19 #else |
| 19 #define ALLOC_EXPORT __attribute__((visibility("default"))) | 20 #define ALLOC_EXPORT __attribute__((visibility("default"))) |
| 20 #endif | 21 #endif |
| 21 | 22 |
| 22 typedef cricket::MediaEngineInterface* (*CreateWebRtcMediaEngineFunction)( | |
| 23 webrtc::AudioDeviceModule* adm, | |
| 24 webrtc::AudioDeviceModule* adm_sc, | |
| 25 cricket::WebRtcVideoDecoderFactory* decoder_factory); | |
| 26 typedef void (*DestroyWebRtcMediaEngineFunction)( | |
| 27 cricket::MediaEngineInterface* media_engine); | |
| 28 | |
| 29 #if !defined(OS_MACOSX) | 23 #if !defined(OS_MACOSX) |
| 30 // These are used by our new/delete overrides in | 24 // These are used by our new/delete overrides in |
| 31 // allocator_shim/allocator_proxy.cc | 25 // allocator_shim/allocator_proxy.cc |
| 32 AllocateFunction g_alloc = NULL; | 26 AllocateFunction g_alloc = NULL; |
| 33 DellocateFunction g_dealloc = NULL; | 27 DellocateFunction g_dealloc = NULL; |
| 34 #endif | 28 #endif |
| 35 | 29 |
| 36 // Forward declare of the libjingle internal factory and destroy methods for the | 30 // Forward declare of the libjingle internal factory and destroy methods for the |
| 37 // WebRTC media engine. | 31 // WebRTC media engine. |
| 38 cricket::MediaEngineInterface* CreateWebRtcMediaEngine( | 32 cricket::MediaEngineInterface* CreateWebRtcMediaEngine( |
| 39 webrtc::AudioDeviceModule* adm, webrtc::AudioDeviceModule* adm_sc, | 33 webrtc::AudioDeviceModule* adm, |
| 34 webrtc::AudioDeviceModule* adm_sc, |
| 35 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 40 cricket::WebRtcVideoDecoderFactory* decoder_factory); | 36 cricket::WebRtcVideoDecoderFactory* decoder_factory); |
| 41 | 37 |
| 42 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine); | 38 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine); |
| 43 | 39 |
| 44 extern "C" { | 40 extern "C" { |
| 45 | 41 |
| 46 // Initialize logging, set the forward allocator functions (not on mac), and | 42 // Initialize logging, set the forward allocator functions (not on mac), and |
| 47 // return pointers to libjingle's WebRTC factory methods. | 43 // return pointers to libjingle's WebRTC factory methods. |
| 48 // Called from init_webrtc.cc. | 44 // Called from init_webrtc.cc. |
| 49 ALLOC_EXPORT | 45 ALLOC_EXPORT |
| (...skipping 11 matching lines...) Expand all Loading... |
| 61 | 57 |
| 62 *create_media_engine = &CreateWebRtcMediaEngine; | 58 *create_media_engine = &CreateWebRtcMediaEngine; |
| 63 *destroy_media_engine = &DestroyWebRtcMediaEngine; | 59 *destroy_media_engine = &DestroyWebRtcMediaEngine; |
| 64 | 60 |
| 65 if (CommandLine::Init(0, NULL)) { | 61 if (CommandLine::Init(0, NULL)) { |
| 66 #if !defined(OS_WIN) | 62 #if !defined(OS_WIN) |
| 67 // This is not needed on Windows since CommandLine::Init has already | 63 // This is not needed on Windows since CommandLine::Init has already |
| 68 // done the equivalent thing via the GetCommandLine() API. | 64 // done the equivalent thing via the GetCommandLine() API. |
| 69 CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); | 65 CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); |
| 70 #endif | 66 #endif |
| 67 |
| 68 // TODO(tommi): Use SetLogMessageHandler. |
| 71 logging::InitLogging( | 69 logging::InitLogging( |
| 72 FILE_PATH_LITERAL("libpeerconnection.log"), | 70 FILE_PATH_LITERAL("libpeerconnection.log"), |
| 73 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, | 71 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, |
| 74 logging::LOCK_LOG_FILE, | 72 logging::LOCK_LOG_FILE, |
| 75 logging::APPEND_TO_OLD_LOG_FILE, | 73 logging::APPEND_TO_OLD_LOG_FILE, |
| 76 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 74 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); |
| 77 } | 75 } |
| 78 | 76 |
| 79 return true; | 77 return true; |
| 80 } | 78 } |
| 81 } // extern "C" | 79 } // extern "C" |
| OLD | NEW |