Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: third_party/libjingle/overrides/init_webrtc.cc

Issue 272503004: Wire up chrome field trials with webrtc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update to use webrtc::field_trial namespace. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/metrics/field_trial.h"
11 #include "base/native_library.h" 12 #include "base/native_library.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "talk/base/basictypes.h" 14 #include "talk/base/basictypes.h"
14 #include "third_party/libjingle/overrides/talk/base/logging.h" 15 #include "third_party/libjingle/overrides/talk/base/logging.h"
15 16
16 const unsigned char* GetCategoryGroupEnabled(const char* category_group) { 17 const unsigned char* GetCategoryGroupEnabled(const char* category_group) {
17 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); 18 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group);
18 } 19 }
19 20
20 void AddTraceEvent(char phase, 21 void AddTraceEvent(char phase,
(...skipping 11 matching lines...) Expand all
32 } 33 }
33 34
34 #if defined(LIBPEERCONNECTION_LIB) 35 #if defined(LIBPEERCONNECTION_LIB)
35 36
36 // libpeerconnection is being compiled as a static lib. In this case 37 // libpeerconnection is being compiled as a static lib. In this case
37 // we don't need to do any initializing but to keep things simple we 38 // we don't need to do any initializing but to keep things simple we
38 // provide an empty intialization routine so that this #ifdef doesn't 39 // provide an empty intialization routine so that this #ifdef doesn't
39 // have to be in other places. 40 // have to be in other places.
40 bool InitializeWebRtcModule() { 41 bool InitializeWebRtcModule() {
41 webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent); 42 webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent);
43 webrtc::field_trial::Init(&base::FieldTrialList::FindFullName);
42 return true; 44 return true;
43 } 45 }
44 46
45 #else // !LIBPEERCONNECTION_LIB 47 #else // !LIBPEERCONNECTION_LIB
46 48
47 // When being compiled as a shared library, we need to bridge the gap between 49 // When being compiled as a shared library, we need to bridge the gap between
48 // the current module and the libpeerconnection module, so things get a tad 50 // the current module and the libpeerconnection module, so things get a tad
49 // more complicated. 51 // more complicated.
50 52
51 // Global function pointers to the factory functions in the shared library. 53 // Global function pointers to the factory functions in the shared library.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 110
109 // Initialize the proxy by supplying it with a pointer to our 111 // Initialize the proxy by supplying it with a pointer to our
110 // allocator/deallocator routines. 112 // allocator/deallocator routines.
111 // On mac we use malloc zones, which are global, so we provide NULLs for 113 // On mac we use malloc zones, which are global, so we provide NULLs for
112 // the alloc/dealloc functions. 114 // the alloc/dealloc functions.
113 // PS: This function is actually implemented in allocator_proxy.cc with the 115 // PS: This function is actually implemented in allocator_proxy.cc with the
114 // new/delete overrides. 116 // new/delete overrides.
115 InitDiagnosticLoggingDelegateFunctionFunction init_diagnostic_logging = NULL; 117 InitDiagnosticLoggingDelegateFunctionFunction init_diagnostic_logging = NULL;
116 bool init_ok = initialize_module(*CommandLine::ForCurrentProcess(), 118 bool init_ok = initialize_module(*CommandLine::ForCurrentProcess(),
117 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) 119 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
118 &Allocate, &Dellocate, 120 &Allocate,
121 &Dellocate,
119 #endif 122 #endif
120 logging::GetLogMessageHandler(), 123 logging::GetLogMessageHandler(),
121 &GetCategoryGroupEnabled, &AddTraceEvent, 124 &GetCategoryGroupEnabled,
122 &g_create_webrtc_media_engine, &g_destroy_webrtc_media_engine, 125 &AddTraceEvent,
123 &init_diagnostic_logging); 126 &base::FieldTrialList::FindFullName,
127 &g_create_webrtc_media_engine,
128 &g_destroy_webrtc_media_engine,
129 &init_diagnostic_logging);
124 130
125 if (init_ok) 131 if (init_ok)
126 talk_base::SetExtraLoggingInit(init_diagnostic_logging); 132 talk_base::SetExtraLoggingInit(init_diagnostic_logging);
127 return init_ok; 133 return init_ok;
128 } 134 }
129 135
130 cricket::MediaEngineInterface* CreateWebRtcMediaEngine( 136 cricket::MediaEngineInterface* CreateWebRtcMediaEngine(
131 webrtc::AudioDeviceModule* adm, 137 webrtc::AudioDeviceModule* adm,
132 webrtc::AudioDeviceModule* adm_sc, 138 webrtc::AudioDeviceModule* adm_sc,
133 cricket::WebRtcVideoEncoderFactory* encoder_factory, 139 cricket::WebRtcVideoEncoderFactory* encoder_factory,
134 cricket::WebRtcVideoDecoderFactory* decoder_factory) { 140 cricket::WebRtcVideoDecoderFactory* decoder_factory) {
135 // For convenience of tests etc, we call InitializeWebRtcModule here. 141 // For convenience of tests etc, we call InitializeWebRtcModule here.
136 // For Chrome however, InitializeWebRtcModule must be called 142 // For Chrome however, InitializeWebRtcModule must be called
137 // explicitly before the sandbox is initialized. In that case, this call is 143 // explicitly before the sandbox is initialized. In that case, this call is
138 // effectively a noop. 144 // effectively a noop.
139 InitializeWebRtcModule(); 145 InitializeWebRtcModule();
140 return g_create_webrtc_media_engine(adm, adm_sc, encoder_factory, 146 return g_create_webrtc_media_engine(adm, adm_sc, encoder_factory,
141 decoder_factory); 147 decoder_factory);
142 } 148 }
143 149
144 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) { 150 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) {
145 g_destroy_webrtc_media_engine(media_engine); 151 g_destroy_webrtc_media_engine(media_engine);
146 } 152 }
147 153
148 #endif // LIBPEERCONNECTION_LIB 154 #endif // LIBPEERCONNECTION_LIB
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698