| 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 "init_webrtc.h" |
| 10 #include "talk/media/webrtc/webrtcmediaengine.h" | 10 #include "talk/media/webrtc/webrtcmediaengine.h" |
| 11 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" | |
| 12 #include "webrtc/base/basictypes.h" | 11 #include "webrtc/base/basictypes.h" |
| 13 #include "webrtc/base/logging.h" | 12 #include "webrtc/base/logging.h" |
| 14 | 13 |
| 15 #if !defined(LIBPEERCONNECTION_IMPLEMENTATION) || defined(LIBPEERCONNECTION_LIB) | 14 #if !defined(LIBPEERCONNECTION_IMPLEMENTATION) || defined(LIBPEERCONNECTION_LIB) |
| 16 #error "Only compile the allocator proxy with the shared_library implementation" | 15 #error "Only compile the allocator proxy with the shared_library implementation" |
| 17 #endif | 16 #endif |
| 18 | 17 |
| 19 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 20 #define ALLOC_EXPORT __declspec(dllexport) | 19 #define ALLOC_EXPORT __declspec(dllexport) |
| 21 #else | 20 #else |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 AllocateFunction alloc, | 64 AllocateFunction alloc, |
| 66 DellocateFunction dealloc, | 65 DellocateFunction dealloc, |
| 67 #endif | 66 #endif |
| 68 FieldTrialFindFullName field_trial_find, | 67 FieldTrialFindFullName field_trial_find, |
| 69 logging::LogMessageHandlerFunction log_handler, | 68 logging::LogMessageHandlerFunction log_handler, |
| 70 webrtc::GetCategoryEnabledPtr trace_get_category_enabled, | 69 webrtc::GetCategoryEnabledPtr trace_get_category_enabled, |
| 71 webrtc::AddTraceEventPtr trace_add_trace_event, | 70 webrtc::AddTraceEventPtr trace_add_trace_event, |
| 72 CreateWebRtcMediaEngineFunction* create_media_engine, | 71 CreateWebRtcMediaEngineFunction* create_media_engine, |
| 73 DestroyWebRtcMediaEngineFunction* destroy_media_engine, | 72 DestroyWebRtcMediaEngineFunction* destroy_media_engine, |
| 74 InitDiagnosticLoggingDelegateFunctionFunction* | 73 InitDiagnosticLoggingDelegateFunctionFunction* |
| 75 init_diagnostic_logging, | 74 init_diagnostic_logging) { |
| 76 CreateWebRtcAudioProcessingFunction* | |
| 77 create_audio_processing) { | |
| 78 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 75 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 79 g_alloc = alloc; | 76 g_alloc = alloc; |
| 80 g_dealloc = dealloc; | 77 g_dealloc = dealloc; |
| 81 #endif | 78 #endif |
| 82 | 79 |
| 83 g_field_trial_find_ = field_trial_find; | 80 g_field_trial_find_ = field_trial_find; |
| 84 | 81 |
| 85 *create_media_engine = &CreateWebRtcMediaEngine; | 82 *create_media_engine = &CreateWebRtcMediaEngine; |
| 86 *destroy_media_engine = &DestroyWebRtcMediaEngine; | 83 *destroy_media_engine = &DestroyWebRtcMediaEngine; |
| 87 *init_diagnostic_logging = &rtc::InitDiagnosticLoggingDelegateFunction; | 84 *init_diagnostic_logging = &rtc::InitDiagnosticLoggingDelegateFunction; |
| 88 *create_audio_processing = &webrtc::AudioProcessing::Create; | |
| 89 | 85 |
| 90 if (CommandLine::Init(0, NULL)) { | 86 if (CommandLine::Init(0, NULL)) { |
| 91 #if !defined(OS_WIN) | 87 #if !defined(OS_WIN) |
| 92 // This is not needed on Windows since CommandLine::Init has already | 88 // This is not needed on Windows since CommandLine::Init has already |
| 93 // done the equivalent thing via the GetCommandLine() API. | 89 // done the equivalent thing via the GetCommandLine() API. |
| 94 CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); | 90 CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); |
| 95 #endif | 91 #endif |
| 96 logging::LoggingSettings settings; | 92 logging::LoggingSettings settings; |
| 97 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 93 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 98 logging::InitLogging(settings); | 94 logging::InitLogging(settings); |
| 99 | 95 |
| 100 // Override the log message handler to forward logs to chrome's handler. | 96 // Override the log message handler to forward logs to chrome's handler. |
| 101 logging::SetLogMessageHandler(log_handler); | 97 logging::SetLogMessageHandler(log_handler); |
| 102 webrtc::SetupEventTracer(trace_get_category_enabled, | 98 webrtc::SetupEventTracer(trace_get_category_enabled, |
| 103 trace_add_trace_event); | 99 trace_add_trace_event); |
| 104 } | 100 } |
| 105 | 101 |
| 106 return true; | 102 return true; |
| 107 } | 103 } |
| 108 } // extern "C" | 104 } // extern "C" |
| OLD | NEW |