summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandresp@webrtc.org <andresp@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-05-14 12:24:04 +0000
committerandresp@webrtc.org <andresp@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-05-14 12:24:04 +0000
commit0b8a1c4ea54e6ad9597f6e3fe382d5facbc147cb (patch)
treef60808a32a06afcb7f61de3815b1113028f282a3
parentc4e54b6b46c22c03725c9d39612fd50792d018ef (diff)
downloadwebrtc-0b8a1c4ea54e6ad9597f6e3fe382d5facbc147cb.tar.gz
Add webrtc field trials API.
From now on it is expected that code linking system_wrappers.gyp:system_wrappers provides an implementation for field_trial API or links with the default one in system_wrappers.gyp:field_trial_default. Note: Since there is no use of webrtc::field_trial API inside webrtc this CL on itself does not forces the clients to actually define it. It however lays the API and updates the gyp rules to link with so that it is ready to use. Tested: Introduced a use of field trial in system wrappers and make sure all bots were building successfully. BUG=crbug/367114 R=tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/14489004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@6147 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r--modules/audio_coding/main/acm2/audio_coding_module.gypi2
-rw-r--r--modules/audio_coding/neteq4/neteq_tests.gypi1
-rw-r--r--modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi2
-rw-r--r--modules/video_coding/codecs/tools/video_codecs_tools.gypi1
-rw-r--r--modules/video_coding/main/source/video_coding_test.gypi1
-rw-r--r--system_wrappers/interface/field_trial.h71
-rw-r--r--system_wrappers/source/field_trial_default.cc22
-rw-r--r--system_wrappers/source/system_wrappers.gyp10
-rw-r--r--test/test.gyp12
-rw-r--r--tools/tools.gyp2
-rw-r--r--video_engine/test/auto_test/vie_auto_test.gypi1
-rw-r--r--voice_engine/voice_engine.gyp2
-rw-r--r--webrtc_examples.gyp1
-rw-r--r--webrtc_tests.gypi5
14 files changed, 131 insertions, 2 deletions
diff --git a/modules/audio_coding/main/acm2/audio_coding_module.gypi b/modules/audio_coding/main/acm2/audio_coding_module.gypi
index 07fe7272..459313bb 100644
--- a/modules/audio_coding/main/acm2/audio_coding_module.gypi
+++ b/modules/audio_coding/main/acm2/audio_coding_module.gypi
@@ -124,6 +124,7 @@
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(webrtc_root)/test/test.gyp:test_support',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
],
'sources': [
@@ -141,6 +142,7 @@
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(webrtc_root)/test/test.gyp:test_support',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
],
'sources': [
diff --git a/modules/audio_coding/neteq4/neteq_tests.gypi b/modules/audio_coding/neteq4/neteq_tests.gypi
index d19c6b22..2be47379 100644
--- a/modules/audio_coding/neteq4/neteq_tests.gypi
+++ b/modules/audio_coding/neteq4/neteq_tests.gypi
@@ -88,6 +88,7 @@
'neteq_unittest_tools',
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
],
'sources': [
'tools/rtp_analyze.cc',
diff --git a/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi b/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi
index 7292caea..c2f1b3da 100644
--- a/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi
+++ b/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi
@@ -45,6 +45,7 @@
],
'dependencies': [
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'bwe_tools_util',
'rtp_rtcp',
],
@@ -67,6 +68,7 @@
],
'dependencies': [
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'bwe_tools_util',
'rtp_rtcp',
],
diff --git a/modules/video_coding/codecs/tools/video_codecs_tools.gypi b/modules/video_coding/codecs/tools/video_codecs_tools.gypi
index cdae0afe..8f15b285 100644
--- a/modules/video_coding/codecs/tools/video_codecs_tools.gypi
+++ b/modules/video_coding/codecs/tools/video_codecs_tools.gypi
@@ -17,6 +17,7 @@
'video_codecs_test_framework',
'webrtc_video_coding',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'<(webrtc_root)/test/metrics.gyp:metrics',
'<(webrtc_vp8_dir)/vp8.gyp:webrtc_vp8',
],
diff --git a/modules/video_coding/main/source/video_coding_test.gypi b/modules/video_coding/main/source/video_coding_test.gypi
index a64e02d0..b0fe510c 100644
--- a/modules/video_coding/main/source/video_coding_test.gypi
+++ b/modules/video_coding/main/source/video_coding_test.gypi
@@ -20,6 +20,7 @@
'<(webrtc_root)/test/test.gyp:test_support',
'<(webrtc_root)/test/metrics.gyp:metrics',
'<(webrtc_root)/common_video/common_video.gyp:common_video',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
],
'sources': [
# headers
diff --git a/system_wrappers/interface/field_trial.h b/system_wrappers/interface/field_trial.h
new file mode 100644
index 00000000..d38df26c
--- /dev/null
+++ b/system_wrappers/interface/field_trial.h
@@ -0,0 +1,71 @@
+//
+// Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+//
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file in the root of the source
+// tree. An additional intellectual property rights grant can be found
+// in the file PATENTS. All contributing project authors may
+// be found in the AUTHORS file in the root of the source tree.
+//
+
+#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_FIELD_TRIAL_H_
+#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_FIELD_TRIAL_H_
+
+#include <string>
+
+#include "webrtc/common_types.h"
+
+// Field trials allow webrtc clients (such as Chrome) to turn on feature code
+// in binaries out in the field and gather information with that.
+//
+// WebRTC clients MUST provide an implementation of:
+//
+// std::string webrtc::field_trial::FindFullName(const std::string& trial).
+//
+// Or link with a default one provided in:
+//
+// system_wrappers/source/system_wrappers.gyp:field_trial_default
+//
+//
+// They are designed to wire up directly to chrome field trials and to speed up
+// developers by reducing the need to wire APIs to control whether a feature is
+// on/off. E.g. to experiment with a new method that could lead to a different
+// trade-off between CPU/bandwidth:
+//
+// 1 - Develop the feature with default behaviour off:
+//
+// if (FieldTrial::FindFullName("WebRTCExperimenMethod2") == "Enabled")
+// method2();
+// else
+// method1();
+//
+// 2 - Once the changes are rolled to chrome, the new code path can be
+// controlled as normal chrome field trials.
+//
+// 3 - Evaluate the new feature and clean the code paths.
+//
+// Notes:
+// - NOT every feature is a candidate to be controlled by this mechanism as
+// it may require negotation between involved parties (e.g. SDP).
+//
+// TODO(andresp): since chrome --force-fieldtrials does not marks the trial
+// as active it does not gets propaged to renderer process. For now one
+// needs to push a config with start_active:true or run a local finch
+// server.
+//
+// TODO(andresp): support --force_fieldtirals from webrtc tests.
+// TODO(andresp): find out how to get bots to run tests with trials enabled.
+
+namespace webrtc {
+namespace field_trial {
+
+// Returns the group name chosen for the named trial, or the empty string
+// if the trial does not exists.
+//
+// Note: To keep things tidy append all the trial names with WebRTC.
+std::string FindFullName(const std::string& name);
+
+} // namespace field_trial
+} // namespace webrtc
+
+#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_FIELD_TRIAL_H_
diff --git a/system_wrappers/source/field_trial_default.cc b/system_wrappers/source/field_trial_default.cc
new file mode 100644
index 00000000..892623ce
--- /dev/null
+++ b/system_wrappers/source/field_trial_default.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+//
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file in the root of the source
+// tree. An additional intellectual property rights grant can be found
+// in the file PATENTS. All contributing project authors may
+// be found in the AUTHORS file in the root of the source tree.
+//
+
+#include "webrtc/system_wrappers/interface/field_trial.h"
+
+// Clients of webrtc that do not want to configure field trials can link with
+// this instead of providing their own implementation.
+namespace webrtc {
+namespace field_trial {
+
+std::string FindFullName(const std::string& name) {
+ return std::string();
+}
+
+} // namespace field_trial
+} // namespace webrtc
diff --git a/system_wrappers/source/system_wrappers.gyp b/system_wrappers/source/system_wrappers.gyp
index dba963ce..66b34356 100644
--- a/system_wrappers/source/system_wrappers.gyp
+++ b/system_wrappers/source/system_wrappers.gyp
@@ -38,6 +38,7 @@
'../interface/data_log_impl.h',
'../interface/event_tracer.h',
'../interface/event_wrapper.h',
+ '../interface/field_trial.h',
'../interface/file_wrapper.h',
'../interface/fix_interlocked_exchange_pointer_win.h',
'../interface/logcat_trace_context.h',
@@ -194,6 +195,15 @@
4267, # size_t to int truncation.
4334, # Ignore warning on shift operator promotion.
],
+ }, {
+ 'target_name': 'field_trial_default',
+ 'type': 'static_library',
+ 'sources': [
+ 'field_trial_default.cc',
+ ],
+ 'dependencies': [
+ 'system_wrappers',
+ ]
},
], # targets
'conditions': [
diff --git a/test/test.gyp b/test/test.gyp
index e920d6ea..5be3c106 100644
--- a/test/test.gyp
+++ b/test/test.gyp
@@ -64,6 +64,17 @@
],
},
{
+ 'target_name': 'test_main',
+ 'type': 'static_library',
+ 'sources': [
+ 'test_main.cc',
+ ],
+ 'dependencies': [
+ '<(DEPTH)/testing/gtest.gyp:gtest',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
+ ],
+ },
+ {
'target_name': 'test_support',
'type': 'static_library',
'dependencies': [
@@ -118,6 +129,7 @@
'type': 'static_library',
'dependencies': [
'test_support',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
],
'sources': [
'run_all_unittests.cc',
diff --git a/tools/tools.gyp b/tools/tools.gyp
index b8dc4c14..77238095 100644
--- a/tools/tools.gyp
+++ b/tools/tools.gyp
@@ -91,6 +91,7 @@
'type': 'executable',
'dependencies': [
'<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
],
'sources': [
'force_mic_volume_max/force_mic_volume_max.cc',
@@ -106,6 +107,7 @@
'dependencies': [
'<(webrtc_root)/test/test.gyp:channel_transport',
'<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
],
diff --git a/video_engine/test/auto_test/vie_auto_test.gypi b/video_engine/test/auto_test/vie_auto_test.gypi
index 7ceef0fa..fb611b00 100644
--- a/video_engine/test/auto_test/vie_auto_test.gypi
+++ b/video_engine/test/auto_test/vie_auto_test.gypi
@@ -13,6 +13,7 @@
'type': 'executable',
'dependencies': [
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'<(webrtc_root)/modules/modules.gyp:video_render_module',
'<(webrtc_root)/modules/modules.gyp:video_capture_module',
'<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine',
diff --git a/voice_engine/voice_engine.gyp b/voice_engine/voice_engine.gyp
index ead88199..a2de46df 100644
--- a/voice_engine/voice_engine.gyp
+++ b/voice_engine/voice_engine.gyp
@@ -146,6 +146,7 @@
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'<(webrtc_root)/test/test.gyp:channel_transport',
'<(webrtc_root)/test/test.gyp:test_support',
],
@@ -211,6 +212,7 @@
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'<(webrtc_root)/test/test.gyp:channel_transport',
'<(webrtc_root)/test/test.gyp:test_support',
],
diff --git a/webrtc_examples.gyp b/webrtc_examples.gyp
index e880c11d..56a0e9ef 100644
--- a/webrtc_examples.gyp
+++ b/webrtc_examples.gyp
@@ -16,6 +16,7 @@
'dependencies': [
'<(DEPTH)/third_party/icu/icu.gyp:icuuc',
'<(webrtc_root)/modules/modules.gyp:*',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'<(webrtc_root)/test/test.gyp:channel_transport',
'<(webrtc_root)/video_engine/video_engine.gyp:video_engine_core',
'<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine',
diff --git a/webrtc_tests.gypi b/webrtc_tests.gypi
index 384f57cc..31609670 100644
--- a/webrtc_tests.gypi
+++ b/webrtc_tests.gypi
@@ -26,6 +26,7 @@
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'test/webrtc_test_common.gyp:webrtc_test_common',
+ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default',
'webrtc',
],
},
@@ -39,13 +40,13 @@
'video/video_send_stream_tests.cc',
'test/common_unittest.cc',
'test/testsupport/metrics/video_metrics_unittest.cc',
- 'test/test_main.cc',
],
'dependencies': [
'<(DEPTH)/testing/gtest.gyp:gtest',
'modules/modules.gyp:rtp_rtcp',
'test/metrics.gyp:metrics',
'test/webrtc_test_common.gyp:webrtc_test_common',
+ 'test/test.gyp:test_main',
'webrtc',
],
},
@@ -54,7 +55,6 @@
'type': '<(gtest_target_type)',
'sources': [
'modules/audio_coding/neteq4/test/neteq_performance_unittest.cc',
- 'test/test_main.cc',
'video/call_perf_tests.cc',
'video/full_stack.cc',
'video/rampup_tests.cc',
@@ -64,6 +64,7 @@
'modules/modules.gyp:neteq_test_support', # Needed by neteq_performance_unittest.
'modules/modules.gyp:rtp_rtcp',
'test/webrtc_test_common.gyp:webrtc_test_common',
+ 'test/test.gyp:test_main',
'webrtc',
],
},