xref: /aosp_15_r20/external/webrtc/g3doc/field-trials.md (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker# Field trials
2*d9f75844SAndroid Build Coastguard Worker
3*d9f75844SAndroid Build Coastguard Worker<?% config.freshness.owner = 'lndmrk' %?>
4*d9f75844SAndroid Build Coastguard Worker<?% config.freshness.reviewed = '2022-06-23' %?>
5*d9f75844SAndroid Build Coastguard Worker
6*d9f75844SAndroid Build Coastguard WorkerWebRTC provides some means to alter its default behavior during run-time,
7*d9f75844SAndroid Build Coastguard Workercolloquially known as *field trials*. This is foremost used for A/B testing new
8*d9f75844SAndroid Build Coastguard Workerfeatures and are related to
9*d9f75844SAndroid Build Coastguard Worker[Chromium field trials](https://chromium.googlesource.com/chromium/src/+/main/testing/variations/README.md)
10*d9f75844SAndroid Build Coastguard Workerto facilitate interoperability.
11*d9f75844SAndroid Build Coastguard Worker
12*d9f75844SAndroid Build Coastguard WorkerA field trial consist of a key-value pair of strings. By convention, the field
13*d9f75844SAndroid Build Coastguard Workertrial key is prefixed with `WebRTC-` and each word is capitalized without
14*d9f75844SAndroid Build Coastguard Workerspaces. Sometimes the key is further subdivided into a category, for example,
15*d9f75844SAndroid Build Coastguard Worker`WebRTC-MyCategory-MyExperiment`. The field trial value is an opaque string and
16*d9f75844SAndroid Build Coastguard Workerit is up to the author to define what it represents. There are
17*d9f75844SAndroid Build Coastguard Worker[helper functions](https://webrtc.googlesource.com/src/+/refs/heads/main/api/field_trials_view.h)
18*d9f75844SAndroid Build Coastguard Workerto use a field trial as a boolean, with the string `Enabled` representing true
19*d9f75844SAndroid Build Coastguard Workerand `Disabled` representing false. You can also use
20*d9f75844SAndroid Build Coastguard Worker[field trial parameters](https://webrtc.googlesource.com/src/+/refs/heads/main/rtc_base/experiments/field_trial_parser.h)
21*d9f75844SAndroid Build Coastguard Workerif you wish to encode more elaborate data types.
22*d9f75844SAndroid Build Coastguard Worker
23*d9f75844SAndroid Build Coastguard WorkerThe set of field trials can be instantiated from a single string with the format
24*d9f75844SAndroid Build Coastguard Worker`<key-1>/<value-1>/<key-2>/<value-2>/`. Note the final `/` at the end! In
25*d9f75844SAndroid Build Coastguard WorkerChromium you can launch with the `--force-fieldtrials` flag to instantiate field
26*d9f75844SAndroid Build Coastguard Workertrials this way, for example:
27*d9f75844SAndroid Build Coastguard Worker
28*d9f75844SAndroid Build Coastguard Worker```
29*d9f75844SAndroid Build Coastguard Worker--force-fieldtrials="WebRTC-Foo/Enabled/WebRTC-Bar/Disabled/"
30*d9f75844SAndroid Build Coastguard Worker```
31*d9f75844SAndroid Build Coastguard Worker
32*d9f75844SAndroid Build Coastguard Worker## Policy
33*d9f75844SAndroid Build Coastguard Worker
34*d9f75844SAndroid Build Coastguard WorkerThe policy for field trials is:
35*d9f75844SAndroid Build Coastguard Worker
36*d9f75844SAndroid Build Coastguard Worker-   A field trial should only be used to test out new code or parameters for a
37*d9f75844SAndroid Build Coastguard Worker    limited time period. It should not be used for configuring persistent
38*d9f75844SAndroid Build Coastguard Worker    behavior.
39*d9f75844SAndroid Build Coastguard Worker-   The field trial must have an end date. The end date may be pushed back if
40*d9f75844SAndroid Build Coastguard Worker    necessary, but should not be pushed back indefinitely.
41*d9f75844SAndroid Build Coastguard Worker-   A field trial must be associated with a bug that
42*d9f75844SAndroid Build Coastguard Worker    -   reserves the field trial key,
43*d9f75844SAndroid Build Coastguard Worker    -   is open,
44*d9f75844SAndroid Build Coastguard Worker    -   is assigned to an owner, and
45*d9f75844SAndroid Build Coastguard Worker    -   has the end date specified.
46