Add support for field trials in peerconnection_client|server

Bug: webrtc:9935
Change-Id: Icb96123c5feb9dee309734d2a8ba88e23a467bef
Reviewed-on: https://webrtc-review.googlesource.com/c/108301
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25431}
This commit is contained in:
Bjorn Terelius
2018-10-29 15:26:27 +01:00
committed by Commit Bot
parent 9a0662ac7e
commit 3e67676fa6
6 changed files with 45 additions and 0 deletions

View File

@ -683,6 +683,8 @@ if (is_linux || is_win) {
"../rtc_base:checks",
"../rtc_base:stringutils",
"../rtc_base/third_party/sigslot",
"../system_wrappers:field_trial",
"../test:field_trial",
]
if (is_win) {
sources += [
@ -745,6 +747,8 @@ if (is_linux || is_win) {
"../rtc_base:rtc_base_approved",
"../rtc_base:stringutils",
"../rtc_tools:command_line_parser",
"../system_wrappers:field_trial",
"../test:field_trial",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).

View File

@ -8,5 +8,6 @@ include_rules = [
"+p2p",
"+pc",
"+sdk/objc",
"+system_wrappers/include",
"+third_party/libyuv",
]

View File

@ -35,4 +35,13 @@ WEBRTC_DEFINE_bool(
"the server without user intervention. Note: this flag should only be set "
"to true on one of the two clients.");
WEBRTC_DEFINE_string(
force_fieldtrials,
"",
"Field trials control experimental features. This flag specifies the field "
"trials in effect. E.g. running with "
"--force_fieldtrials=WebRTC-FooFeature/Enabled/ "
"will assign the group Enabled to field trial WebRTC-FooFeature. Multiple "
"trials are separated by \"/\"");
#endif // EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_

View File

@ -17,6 +17,8 @@
#include "rtc_base/ssladapter.h"
#include "rtc_base/thread.h"
#include "system_wrappers/include/field_trial.h"
#include "test/field_trial.h"
class CustomSocketServer : public rtc::PhysicalSocketServer {
public:
@ -75,6 +77,11 @@ int main(int argc, char* argv[]) {
return 0;
}
webrtc::test::ValidateFieldTrialsStringOrDie(FLAG_force_fieldtrials);
// InitFieldTrialsFromString stores the char*, so the char array must outlive
// the application.
webrtc::field_trial::InitFieldTrialsFromString(FLAG_force_fieldtrials);
// Abort if the user specifies a port that is outside the allowed
// range [1, 65535].
if ((FLAG_port < 1) || (FLAG_port > 65535)) {

View File

@ -16,6 +16,8 @@
#include "rtc_base/ssladapter.h"
#include "rtc_base/win32socketinit.h"
#include "rtc_base/win32socketserver.h"
#include "system_wrappers/include/field_trial.h"
#include "test/field_trial.h"
int PASCAL wWinMain(HINSTANCE instance,
HINSTANCE prev_instance,
@ -36,6 +38,11 @@ int PASCAL wWinMain(HINSTANCE instance,
return 0;
}
webrtc::test::ValidateFieldTrialsStringOrDie(FLAG_force_fieldtrials);
// InitFieldTrialsFromString stores the char*, so the char array must outlive
// the application.
webrtc::field_trial::InitFieldTrialsFromString(FLAG_force_fieldtrials);
// Abort if the user specifies a port that is outside the allowed
// range [1, 65535].
if ((FLAG_port < 1) || (FLAG_port > 65535)) {

View File

@ -18,7 +18,19 @@
#include "examples/peerconnection/server/data_socket.h"
#include "examples/peerconnection/server/peer_channel.h"
#include "examples/peerconnection/server/utils.h"
#include "rtc_base/flags.h"
#include "rtc_tools/simple_command_line_parser.h"
#include "system_wrappers/include/field_trial.h"
#include "test/field_trial.h"
WEBRTC_DEFINE_string(
force_fieldtrials,
"",
"Field trials control experimental features. This flag specifies the field "
"trials in effect. E.g. running with "
"--force_fieldtrials=WebRTC-FooFeature/Enabled/ "
"will assign the group Enabled to field trial WebRTC-FooFeature. Multiple "
"trials are separated by \"/\"");
static const size_t kMaxConnections = (FD_SETSIZE - 2);
@ -62,6 +74,11 @@ int main(int argc, char* argv[]) {
return 0;
}
webrtc::test::ValidateFieldTrialsStringOrDie(FLAG_force_fieldtrials);
// InitFieldTrialsFromString stores the char*, so the char array must outlive
// the application.
webrtc::field_trial::InitFieldTrialsFromString(FLAG_force_fieldtrials);
int port = strtol((parser.GetFlag("port")).c_str(), NULL, 10);
// Abort if the user specifies a port that is outside the allowed