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

@ -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