xref: /aosp_15_r20/external/webrtc/modules/audio_coding/audio_network_adaptor/config.proto (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1syntax = "proto2";
2
3package webrtc.audio_network_adaptor.config;
4
5option optimize_for = LITE_RUNTIME;
6option java_package = "org.webrtc.AudioNetworkAdaptor";
7option java_outer_classname = "Config";
8option objc_class_prefix = "WANA";
9
10message FecController {
11  message Threshold {
12    // Threshold defines a curve in the bandwidth/packet-loss domain. The
13    // curve is characterized by the two conjunction points: A and B.
14    //
15    // packet ^  |
16    //  loss  | A|
17    //        |   \        A: (low_bandwidth_bps, low_bandwidth_packet_loss)
18    //        |    \       B: (high_bandwidth_bps, high_bandwidth_packet_loss)
19    //        |    B\________
20    //        |---------------> bandwidth
21    optional int32 low_bandwidth_bps = 1;
22    optional float low_bandwidth_packet_loss = 2;
23    optional int32 high_bandwidth_bps = 3;
24    optional float high_bandwidth_packet_loss = 4;
25  }
26
27  // `fec_enabling_threshold` defines a curve, above which FEC should be
28  // enabled. `fec_disabling_threshold` defines a curve, under which FEC
29  // should be disabled. See below
30  //
31  // packet-loss ^   |  |
32  //             |   |  |   FEC
33  //             |    \  \   ON
34  //             | FEC \  \_______ fec_enabling_threshold
35  //             | OFF  \_________ fec_disabling_threshold
36  //             |-----------------> bandwidth
37  optional Threshold fec_enabling_threshold = 1;
38  optional Threshold fec_disabling_threshold = 2;
39
40  // `time_constant_ms` is the time constant for an exponential filter, which
41  // is used for smoothing the packet loss fraction.
42  optional int32 time_constant_ms = 3;
43}
44
45message FecControllerRplrBased {
46  message Threshold {
47    // Threshold defines a curve in the bandwidth/recoverable-packet-loss
48    // domain.
49    // The curve is characterized by the two conjunction points: A and B.
50    //
51    // recoverable ^
52    // packet      |  |
53    //  loss       | A|
54    //             |   \        A: (low_bandwidth_bps,
55    //             |    \           low_bandwidth_recoverable_packet_loss)
56    //             |     \       B: (high_bandwidth_bps,
57    //             |      \          high_bandwidth_recoverable_packet_loss)
58    //             |      B\________
59    //             |---------------> bandwidth
60    optional int32 low_bandwidth_bps = 1;
61    optional float low_bandwidth_recoverable_packet_loss = 2;
62    optional int32 high_bandwidth_bps = 3;
63    optional float high_bandwidth_recoverable_packet_loss = 4;
64  }
65
66  // `fec_enabling_threshold` defines a curve, above which FEC should be
67  // enabled. `fec_disabling_threshold` defines a curve, under which FEC
68  // should be disabled. See below
69  //
70  // packet-loss ^   |  |
71  //             |   |  |   FEC
72  //             |    \  \   ON
73  //             | FEC \  \_______ fec_enabling_threshold
74  //             | OFF  \_________ fec_disabling_threshold
75  //             |-----------------> bandwidth
76  optional Threshold fec_enabling_threshold = 1;
77  optional Threshold fec_disabling_threshold = 2;
78}
79
80message FrameLengthController {
81  // Uplink packet loss fraction below which frame length can increase.
82  optional float fl_increasing_packet_loss_fraction = 1;
83
84  // Uplink packet loss fraction above which frame length should decrease.
85  optional float fl_decreasing_packet_loss_fraction = 2;
86
87  // Uplink bandwidth below which frame length can switch from 20ms to 60ms.
88  optional int32 fl_20ms_to_60ms_bandwidth_bps = 3;
89
90  // Uplink bandwidth above which frame length should switch from 60ms to 20ms.
91  optional int32 fl_60ms_to_20ms_bandwidth_bps = 4;
92
93  // Uplink bandwidth below which frame length can switch from 60ms to 120ms.
94  optional int32 fl_60ms_to_120ms_bandwidth_bps = 5;
95
96  // Uplink bandwidth above which frame length should switch from 120ms to 60ms.
97  optional int32 fl_120ms_to_60ms_bandwidth_bps = 6;
98
99  // Offset to apply to the per-packet overhead when increasing frame length.
100  optional int32 fl_increase_overhead_offset = 7;
101
102  // Offset to apply to the per-packet overhead when decreasing frame length.
103  optional int32 fl_decrease_overhead_offset = 8;
104
105  // Uplink bandwidth below which frame length can switch from 20ms to 40ms. In
106  // current implementation, defining this will invalidate
107  // fl_20ms_to_60ms_bandwidth_bps.
108  optional int32 fl_20ms_to_40ms_bandwidth_bps = 9;
109
110  // Uplink bandwidth above which frame length should switch from 40ms to 20ms.
111  optional int32 fl_40ms_to_20ms_bandwidth_bps = 10;
112
113  // Uplink bandwidth below which frame length can switch from 40ms to 60ms.
114  optional int32 fl_40ms_to_60ms_bandwidth_bps = 11;
115
116  // Uplink bandwidth above which frame length should switch from 60ms to 40ms.
117  // In current implementation, defining this will invalidate
118  // fl_60ms_to_20ms_bandwidth_bps.
119  optional int32 fl_60ms_to_40ms_bandwidth_bps = 12;
120}
121
122message FrameLengthControllerV2 {
123  // FrameLengthControllerV2 chooses the frame length by taking the target
124  // bitrate and subtracting the overhead bitrate to obtain the remaining
125  // bitrate for the payload. The chosen frame length is the shortest possible
126  // where the payload bitrate is more than `min_payload_bitrate_bps`.
127  optional int32 min_payload_bitrate_bps = 1;
128
129  // If true, uses the stable target bitrate to decide the frame length. This
130  // will result in less frame length toggling but spending more time at longer
131  // frame lengths compared to using the normal target bitrate.
132  optional bool use_slow_adaptation = 2;
133}
134
135message ChannelController {
136  // Uplink bandwidth above which the number of encoded channels should switch
137  // from 1 to 2.
138  optional int32 channel_1_to_2_bandwidth_bps = 1;
139
140  // Uplink bandwidth below which the number of encoded channels should switch
141  // from 2 to 1.
142  optional int32 channel_2_to_1_bandwidth_bps = 2;
143}
144
145message DtxController {
146  // Uplink bandwidth below which DTX should be switched on.
147  optional int32 dtx_enabling_bandwidth_bps = 1;
148
149  // Uplink bandwidth above which DTX should be switched off.
150  optional int32 dtx_disabling_bandwidth_bps = 2;
151}
152
153message BitrateController {
154  // Offset to apply to per-packet overhead when the frame length is increased.
155  optional int32 fl_increase_overhead_offset = 1;
156  // Offset to apply to per-packet overhead when the frame length is decreased.
157  optional int32 fl_decrease_overhead_offset = 2;
158}
159
160message Controller {
161  message ScoringPoint {
162    // `ScoringPoint` is a subspace of network condition. It is used for
163    // comparing the significance of controllers.
164    optional int32 uplink_bandwidth_bps = 1;
165    optional float uplink_packet_loss_fraction = 2;
166  }
167
168  // The distance from `scoring_point` to a given network condition defines
169  // the significance of this controller with respect that network condition.
170  // Shorter distance means higher significance. The significances of
171  // controllers determine their order in the processing pipeline. Controllers
172  // without `scoring_point` follow their default order in
173  // `ControllerManager::controllers`.
174  optional ScoringPoint scoring_point = 1;
175
176  oneof controller {
177    FecController fec_controller = 21;
178    FrameLengthController frame_length_controller = 22;
179    ChannelController channel_controller = 23;
180    DtxController dtx_controller = 24;
181    BitrateController bitrate_controller = 25;
182    FecControllerRplrBased fec_controller_rplr_based = 26;
183    FrameLengthControllerV2 frame_length_controller_v2 = 27;
184  }
185}
186
187message ControllerManager {
188  repeated Controller controllers = 1;
189
190  // Least time since last reordering for a new reordering to be made.
191  optional int32 min_reordering_time_ms = 2;
192
193  // Least squared distance from last scoring point for a new reordering to be
194  // made.
195  optional float min_reordering_squared_distance = 3;
196}
197