Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | #ifndef TEST_SCENARIO_SCENARIO_CONFIG_H_ |
| 11 | #define TEST_SCENARIO_SCENARIO_CONFIG_H_ |
| 12 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 13 | #include <stddef.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 14 | |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 15 | #include <string> |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 16 | |
| 17 | #include "absl/types/optional.h" |
Sebastian Jansson | cc5be54 | 2019-04-01 13:34:55 +0200 | [diff] [blame] | 18 | #include "api/fec_controller.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 19 | #include "api/rtp_parameters.h" |
Artem Titov | 33f9d2b | 2019-12-05 15:59:00 +0100 | [diff] [blame] | 20 | #include "api/test/frame_generator_interface.h" |
Sebastian Jansson | f0d0312 | 2018-12-18 15:53:04 +0100 | [diff] [blame] | 21 | #include "api/transport/network_control.h" |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 22 | #include "api/units/data_rate.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 23 | #include "api/units/data_size.h" |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 24 | #include "api/units/time_delta.h" |
Niels Möller | 0cc2fe5 | 2019-03-22 14:25:57 +0100 | [diff] [blame] | 25 | #include "api/video/video_codec_type.h" |
Sebastian Jansson | 7150d8c | 2019-04-09 14:18:09 +0200 | [diff] [blame] | 26 | #include "test/scenario/performance_stats.h" |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 27 | |
| 28 | namespace webrtc { |
| 29 | namespace test { |
| 30 | struct PacketOverhead { |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 31 | static constexpr size_t kSrtp = 10; |
Sebastian Jansson | 800e121 | 2018-10-22 11:49:03 +0200 | [diff] [blame] | 32 | static constexpr size_t kStun = 4; |
| 33 | // TURN messages can be sent either with or without an establieshed channel. |
| 34 | // In the latter case, a TURN Send/Data Indication is sent which has |
| 35 | // significantly more overhead. |
| 36 | static constexpr size_t kTurnChannelMessage = 4; |
| 37 | static constexpr size_t kTurnIndicationMessage = 36; |
Sebastian Jansson | c9f42ad | 2020-01-17 11:47:35 +0100 | [diff] [blame] | 38 | static constexpr size_t kDefault = kSrtp; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 39 | }; |
| 40 | struct TransportControllerConfig { |
| 41 | struct Rates { |
| 42 | Rates(); |
| 43 | Rates(const Rates&); |
| 44 | ~Rates(); |
Danil Chapovalov | cad3e0e | 2020-02-17 18:46:07 +0100 | [diff] [blame] | 45 | DataRate min_rate = DataRate::KilobitsPerSec(30); |
| 46 | DataRate max_rate = DataRate::KilobitsPerSec(3000); |
| 47 | DataRate start_rate = DataRate::KilobitsPerSec(300); |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 48 | } rates; |
Sebastian Jansson | f0d0312 | 2018-12-18 15:53:04 +0100 | [diff] [blame] | 49 | NetworkControllerFactoryInterface* cc_factory = nullptr; |
Danil Chapovalov | 0c626af | 2020-02-10 11:16:00 +0100 | [diff] [blame] | 50 | TimeDelta state_log_interval = TimeDelta::Millis(100); |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | struct CallClientConfig { |
| 54 | TransportControllerConfig transport; |
Erik Språng | 014dd3c | 2019-11-28 13:44:25 +0100 | [diff] [blame] | 55 | const WebRtcKeyValueConfig* field_trials = nullptr; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 56 | }; |
| 57 | |
Sebastian Jansson | 71a091e | 2018-09-27 19:08:21 +0200 | [diff] [blame] | 58 | struct PacketStreamConfig { |
| 59 | PacketStreamConfig(); |
| 60 | PacketStreamConfig(const PacketStreamConfig&); |
| 61 | ~PacketStreamConfig(); |
| 62 | int frame_rate = 30; |
| 63 | DataRate max_data_rate = DataRate::Infinity(); |
Danil Chapovalov | cad3e0e | 2020-02-17 18:46:07 +0100 | [diff] [blame] | 64 | DataSize max_packet_size = DataSize::Bytes(1400); |
| 65 | DataSize min_frame_size = DataSize::Bytes(100); |
Sebastian Jansson | 71a091e | 2018-09-27 19:08:21 +0200 | [diff] [blame] | 66 | double keyframe_multiplier = 1; |
Danil Chapovalov | cad3e0e | 2020-02-17 18:46:07 +0100 | [diff] [blame] | 67 | DataSize packet_overhead = DataSize::Bytes(PacketOverhead::kDefault); |
Sebastian Jansson | 71a091e | 2018-09-27 19:08:21 +0200 | [diff] [blame] | 68 | }; |
| 69 | |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 70 | struct VideoStreamConfig { |
| 71 | bool autostart = true; |
| 72 | struct Source { |
| 73 | enum Capture { |
| 74 | kGenerator, |
| 75 | kVideoFile, |
Sebastian Jansson | f2727fb | 2019-02-18 16:54:55 +0100 | [diff] [blame] | 76 | kGenerateSlides, |
| 77 | kImageSlides, |
| 78 | // Support for explicit frame triggers should be added here if needed. |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 79 | } capture = Capture::kGenerator; |
Sebastian Jansson | f2727fb | 2019-02-18 16:54:55 +0100 | [diff] [blame] | 80 | struct Slides { |
Danil Chapovalov | 0c626af | 2020-02-10 11:16:00 +0100 | [diff] [blame] | 81 | TimeDelta change_interval = TimeDelta::Seconds(10); |
Sebastian Jansson | f2727fb | 2019-02-18 16:54:55 +0100 | [diff] [blame] | 82 | struct Generator { |
| 83 | int width = 1600; |
| 84 | int height = 1200; |
| 85 | } generator; |
| 86 | struct Images { |
| 87 | struct Crop { |
Danil Chapovalov | 0c626af | 2020-02-10 11:16:00 +0100 | [diff] [blame] | 88 | TimeDelta scroll_duration = TimeDelta::Seconds(0); |
Sebastian Jansson | f2727fb | 2019-02-18 16:54:55 +0100 | [diff] [blame] | 89 | absl::optional<int> width; |
| 90 | absl::optional<int> height; |
| 91 | } crop; |
| 92 | int width = 1850; |
| 93 | int height = 1110; |
| 94 | std::vector<std::string> paths = { |
| 95 | "web_screenshot_1850_1110", |
| 96 | "presentation_1850_1110", |
| 97 | "photo_1850_1110", |
| 98 | "difficult_photo_1850_1110", |
| 99 | }; |
| 100 | } images; |
| 101 | } slides; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 102 | struct Generator { |
Artem Titov | 33f9d2b | 2019-12-05 15:59:00 +0100 | [diff] [blame] | 103 | using PixelFormat = FrameGeneratorInterface::OutputType; |
Sebastian Jansson | ed0febf | 2019-07-26 15:58:11 +0200 | [diff] [blame] | 104 | PixelFormat pixel_format = PixelFormat::kI420; |
Sebastian Jansson | f0c366b | 2019-02-14 13:18:42 +0100 | [diff] [blame] | 105 | int width = 320; |
| 106 | int height = 180; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 107 | } generator; |
| 108 | struct VideoFile { |
| 109 | std::string name; |
Sebastian Jansson | f0c366b | 2019-02-14 13:18:42 +0100 | [diff] [blame] | 110 | // Must be set to width and height of the source video file. |
| 111 | int width = 0; |
| 112 | int height = 0; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 113 | } video_file; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 114 | int framerate = 30; |
| 115 | } source; |
| 116 | struct Encoder { |
| 117 | Encoder(); |
| 118 | Encoder(const Encoder&); |
| 119 | ~Encoder(); |
Sebastian Jansson | f0c366b | 2019-02-14 13:18:42 +0100 | [diff] [blame] | 120 | enum class ContentType { |
| 121 | kVideo, |
| 122 | kScreen, |
| 123 | } content_type = ContentType::kVideo; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 124 | enum Implementation { kFake, kSoftware, kHardware } implementation = kFake; |
| 125 | struct Fake { |
| 126 | DataRate max_rate = DataRate::Infinity(); |
| 127 | } fake; |
| 128 | |
| 129 | using Codec = VideoCodecType; |
| 130 | Codec codec = Codec::kVideoCodecGeneric; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 131 | absl::optional<DataRate> max_data_rate; |
Sebastian Jansson | 0c32e33 | 2018-11-12 16:47:43 +0100 | [diff] [blame] | 132 | absl::optional<int> max_framerate; |
Sebastian Jansson | f0c366b | 2019-02-14 13:18:42 +0100 | [diff] [blame] | 133 | // Counted in frame count. |
| 134 | absl::optional<int> key_frame_interval = 3000; |
| 135 | bool frame_dropping = true; |
| 136 | struct SingleLayer { |
| 137 | bool denoising = true; |
| 138 | bool automatic_scaling = true; |
| 139 | } single; |
Sebastian Jansson | 06c5145 | 2019-02-18 16:55:15 +0100 | [diff] [blame] | 140 | struct Layers { |
| 141 | int temporal = 1; |
| 142 | int spatial = 1; |
| 143 | enum class Prediction { |
| 144 | kTemporalOnly, |
| 145 | kSpatialOnKey, |
| 146 | kFull, |
| 147 | } prediction = Prediction::kFull; |
| 148 | } layers; |
| 149 | |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 150 | DegradationPreference degradation_preference = |
| 151 | DegradationPreference::MAINTAIN_FRAMERATE; |
| 152 | } encoder; |
| 153 | struct Stream { |
| 154 | Stream(); |
| 155 | Stream(const Stream&); |
| 156 | ~Stream(); |
Sebastian Jansson | e112bb8 | 2019-06-13 17:36:01 +0200 | [diff] [blame] | 157 | bool abs_send_time = false; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 158 | bool packet_feedback = true; |
| 159 | bool use_rtx = true; |
Sebastian Jansson | 985ee68 | 2018-11-12 16:33:29 +0100 | [diff] [blame] | 160 | DataRate pad_to_rate = DataRate::Zero(); |
Danil Chapovalov | 0c626af | 2020-02-10 11:16:00 +0100 | [diff] [blame] | 161 | TimeDelta nack_history_time = TimeDelta::Millis(1000); |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 162 | bool use_flexfec = false; |
| 163 | bool use_ulpfec = false; |
Sebastian Jansson | cc5be54 | 2019-04-01 13:34:55 +0200 | [diff] [blame] | 164 | FecControllerFactoryInterface* fec_controller_factory = nullptr; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 165 | } stream; |
Sebastian Jansson | cc5be54 | 2019-04-01 13:34:55 +0200 | [diff] [blame] | 166 | struct Rendering { |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 167 | enum Type { kFake } type = kFake; |
Sebastian Jansson | cc5be54 | 2019-04-01 13:34:55 +0200 | [diff] [blame] | 168 | std::string sync_group; |
| 169 | } render; |
Sebastian Jansson | cf2df2f | 2019-04-02 11:51:28 +0200 | [diff] [blame] | 170 | struct Hooks { |
| 171 | std::vector<std::function<void(const VideoFramePair&)>> frame_pair_handlers; |
| 172 | } hooks; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 173 | }; |
| 174 | |
| 175 | struct AudioStreamConfig { |
| 176 | AudioStreamConfig(); |
| 177 | AudioStreamConfig(const AudioStreamConfig&); |
| 178 | ~AudioStreamConfig(); |
| 179 | bool autostart = true; |
| 180 | struct Source { |
| 181 | int channels = 1; |
| 182 | } source; |
Sebastian Jansson | b9972fa | 2018-10-17 16:27:55 +0200 | [diff] [blame] | 183 | bool network_adaptation = false; |
| 184 | struct NetworkAdaptation { |
| 185 | struct FrameLength { |
| 186 | double min_packet_loss_for_decrease = 0; |
| 187 | double max_packet_loss_for_increase = 1; |
| 188 | DataRate min_rate_for_20_ms = DataRate::Zero(); |
| 189 | DataRate max_rate_for_60_ms = DataRate::Infinity(); |
| 190 | DataRate min_rate_for_60_ms = DataRate::Zero(); |
| 191 | DataRate max_rate_for_120_ms = DataRate::Infinity(); |
| 192 | } frame; |
Sebastian Jansson | 7c1ac76 | 2020-02-27 12:04:20 +0100 | [diff] [blame^] | 193 | std::string binary_proto; |
Sebastian Jansson | b9972fa | 2018-10-17 16:27:55 +0200 | [diff] [blame] | 194 | } adapt; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 195 | struct Encoder { |
| 196 | Encoder(); |
| 197 | Encoder(const Encoder&); |
| 198 | ~Encoder(); |
| 199 | bool allocate_bitrate = false; |
Sebastian Jansson | ad87194 | 2019-01-16 17:21:28 +0100 | [diff] [blame] | 200 | bool enable_dtx = false; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 201 | absl::optional<DataRate> fixed_rate; |
| 202 | absl::optional<DataRate> min_rate; |
| 203 | absl::optional<DataRate> max_rate; |
Danil Chapovalov | 0c626af | 2020-02-10 11:16:00 +0100 | [diff] [blame] | 204 | TimeDelta initial_frame_length = TimeDelta::Millis(20); |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 205 | } encoder; |
| 206 | struct Stream { |
| 207 | Stream(); |
| 208 | Stream(const Stream&); |
| 209 | ~Stream(); |
Sebastian Jansson | e112bb8 | 2019-06-13 17:36:01 +0200 | [diff] [blame] | 210 | bool abs_send_time = false; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 211 | bool in_bandwidth_estimation = false; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 212 | } stream; |
Sebastian Jansson | cc5be54 | 2019-04-01 13:34:55 +0200 | [diff] [blame] | 213 | struct Rendering { |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 214 | std::string sync_group; |
| 215 | } render; |
| 216 | }; |
| 217 | |
Sebastian Jansson | ef86d14 | 2019-04-15 14:42:42 +0200 | [diff] [blame] | 218 | // TODO(srte): Merge this with BuiltInNetworkBehaviorConfig. |
| 219 | struct NetworkSimulationConfig { |
| 220 | DataRate bandwidth = DataRate::Infinity(); |
| 221 | TimeDelta delay = TimeDelta::Zero(); |
| 222 | TimeDelta delay_std_dev = TimeDelta::Zero(); |
| 223 | double loss_rate = 0; |
| 224 | bool codel_active_queue_management = false; |
Sebastian Jansson | 24c678f | 2019-10-14 15:07:58 +0200 | [diff] [blame] | 225 | absl::optional<int> packet_queue_length_limit; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 226 | DataSize packet_overhead = DataSize::Zero(); |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 227 | }; |
Sebastian Jansson | 98b07e9 | 2018-09-27 13:47:01 +0200 | [diff] [blame] | 228 | } // namespace test |
| 229 | } // namespace webrtc |
| 230 | |
| 231 | #endif // TEST_SCENARIO_SCENARIO_CONFIG_H_ |