Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 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 | */ |
Artem Titov | d57628f | 2019-03-22 12:34:25 +0100 | [diff] [blame] | 10 | #ifndef API_TEST_PEERCONNECTION_QUALITY_TEST_FIXTURE_H_ |
| 11 | #define API_TEST_PEERCONNECTION_QUALITY_TEST_FIXTURE_H_ |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 12 | |
Artem Titov | f65a89b | 2019-05-07 11:56:44 +0200 | [diff] [blame] | 13 | #include <map> |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 14 | #include <memory> |
| 15 | #include <string> |
Artem Titov | 7581ff7 | 2019-05-15 15:45:33 +0200 | [diff] [blame] | 16 | #include <utility> |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 17 | #include <vector> |
| 18 | |
Artem Titov | a6a273d | 2019-02-07 16:43:51 +0100 | [diff] [blame] | 19 | #include "absl/memory/memory.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 20 | #include "api/async_resolver_factory.h" |
| 21 | #include "api/call/call_factory_interface.h" |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 22 | #include "api/fec_controller.h" |
Artem Titov | 741daaf | 2019-03-21 14:37:36 +0100 | [diff] [blame] | 23 | #include "api/function_view.h" |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 24 | #include "api/media_transport_interface.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 25 | #include "api/peer_connection_interface.h" |
Danil Chapovalov | 1a5fc90 | 2019-06-10 12:58:03 +0200 | [diff] [blame] | 26 | #include "api/task_queue/task_queue_factory.h" |
Artem Titov | d57628f | 2019-03-22 12:34:25 +0100 | [diff] [blame] | 27 | #include "api/test/audio_quality_analyzer_interface.h" |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 28 | #include "api/test/simulated_network.h" |
Artem Titov | d57628f | 2019-03-22 12:34:25 +0100 | [diff] [blame] | 29 | #include "api/test/video_quality_analyzer_interface.h" |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 30 | #include "api/transport/network_control.h" |
Artem Titov | ebd9770 | 2019-01-09 17:55:36 +0100 | [diff] [blame] | 31 | #include "api/units/time_delta.h" |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 32 | #include "api/video_codecs/video_decoder_factory.h" |
| 33 | #include "api/video_codecs/video_encoder.h" |
| 34 | #include "api/video_codecs/video_encoder_factory.h" |
| 35 | #include "logging/rtc_event_log/rtc_event_log_factory_interface.h" |
Artem Titov | f65a89b | 2019-05-07 11:56:44 +0200 | [diff] [blame] | 36 | #include "media/base/media_constants.h" |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 37 | #include "rtc_base/network.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 38 | #include "rtc_base/rtc_certificate_generator.h" |
| 39 | #include "rtc_base/ssl_certificate.h" |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 40 | #include "rtc_base/thread.h" |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 41 | |
| 42 | namespace webrtc { |
Artem Titov | 0b44314 | 2019-03-20 11:11:08 +0100 | [diff] [blame] | 43 | namespace webrtc_pc_e2e { |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 44 | |
Artem Titov | 7581ff7 | 2019-05-15 15:45:33 +0200 | [diff] [blame] | 45 | constexpr size_t kDefaultSlidesWidth = 1850; |
| 46 | constexpr size_t kDefaultSlidesHeight = 1110; |
| 47 | |
Artem Titov | d57628f | 2019-03-22 12:34:25 +0100 | [diff] [blame] | 48 | // API is in development. Can be changed/removed without notice. |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 49 | class PeerConnectionE2EQualityTestFixture { |
| 50 | public: |
Artem Titov | 7581ff7 | 2019-05-15 15:45:33 +0200 | [diff] [blame] | 51 | // Contains parameters for screen share scrolling. |
| 52 | // |
| 53 | // If scrolling is enabled, then it will be done by putting sliding window |
| 54 | // on source video and moving this window from top left corner to the |
| 55 | // bottom right corner of the picture. |
| 56 | // |
| 57 | // In such case source dimensions must be greater or equal to the sliding |
| 58 | // window dimensions. So |source_width| and |source_height| are the dimensions |
| 59 | // of the source frame, while |VideoConfig::width| and |VideoConfig::height| |
| 60 | // are the dimensions of the sliding window. |
| 61 | // |
| 62 | // Because |source_width| and |source_height| are dimensions of the source |
| 63 | // frame, they have to be width and height of videos from |
| 64 | // |ScreenShareConfig::slides_yuv_file_names|. |
| 65 | // |
| 66 | // Because scrolling have to be done on single slide it also requires, that |
| 67 | // |duration| must be less or equal to |
| 68 | // |ScreenShareConfig::slide_change_interval|. |
| 69 | struct ScrollingParams { |
| 70 | ScrollingParams(TimeDelta duration, |
| 71 | size_t source_width, |
| 72 | size_t source_height) |
| 73 | : duration(duration), |
| 74 | source_width(source_width), |
| 75 | source_height(source_height) { |
| 76 | RTC_CHECK_GT(duration.ms(), 0); |
| 77 | } |
| 78 | |
| 79 | // Duration of scrolling. |
| 80 | TimeDelta duration; |
| 81 | // Width of source slides video. |
| 82 | size_t source_width; |
| 83 | // Height of source slides video. |
| 84 | size_t source_height; |
| 85 | }; |
| 86 | |
Artem Titov | ebd9770 | 2019-01-09 17:55:36 +0100 | [diff] [blame] | 87 | // Contains screen share video stream properties. |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 88 | struct ScreenShareConfig { |
Artem Titov | 7581ff7 | 2019-05-15 15:45:33 +0200 | [diff] [blame] | 89 | explicit ScreenShareConfig(TimeDelta slide_change_interval) |
| 90 | : slide_change_interval(slide_change_interval) { |
| 91 | RTC_CHECK_GT(slide_change_interval.ms(), 0); |
| 92 | } |
| 93 | |
Artem Titov | ebd9770 | 2019-01-09 17:55:36 +0100 | [diff] [blame] | 94 | // Shows how long one slide should be presented on the screen during |
| 95 | // slide generation. |
| 96 | TimeDelta slide_change_interval; |
Artem Titov | 7581ff7 | 2019-05-15 15:45:33 +0200 | [diff] [blame] | 97 | // If true, slides will be generated programmatically. No scrolling params |
| 98 | // will be applied in such case. |
| 99 | bool generate_slides = false; |
| 100 | // If present scrolling will be applied. Please read extra requirement on |
| 101 | // |slides_yuv_file_names| for scrolling. |
| 102 | absl::optional<ScrollingParams> scrolling_params; |
| 103 | // Contains list of yuv files with slides. |
| 104 | // |
| 105 | // If empty, default set of slides will be used. In such case |
| 106 | // |VideoConfig::width| must be equal to |kDefaultSlidesWidth| and |
| 107 | // |VideoConfig::height| must be equal to |kDefaultSlidesHeight| or if |
| 108 | // |scrolling_params| are specified, then |ScrollingParams::source_width| |
| 109 | // must be equal to |kDefaultSlidesWidth| and |
| 110 | // |ScrollingParams::source_height| must be equal to |kDefaultSlidesHeight|. |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 111 | std::vector<std::string> slides_yuv_file_names; |
| 112 | }; |
| 113 | |
Artem Titov | a6a273d | 2019-02-07 16:43:51 +0100 | [diff] [blame] | 114 | enum VideoGeneratorType { kDefault, kI420A, kI010 }; |
| 115 | |
Artem Titov | d70d80d | 2019-07-19 11:00:40 +0200 | [diff] [blame] | 116 | // Config for Vp8 simulcast or Vp9 SVC testing. |
| 117 | // |
| 118 | // SVC support is limited: |
| 119 | // During SVC testing there is no SFU, so framework will try to emulate SFU |
| 120 | // behavior in regular p2p call. Because of it there are such limitations: |
| 121 | // * if |target_spatial_index| is not equal to the highest spatial layer |
| 122 | // then no packet/frame drops are allowed. |
| 123 | // |
| 124 | // If there will be any drops, that will affect requested layer, then |
| 125 | // WebRTC SVC implementation will continue decoding only the highest |
| 126 | // available layer and won't restore lower layers, so analyzer won't |
| 127 | // receive required data which will cause wrong results or test failures. |
Artem Titov | ef3fd9c | 2019-06-13 16:36:52 +0200 | [diff] [blame] | 128 | struct VideoSimulcastConfig { |
| 129 | VideoSimulcastConfig(int simulcast_streams_count, int target_spatial_index) |
| 130 | : simulcast_streams_count(simulcast_streams_count), |
| 131 | target_spatial_index(target_spatial_index) { |
| 132 | RTC_CHECK_GT(simulcast_streams_count, 1); |
| 133 | RTC_CHECK_GE(target_spatial_index, 0); |
| 134 | RTC_CHECK_LT(target_spatial_index, simulcast_streams_count); |
| 135 | } |
| 136 | |
| 137 | // Specified amount of simulcast streams/SVC layers, depending on which |
| 138 | // encoder is used. |
| 139 | int simulcast_streams_count; |
| 140 | // Specifies spatial index of the video stream to analyze. |
| 141 | // There are 2 cases: |
| 142 | // 1. simulcast encoder is used: |
| 143 | // in such case |target_spatial_index| will specify the index of |
| 144 | // simulcast stream, that should be analyzed. Other streams will be |
| 145 | // dropped. |
| 146 | // 2. SVC encoder is used: |
| 147 | // in such case |target_spatial_index| will specify the top interesting |
| 148 | // spatial layer and all layers below, including target one will be |
| 149 | // processed. All layers above target one will be dropped. |
| 150 | int target_spatial_index; |
| 151 | }; |
| 152 | |
Artem Titov | ebd9770 | 2019-01-09 17:55:36 +0100 | [diff] [blame] | 153 | // Contains properties of single video stream. |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 154 | struct VideoConfig { |
Artem Titov | c58c01d | 2019-02-28 13:19:12 +0100 | [diff] [blame] | 155 | VideoConfig(size_t width, size_t height, int32_t fps) |
| 156 | : width(width), height(height), fps(fps) {} |
| 157 | |
Artem Titov | 7581ff7 | 2019-05-15 15:45:33 +0200 | [diff] [blame] | 158 | // Video stream width. |
Artem Titov | c58c01d | 2019-02-28 13:19:12 +0100 | [diff] [blame] | 159 | const size_t width; |
Artem Titov | 7581ff7 | 2019-05-15 15:45:33 +0200 | [diff] [blame] | 160 | // Video stream height. |
Artem Titov | c58c01d | 2019-02-28 13:19:12 +0100 | [diff] [blame] | 161 | const size_t height; |
| 162 | const int32_t fps; |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 163 | // Have to be unique among all specified configs for all peers in the call. |
Artem Titov | 3481db2 | 2019-02-28 13:13:15 +0100 | [diff] [blame] | 164 | // Will be auto generated if omitted. |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 165 | absl::optional<std::string> stream_label; |
Artem Titov | 9a7e721 | 2019-02-28 16:34:17 +0100 | [diff] [blame] | 166 | // Only 1 from |generator|, |input_file_name| and |screen_share_config| can |
| 167 | // be specified. If none of them are specified, then |generator| will be set |
| 168 | // to VideoGeneratorType::kDefault. |
| 169 | // If specified generator of this type will be used to produce input video. |
Artem Titov | a6a273d | 2019-02-07 16:43:51 +0100 | [diff] [blame] | 170 | absl::optional<VideoGeneratorType> generator; |
| 171 | // If specified this file will be used as input. Input video will be played |
| 172 | // in a circle. |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 173 | absl::optional<std::string> input_file_name; |
| 174 | // If specified screen share video stream will be created as input. |
| 175 | absl::optional<ScreenShareConfig> screen_share_config; |
Artem Titov | ef3fd9c | 2019-06-13 16:36:52 +0200 | [diff] [blame] | 176 | // If presented video will be transfered in simulcast/SVC mode depending on |
| 177 | // which encoder is used. |
| 178 | // |
Artem Titov | 46c7a16 | 2019-07-29 13:17:14 +0200 | [diff] [blame] | 179 | // Simulcast is supported only from 1st added peer. For VP8 simulcast only |
| 180 | // without RTX is supported so it will be automatically disabled for all |
| 181 | // simulcast tracks. For VP9 simulcast enables VP9 SVC mode and support RTX, |
| 182 | // but only on non-lossy networks. See more in documentation to |
| 183 | // VideoSimulcastConfig. |
Artem Titov | ef3fd9c | 2019-06-13 16:36:52 +0200 | [diff] [blame] | 184 | absl::optional<VideoSimulcastConfig> simulcast_config; |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 185 | // If specified the input stream will be also copied to specified file. |
Artem Titov | a6a273d | 2019-02-07 16:43:51 +0100 | [diff] [blame] | 186 | // It is actually one of the test's output file, which contains copy of what |
| 187 | // was captured during the test for this video stream on sender side. |
| 188 | // It is useful when generator is used as input. |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 189 | absl::optional<std::string> input_dump_file_name; |
| 190 | // If specified this file will be used as output on the receiver side for |
| 191 | // this stream. If multiple streams will be produced by input stream, |
Artem Titov | a6a273d | 2019-02-07 16:43:51 +0100 | [diff] [blame] | 192 | // output files will be appended with indexes. The produced files contains |
| 193 | // what was rendered for this video stream on receiver side. |
| 194 | absl::optional<std::string> output_dump_file_name; |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 195 | }; |
| 196 | |
Artem Titov | ebd9770 | 2019-01-09 17:55:36 +0100 | [diff] [blame] | 197 | // Contains properties for audio in the call. |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 198 | struct AudioConfig { |
| 199 | enum Mode { |
| 200 | kGenerated, |
| 201 | kFile, |
| 202 | }; |
Artem Titov | 3481db2 | 2019-02-28 13:13:15 +0100 | [diff] [blame] | 203 | // Have to be unique among all specified configs for all peers in the call. |
| 204 | // Will be auto generated if omitted. |
| 205 | absl::optional<std::string> stream_label; |
Artem Titov | 9a7e721 | 2019-02-28 16:34:17 +0100 | [diff] [blame] | 206 | Mode mode = kGenerated; |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 207 | // Have to be specified only if mode = kFile |
| 208 | absl::optional<std::string> input_file_name; |
| 209 | // If specified the input stream will be also copied to specified file. |
| 210 | absl::optional<std::string> input_dump_file_name; |
| 211 | // If specified the output stream will be copied to specified file. |
Artem Titov | a6a273d | 2019-02-07 16:43:51 +0100 | [diff] [blame] | 212 | absl::optional<std::string> output_dump_file_name; |
Artem Titov | bc558ce | 2019-07-08 19:13:21 +0200 | [diff] [blame] | 213 | |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 214 | // Audio options to use. |
| 215 | cricket::AudioOptions audio_options; |
Artem Titov | bc558ce | 2019-07-08 19:13:21 +0200 | [diff] [blame] | 216 | // Sampling frequency of input audio data (from file or generated). |
| 217 | int sampling_frequency_in_hz = 48000; |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 218 | }; |
| 219 | |
Artem Titov | d09bc55 | 2019-03-20 11:18:58 +0100 | [diff] [blame] | 220 | // This class is used to fully configure one peer inside the call. |
| 221 | class PeerConfigurer { |
| 222 | public: |
| 223 | virtual ~PeerConfigurer() = default; |
| 224 | |
Danil Chapovalov | 1a5fc90 | 2019-06-10 12:58:03 +0200 | [diff] [blame] | 225 | // The parameters of the following 8 methods will be passed to the |
Artem Titov | d09bc55 | 2019-03-20 11:18:58 +0100 | [diff] [blame] | 226 | // PeerConnectionFactoryInterface implementation that will be created for |
| 227 | // this peer. |
Danil Chapovalov | 1a5fc90 | 2019-06-10 12:58:03 +0200 | [diff] [blame] | 228 | virtual PeerConfigurer* SetTaskQueueFactory( |
| 229 | std::unique_ptr<TaskQueueFactory> task_queue_factory) = 0; |
Artem Titov | d09bc55 | 2019-03-20 11:18:58 +0100 | [diff] [blame] | 230 | virtual PeerConfigurer* SetCallFactory( |
| 231 | std::unique_ptr<CallFactoryInterface> call_factory) = 0; |
| 232 | virtual PeerConfigurer* SetEventLogFactory( |
| 233 | std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory) = 0; |
| 234 | virtual PeerConfigurer* SetFecControllerFactory( |
| 235 | std::unique_ptr<FecControllerFactoryInterface> |
| 236 | fec_controller_factory) = 0; |
| 237 | virtual PeerConfigurer* SetNetworkControllerFactory( |
| 238 | std::unique_ptr<NetworkControllerFactoryInterface> |
| 239 | network_controller_factory) = 0; |
| 240 | virtual PeerConfigurer* SetMediaTransportFactory( |
| 241 | std::unique_ptr<MediaTransportFactory> media_transport_factory) = 0; |
| 242 | virtual PeerConfigurer* SetVideoEncoderFactory( |
| 243 | std::unique_ptr<VideoEncoderFactory> video_encoder_factory) = 0; |
| 244 | virtual PeerConfigurer* SetVideoDecoderFactory( |
| 245 | std::unique_ptr<VideoDecoderFactory> video_decoder_factory) = 0; |
| 246 | |
| 247 | // The parameters of the following 3 methods will be passed to the |
| 248 | // PeerConnectionInterface implementation that will be created for this |
| 249 | // peer. |
| 250 | virtual PeerConfigurer* SetAsyncResolverFactory( |
| 251 | std::unique_ptr<webrtc::AsyncResolverFactory> |
| 252 | async_resolver_factory) = 0; |
| 253 | virtual PeerConfigurer* SetRTCCertificateGenerator( |
| 254 | std::unique_ptr<rtc::RTCCertificateGeneratorInterface> |
| 255 | cert_generator) = 0; |
| 256 | virtual PeerConfigurer* SetSSLCertificateVerifier( |
| 257 | std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier) = 0; |
| 258 | |
| 259 | // Add new video stream to the call that will be sent from this peer. |
| 260 | virtual PeerConfigurer* AddVideoConfig(VideoConfig config) = 0; |
| 261 | // Set the audio stream for the call from this peer. If this method won't |
| 262 | // be invoked, this peer will send no audio. |
| 263 | virtual PeerConfigurer* SetAudioConfig(AudioConfig config) = 0; |
| 264 | // If is set, an RTCEventLog will be saved in that location and it will be |
| 265 | // available for further analysis. |
| 266 | virtual PeerConfigurer* SetRtcEventLogPath(std::string path) = 0; |
Artem Titov | 70f80e5 | 2019-04-12 13:13:39 +0200 | [diff] [blame] | 267 | // If is set, an AEC dump will be saved in that location and it will be |
| 268 | // available for further analysis. |
| 269 | virtual PeerConfigurer* SetAecDumpPath(std::string path) = 0; |
Artem Titov | d09bc55 | 2019-03-20 11:18:58 +0100 | [diff] [blame] | 270 | virtual PeerConfigurer* SetRTCConfiguration( |
| 271 | PeerConnectionInterface::RTCConfiguration configuration) = 0; |
Artem Titov | 85a9d91 | 2019-05-29 14:36:50 +0200 | [diff] [blame] | 272 | // Set bitrate parameters on PeerConnection. This constraints will be |
| 273 | // applied to all summed RTP streams for this peer. |
| 274 | virtual PeerConfigurer* SetBitrateParameters( |
| 275 | PeerConnectionInterface::BitrateParameters bitrate_params) = 0; |
Artem Titov | d09bc55 | 2019-03-20 11:18:58 +0100 | [diff] [blame] | 276 | }; |
| 277 | |
Artem Titov | a6a273d | 2019-02-07 16:43:51 +0100 | [diff] [blame] | 278 | // Contains parameters, that describe how long framework should run quality |
| 279 | // test. |
| 280 | struct RunParams { |
Artem Titov | ade945d | 2019-04-02 18:31:48 +0200 | [diff] [blame] | 281 | explicit RunParams(TimeDelta run_duration) : run_duration(run_duration) {} |
| 282 | |
Artem Titov | a6a273d | 2019-02-07 16:43:51 +0100 | [diff] [blame] | 283 | // Specifies how long the test should be run. This time shows how long |
| 284 | // the media should flow after connection was established and before |
| 285 | // it will be shut downed. |
| 286 | TimeDelta run_duration; |
Artem Titov | ade945d | 2019-04-02 18:31:48 +0200 | [diff] [blame] | 287 | |
Artem Titov | f65a89b | 2019-05-07 11:56:44 +0200 | [diff] [blame] | 288 | // Next two fields are used to specify concrete video codec, that should be |
| 289 | // used in the test. Video code will be negotiated in SDP during offer/ |
| 290 | // answer exchange. |
| 291 | // Video codec name. You can find valid names in |
| 292 | // media/base/media_constants.h |
| 293 | std::string video_codec_name = cricket::kVp8CodecName; |
| 294 | // Map of parameters, that have to be specified on SDP codec. Each parameter |
| 295 | // is described by key and value. Codec parameters will match the specified |
| 296 | // map if and only if for each key from |video_codec_required_params| there |
| 297 | // will be a parameter with name equal to this key and parameter value will |
| 298 | // be equal to the value from |video_codec_required_params| for this key. |
| 299 | // If empty then only name will be used to match the codec. |
| 300 | std::map<std::string, std::string> video_codec_required_params; |
| 301 | bool use_ulp_fec = false; |
| 302 | bool use_flex_fec = false; |
Artem Titov | ade945d | 2019-04-02 18:31:48 +0200 | [diff] [blame] | 303 | // Specifies how much video encoder target bitrate should be different than |
| 304 | // target bitrate, provided by WebRTC stack. Must be greater then 0. Can be |
| 305 | // used to emulate overshooting of video encoders. This multiplier will |
| 306 | // be applied for all video encoder on both sides for all layers. Bitrate |
| 307 | // estimated by WebRTC stack will be multiplied on this multiplier and then |
Erik Språng | 16cb8f5 | 2019-04-12 13:59:09 +0200 | [diff] [blame] | 308 | // provided into VideoEncoder::SetRates(...). |
Artem Titov | ade945d | 2019-04-02 18:31:48 +0200 | [diff] [blame] | 309 | double video_encoder_bitrate_multiplier = 1.0; |
Artem Titov | 39483c6 | 2019-07-19 17:03:52 +0200 | [diff] [blame] | 310 | // If true will set conference mode in SDP media section for all video |
| 311 | // tracks for all peers. |
| 312 | bool use_conference_mode = false; |
Artem Titov | a6a273d | 2019-02-07 16:43:51 +0100 | [diff] [blame] | 313 | }; |
| 314 | |
Artem Titov | 1845922 | 2019-04-24 11:09:35 +0200 | [diff] [blame] | 315 | // Represent an entity that will report quality metrics after test. |
| 316 | class QualityMetricsReporter { |
| 317 | public: |
| 318 | virtual ~QualityMetricsReporter() = default; |
| 319 | |
| 320 | // Invoked by framework after peer connection factory and peer connection |
| 321 | // itself will be created but before offer/answer exchange will be started. |
| 322 | virtual void Start(absl::string_view test_case_name) = 0; |
| 323 | |
| 324 | // Invoked by framework after call is ended and peer connection factory and |
| 325 | // peer connection are destroyed. |
| 326 | virtual void StopAndReportResults() = 0; |
| 327 | }; |
| 328 | |
Artem Titov | d09bc55 | 2019-03-20 11:18:58 +0100 | [diff] [blame] | 329 | virtual ~PeerConnectionE2EQualityTestFixture() = default; |
| 330 | |
Artem Titov | ba82e00 | 2019-03-15 15:57:53 +0100 | [diff] [blame] | 331 | // Add activity that will be executed on the best effort at least after |
| 332 | // |target_time_since_start| after call will be set up (after offer/answer |
| 333 | // exchange, ICE gathering will be done and ICE candidates will passed to |
| 334 | // remote side). |func| param is amount of time spent from the call set up. |
| 335 | virtual void ExecuteAt(TimeDelta target_time_since_start, |
| 336 | std::function<void(TimeDelta)> func) = 0; |
| 337 | // Add activity that will be executed every |interval| with first execution |
| 338 | // on the best effort at least after |initial_delay_since_start| after call |
| 339 | // will be set up (after all participants will be connected). |func| param is |
| 340 | // amount of time spent from the call set up. |
| 341 | virtual void ExecuteEvery(TimeDelta initial_delay_since_start, |
| 342 | TimeDelta interval, |
| 343 | std::function<void(TimeDelta)> func) = 0; |
| 344 | |
Artem Titov | 1845922 | 2019-04-24 11:09:35 +0200 | [diff] [blame] | 345 | // Add stats reporter entity to observe the test. |
| 346 | virtual void AddQualityMetricsReporter( |
| 347 | std::unique_ptr<QualityMetricsReporter> quality_metrics_reporter) = 0; |
| 348 | |
Artem Titov | d09bc55 | 2019-03-20 11:18:58 +0100 | [diff] [blame] | 349 | // Add a new peer to the call and return an object through which caller |
| 350 | // can configure peer's behavior. |
| 351 | // |network_thread| will be used as network thread for peer's peer connection |
| 352 | // |network_manager| will be used to provide network interfaces for peer's |
| 353 | // peer connection. |
| 354 | // |configurer| function will be used to configure peer in the call. |
| 355 | virtual void AddPeer(rtc::Thread* network_thread, |
| 356 | rtc::NetworkManager* network_manager, |
| 357 | rtc::FunctionView<void(PeerConfigurer*)> configurer) = 0; |
| 358 | virtual void Run(RunParams run_params) = 0; |
Artem Titov | b93c4e6 | 2019-05-02 10:52:07 +0200 | [diff] [blame] | 359 | |
| 360 | // Returns real test duration - the time of test execution measured during |
| 361 | // test. Client must call this method only after test is finished (after |
| 362 | // Run(...) method returned). Test execution time is time from end of call |
| 363 | // setup (offer/answer, ICE candidates exchange done and ICE connected) to |
| 364 | // start of call tear down (PeerConnection closed). |
| 365 | virtual TimeDelta GetRealTestDuration() const = 0; |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 366 | }; |
| 367 | |
Artem Titov | 0b44314 | 2019-03-20 11:11:08 +0100 | [diff] [blame] | 368 | } // namespace webrtc_pc_e2e |
Artem Titov | b6c6201 | 2019-01-08 14:58:23 +0100 | [diff] [blame] | 369 | } // namespace webrtc |
| 370 | |
Artem Titov | d57628f | 2019-03-22 12:34:25 +0100 | [diff] [blame] | 371 | #endif // API_TEST_PEERCONNECTION_QUALITY_TEST_FIXTURE_H_ |