minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 1 | syntax = "proto2"; |
Jakob Ivarsson | f46902c | 2020-06-18 13:48:39 | [diff] [blame] | 2 | |
| 3 | package webrtc.audio_network_adaptor.config; |
| 4 | |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 5 | option optimize_for = LITE_RUNTIME; |
minyue | 1354901 | 2016-12-12 22:06:19 | [diff] [blame] | 6 | option java_package = "org.webrtc.AudioNetworkAdaptor"; |
| 7 | option java_outer_classname = "Config"; |
Mirko Bonadei | 405ac4e | 2022-01-28 10:49:11 | [diff] [blame] | 8 | option objc_class_prefix = "WANA"; |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 9 | |
| 10 | message 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 | |
Artem Titov | d00ce74 | 2021-07-28 18:00:17 | [diff] [blame] | 27 | // `fec_enabling_threshold` defines a curve, above which FEC should be |
| 28 | // enabled. `fec_disabling_threshold` defines a curve, under which FEC |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 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 | |
Artem Titov | d00ce74 | 2021-07-28 18:00:17 | [diff] [blame] | 40 | // `time_constant_ms` is the time constant for an exponential filter, which |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 41 | // is used for smoothing the packet loss fraction. |
| 42 | optional int32 time_constant_ms = 3; |
| 43 | } |
| 44 | |
elad.alon | 2877048 | 2017-03-28 12:03:55 | [diff] [blame] | 45 | message 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 | |
Artem Titov | d00ce74 | 2021-07-28 18:00:17 | [diff] [blame] | 66 | // `fec_enabling_threshold` defines a curve, above which FEC should be |
| 67 | // enabled. `fec_disabling_threshold` defines a curve, under which FEC |
elad.alon | 2877048 | 2017-03-28 12:03:55 | [diff] [blame] | 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 | |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 80 | message FrameLengthController { |
| 81 | // Uplink packet loss fraction below which frame length can increase. |
| 82 | optional float fl_increasing_packet_loss_fraction = 1; |
| 83 | |
michaelt | 6f08d7d | 2017-02-22 15:35:05 | [diff] [blame] | 84 | // Uplink packet loss fraction above which frame length should decrease. |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 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; |
michaelt | a55f021 | 2017-02-02 15:47:19 | [diff] [blame] | 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; |
ivoc | 7e9c614 | 2017-09-28 08:11:16 | [diff] [blame] | 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; |
Ying Wang | 0e1a558 | 2019-08-16 14:45:30 | [diff] [blame] | 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; |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 120 | } |
| 121 | |
Jakob Ivarsson | f46902c | 2020-06-18 13:48:39 | [diff] [blame] | 122 | message 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 |
Artem Titov | d00ce74 | 2021-07-28 18:00:17 | [diff] [blame] | 126 | // where the payload bitrate is more than `min_payload_bitrate_bps`. |
Jakob Ivarsson | f46902c | 2020-06-18 13:48:39 | [diff] [blame] | 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 | |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 135 | message 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 | |
| 145 | message 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 | |
ivoc | 7e9c614 | 2017-09-28 08:11:16 | [diff] [blame] | 153 | message 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 | } |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 159 | |
| 160 | message Controller { |
| 161 | message ScoringPoint { |
Artem Titov | d00ce74 | 2021-07-28 18:00:17 | [diff] [blame] | 162 | // `ScoringPoint` is a subspace of network condition. It is used for |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 163 | // comparing the significance of controllers. |
| 164 | optional int32 uplink_bandwidth_bps = 1; |
| 165 | optional float uplink_packet_loss_fraction = 2; |
| 166 | } |
| 167 | |
Artem Titov | d00ce74 | 2021-07-28 18:00:17 | [diff] [blame] | 168 | // The distance from `scoring_point` to a given network condition defines |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 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 |
Artem Titov | d00ce74 | 2021-07-28 18:00:17 | [diff] [blame] | 172 | // without `scoring_point` follow their default order in |
Artem Titov | cfea218 | 2021-08-09 23:22:31 | [diff] [blame] | 173 | // `ControllerManager::controllers`. |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 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; |
elad.alon | 2877048 | 2017-03-28 12:03:55 | [diff] [blame] | 182 | FecControllerRplrBased fec_controller_rplr_based = 26; |
Jakob Ivarsson | f46902c | 2020-06-18 13:48:39 | [diff] [blame] | 183 | FrameLengthControllerV2 frame_length_controller_v2 = 27; |
minyue | a1d9ad0 | 2016-10-02 21:53:37 | [diff] [blame] | 184 | } |
| 185 | } |
| 186 | |
| 187 | message 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; |
Mirko Bonadei | b14fad4 | 2017-06-28 09:17:24 | [diff] [blame] | 196 | } |