WebRTC provides some means to alter its default behavior during run-time, colloquially known as field trials. This is foremost used for A/B testing new features and are related to Chromium field trials to facilitate interoperability.
A field trial consist of a key-value pair of strings. By convention, the field trial key is prefixed with WebRTC-
and each word is capitalized without spaces. Sometimes the key is further subdivided into a category, for example, WebRTC-MyCategory-MyExperiment
. The field trial value is an opaque string and it is up to the author to define what it represents. There are helper functions to use a field trial as a boolean, with the string Enabled
representing true and Disabled
representing false. You can also use field trial parameters if you wish to encode more elaborate data types.
The set of field trials can be instantiated from a single string with the format <key-1>/<value-1>/<key-2>/<value-2>/
. Note the final /
at the end! In Chromium you can launch with the --force-fieldtrials
flag to instantiate field trials this way, for example:
--force-fieldtrials="WebRTC-Foo/Enabled/WebRTC-Bar/Disabled/"
The policy for field trials is: