blob: a5ccc4c0a34e34f786abc80ac9a0d03b89a0d41a [file] [log] [blame]
Artem Titovb6c62012019-01-08 14:58:23 +01001/*
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 Titovd57628f2019-03-22 12:34:25 +010010#ifndef API_TEST_PEERCONNECTION_QUALITY_TEST_FIXTURE_H_
11#define API_TEST_PEERCONNECTION_QUALITY_TEST_FIXTURE_H_
Artem Titovb6c62012019-01-08 14:58:23 +010012
Artem Titovf65a89b2019-05-07 11:56:44 +020013#include <map>
Artem Titovb6c62012019-01-08 14:58:23 +010014#include <memory>
15#include <string>
Artem Titov7581ff72019-05-15 15:45:33 +020016#include <utility>
Artem Titovb6c62012019-01-08 14:58:23 +010017#include <vector>
18
Artem Titova6a273d2019-02-07 16:43:51 +010019#include "absl/memory/memory.h"
Artem Titov4a6f8182020-02-27 13:24:19 +010020#include "absl/strings/string_view.h"
21#include "absl/types/optional.h"
Steve Anton10542f22019-01-11 09:11:00 -080022#include "api/async_resolver_factory.h"
23#include "api/call/call_factory_interface.h"
Artem Titovb6c62012019-01-08 14:58:23 +010024#include "api/fec_controller.h"
Artem Titov741daaf2019-03-21 14:37:36 +010025#include "api/function_view.h"
Steve Anton10542f22019-01-11 09:11:00 -080026#include "api/peer_connection_interface.h"
Danil Chapovalov9305d112019-09-04 13:16:09 +020027#include "api/rtc_event_log/rtc_event_log_factory_interface.h"
Danil Chapovalov1a5fc902019-06-10 12:58:03 +020028#include "api/task_queue/task_queue_factory.h"
Artem Titovd57628f2019-03-22 12:34:25 +010029#include "api/test/audio_quality_analyzer_interface.h"
Artem Titov00202262019-12-04 22:34:41 +010030#include "api/test/frame_generator_interface.h"
Artem Titovb6c62012019-01-08 14:58:23 +010031#include "api/test/simulated_network.h"
Artem Titova8549212019-08-19 14:38:06 +020032#include "api/test/stats_observer_interface.h"
Artem Titovd57628f2019-03-22 12:34:25 +010033#include "api/test/video_quality_analyzer_interface.h"
Niels Möller65f17ca2019-09-12 13:59:36 +020034#include "api/transport/media/media_transport_interface.h"
Artem Titovb6c62012019-01-08 14:58:23 +010035#include "api/transport/network_control.h"
Artem Titovebd97702019-01-09 17:55:36 +010036#include "api/units/time_delta.h"
Artem Titovb6c62012019-01-08 14:58:23 +010037#include "api/video_codecs/video_decoder_factory.h"
38#include "api/video_codecs/video_encoder.h"
39#include "api/video_codecs/video_encoder_factory.h"
Artem Titovf65a89b2019-05-07 11:56:44 +020040#include "media/base/media_constants.h"
Artem Titovb6c62012019-01-08 14:58:23 +010041#include "rtc_base/network.h"
Steve Anton10542f22019-01-11 09:11:00 -080042#include "rtc_base/rtc_certificate_generator.h"
43#include "rtc_base/ssl_certificate.h"
Artem Titovb6c62012019-01-08 14:58:23 +010044#include "rtc_base/thread.h"
Artem Titovb6c62012019-01-08 14:58:23 +010045
46namespace webrtc {
Artem Titov0b443142019-03-20 11:11:08 +010047namespace webrtc_pc_e2e {
Artem Titovb6c62012019-01-08 14:58:23 +010048
Artem Titov7581ff72019-05-15 15:45:33 +020049constexpr size_t kDefaultSlidesWidth = 1850;
50constexpr size_t kDefaultSlidesHeight = 1110;
51
Artem Titovd57628f2019-03-22 12:34:25 +010052// API is in development. Can be changed/removed without notice.
Artem Titovb6c62012019-01-08 14:58:23 +010053class PeerConnectionE2EQualityTestFixture {
54 public:
Artem Titov7581ff72019-05-15 15:45:33 +020055 // Contains parameters for screen share scrolling.
56 //
57 // If scrolling is enabled, then it will be done by putting sliding window
58 // on source video and moving this window from top left corner to the
59 // bottom right corner of the picture.
60 //
61 // In such case source dimensions must be greater or equal to the sliding
62 // window dimensions. So |source_width| and |source_height| are the dimensions
63 // of the source frame, while |VideoConfig::width| and |VideoConfig::height|
64 // are the dimensions of the sliding window.
65 //
66 // Because |source_width| and |source_height| are dimensions of the source
67 // frame, they have to be width and height of videos from
68 // |ScreenShareConfig::slides_yuv_file_names|.
69 //
70 // Because scrolling have to be done on single slide it also requires, that
71 // |duration| must be less or equal to
72 // |ScreenShareConfig::slide_change_interval|.
73 struct ScrollingParams {
74 ScrollingParams(TimeDelta duration,
75 size_t source_width,
76 size_t source_height)
77 : duration(duration),
78 source_width(source_width),
79 source_height(source_height) {
80 RTC_CHECK_GT(duration.ms(), 0);
81 }
82
83 // Duration of scrolling.
84 TimeDelta duration;
85 // Width of source slides video.
86 size_t source_width;
87 // Height of source slides video.
88 size_t source_height;
89 };
90
Artem Titovebd97702019-01-09 17:55:36 +010091 // Contains screen share video stream properties.
Artem Titovb6c62012019-01-08 14:58:23 +010092 struct ScreenShareConfig {
Artem Titov7581ff72019-05-15 15:45:33 +020093 explicit ScreenShareConfig(TimeDelta slide_change_interval)
94 : slide_change_interval(slide_change_interval) {
95 RTC_CHECK_GT(slide_change_interval.ms(), 0);
96 }
97
Artem Titovebd97702019-01-09 17:55:36 +010098 // Shows how long one slide should be presented on the screen during
99 // slide generation.
100 TimeDelta slide_change_interval;
Artem Titov7581ff72019-05-15 15:45:33 +0200101 // If true, slides will be generated programmatically. No scrolling params
102 // will be applied in such case.
103 bool generate_slides = false;
104 // If present scrolling will be applied. Please read extra requirement on
105 // |slides_yuv_file_names| for scrolling.
106 absl::optional<ScrollingParams> scrolling_params;
107 // Contains list of yuv files with slides.
108 //
109 // If empty, default set of slides will be used. In such case
110 // |VideoConfig::width| must be equal to |kDefaultSlidesWidth| and
111 // |VideoConfig::height| must be equal to |kDefaultSlidesHeight| or if
112 // |scrolling_params| are specified, then |ScrollingParams::source_width|
113 // must be equal to |kDefaultSlidesWidth| and
114 // |ScrollingParams::source_height| must be equal to |kDefaultSlidesHeight|.
Artem Titovb6c62012019-01-08 14:58:23 +0100115 std::vector<std::string> slides_yuv_file_names;
Artem Titovb3f14872019-09-09 13:48:21 +0200116 // If true will set VideoTrackInterface::ContentHint::kText for current
117 // video track.
118 bool use_text_content_hint = true;
Artem Titovb6c62012019-01-08 14:58:23 +0100119 };
120
Artem Titova6a273d2019-02-07 16:43:51 +0100121 enum VideoGeneratorType { kDefault, kI420A, kI010 };
122
Artem Titovd70d80d2019-07-19 11:00:40 +0200123 // Config for Vp8 simulcast or Vp9 SVC testing.
124 //
125 // SVC support is limited:
126 // During SVC testing there is no SFU, so framework will try to emulate SFU
127 // behavior in regular p2p call. Because of it there are such limitations:
128 // * if |target_spatial_index| is not equal to the highest spatial layer
129 // then no packet/frame drops are allowed.
130 //
131 // If there will be any drops, that will affect requested layer, then
132 // WebRTC SVC implementation will continue decoding only the highest
133 // available layer and won't restore lower layers, so analyzer won't
134 // receive required data which will cause wrong results or test failures.
Artem Titovef3fd9c2019-06-13 16:36:52 +0200135 struct VideoSimulcastConfig {
136 VideoSimulcastConfig(int simulcast_streams_count, int target_spatial_index)
137 : simulcast_streams_count(simulcast_streams_count),
138 target_spatial_index(target_spatial_index) {
139 RTC_CHECK_GT(simulcast_streams_count, 1);
140 RTC_CHECK_GE(target_spatial_index, 0);
141 RTC_CHECK_LT(target_spatial_index, simulcast_streams_count);
142 }
143
144 // Specified amount of simulcast streams/SVC layers, depending on which
145 // encoder is used.
146 int simulcast_streams_count;
147 // Specifies spatial index of the video stream to analyze.
148 // There are 2 cases:
149 // 1. simulcast encoder is used:
150 // in such case |target_spatial_index| will specify the index of
151 // simulcast stream, that should be analyzed. Other streams will be
152 // dropped.
153 // 2. SVC encoder is used:
154 // in such case |target_spatial_index| will specify the top interesting
155 // spatial layer and all layers below, including target one will be
156 // processed. All layers above target one will be dropped.
157 int target_spatial_index;
158 };
159
Artem Titovebd97702019-01-09 17:55:36 +0100160 // Contains properties of single video stream.
Artem Titovb6c62012019-01-08 14:58:23 +0100161 struct VideoConfig {
Artem Titovc58c01d2019-02-28 13:19:12 +0100162 VideoConfig(size_t width, size_t height, int32_t fps)
163 : width(width), height(height), fps(fps) {}
164
Artem Titov7581ff72019-05-15 15:45:33 +0200165 // Video stream width.
Artem Titovc58c01d2019-02-28 13:19:12 +0100166 const size_t width;
Artem Titov7581ff72019-05-15 15:45:33 +0200167 // Video stream height.
Artem Titovc58c01d2019-02-28 13:19:12 +0100168 const size_t height;
169 const int32_t fps;
Artem Titovb6c62012019-01-08 14:58:23 +0100170 // Have to be unique among all specified configs for all peers in the call.
Artem Titov3481db22019-02-28 13:13:15 +0100171 // Will be auto generated if omitted.
Artem Titovb6c62012019-01-08 14:58:23 +0100172 absl::optional<std::string> stream_label;
Artem Titovb4463ee2019-11-12 17:27:44 +0100173 // You can specify one of |generator|, |input_file_name|,
174 // |screen_share_config| and |capturing_device_index|.
Andrey Logvinc0644672020-05-05 10:33:01 +0000175 // If none of them are specified and config is added to the PeerConfigurer
176 // without specifying any video source, then |generator| will be set to
177 // VideoGeneratorType::kDefault.
178 // If video source implementation is specified,
179 // then it will be used as video source regardless of other
180 // options. Please consider this way unless you are using
181 // |capturing_device_index| option, since the possibility of using other
182 // three is about to be removed.
Artem Titovb4463ee2019-11-12 17:27:44 +0100183
184 // If specified generator of this type will be used to produce input video.
Artem Titova6a273d2019-02-07 16:43:51 +0100185 absl::optional<VideoGeneratorType> generator;
186 // If specified this file will be used as input. Input video will be played
187 // in a circle.
Artem Titovb6c62012019-01-08 14:58:23 +0100188 absl::optional<std::string> input_file_name;
189 // If specified screen share video stream will be created as input.
190 absl::optional<ScreenShareConfig> screen_share_config;
Artem Titov9afdddf2019-10-10 13:29:03 +0200191 // If specified this capturing device will be used to get input video. The
192 // |capturing_device_index| is the index of required capturing device in OS
193 // provided list of video devices. On Linux and Windows the list will be
194 // obtained via webrtc::VideoCaptureModule::DeviceInfo, on Mac OS via
195 // [RTCCameraVideoCapturer captureDevices].
196 absl::optional<size_t> capturing_device_index;
Artem Titovef3fd9c2019-06-13 16:36:52 +0200197 // If presented video will be transfered in simulcast/SVC mode depending on
198 // which encoder is used.
199 //
Artem Titov46c7a162019-07-29 13:17:14 +0200200 // Simulcast is supported only from 1st added peer. For VP8 simulcast only
201 // without RTX is supported so it will be automatically disabled for all
202 // simulcast tracks. For VP9 simulcast enables VP9 SVC mode and support RTX,
203 // but only on non-lossy networks. See more in documentation to
204 // VideoSimulcastConfig.
Artem Titovef3fd9c2019-06-13 16:36:52 +0200205 absl::optional<VideoSimulcastConfig> simulcast_config;
Artem Titov1e49ab22019-07-30 13:17:25 +0200206 // Count of temporal layers for video stream. This value will be set into
207 // each RtpEncodingParameters of RtpParameters of corresponding
208 // RtpSenderInterface for this video stream.
209 absl::optional<int> temporal_layers_count;
Artem Titov4a6f8182020-02-27 13:24:19 +0100210 // Sets the maximum encode bitrate in bps. If this value is not set, the
Johannes Kron1162ba22019-09-18 10:28:33 +0200211 // encoder will be capped at an internal maximum value around 2 Mbps
212 // depending on the resolution. This means that it will never be able to
213 // utilize a high bandwidth link.
214 absl::optional<int> max_encode_bitrate_bps;
215 // Sets the minimum encode bitrate in bps. If this value is not set, the
216 // encoder will use an internal minimum value. Please note that if this
217 // value is set higher than the bandwidth of the link, the encoder will
218 // generate more data than the link can handle regardless of the bandwidth
219 // estimation.
220 absl::optional<int> min_encode_bitrate_bps;
Artem Titovb6c62012019-01-08 14:58:23 +0100221 // If specified the input stream will be also copied to specified file.
Artem Titova6a273d2019-02-07 16:43:51 +0100222 // It is actually one of the test's output file, which contains copy of what
223 // was captured during the test for this video stream on sender side.
224 // It is useful when generator is used as input.
Artem Titovb6c62012019-01-08 14:58:23 +0100225 absl::optional<std::string> input_dump_file_name;
226 // If specified this file will be used as output on the receiver side for
227 // this stream. If multiple streams will be produced by input stream,
Artem Titova6a273d2019-02-07 16:43:51 +0100228 // output files will be appended with indexes. The produced files contains
229 // what was rendered for this video stream on receiver side.
230 absl::optional<std::string> output_dump_file_name;
Artem Titovddef8d12019-09-06 14:31:50 +0200231 // If true will display input and output video on the user's screen.
232 bool show_on_screen = false;
Artem Titov4a6f8182020-02-27 13:24:19 +0100233 // If specified, determines a sync group to which this video stream belongs.
234 // According to bugs.webrtc.org/4762 WebRTC supports synchronization only
235 // for pair of single audio and single video stream. Framework won't do any
236 // enforcements on this field.
237 absl::optional<std::string> sync_group;
Artem Titovb6c62012019-01-08 14:58:23 +0100238 };
239
Artem Titovebd97702019-01-09 17:55:36 +0100240 // Contains properties for audio in the call.
Artem Titovb6c62012019-01-08 14:58:23 +0100241 struct AudioConfig {
242 enum Mode {
243 kGenerated,
244 kFile,
245 };
Artem Titov3481db22019-02-28 13:13:15 +0100246 // Have to be unique among all specified configs for all peers in the call.
247 // Will be auto generated if omitted.
248 absl::optional<std::string> stream_label;
Artem Titov9a7e7212019-02-28 16:34:17 +0100249 Mode mode = kGenerated;
Artem Titovb6c62012019-01-08 14:58:23 +0100250 // Have to be specified only if mode = kFile
251 absl::optional<std::string> input_file_name;
252 // If specified the input stream will be also copied to specified file.
253 absl::optional<std::string> input_dump_file_name;
254 // If specified the output stream will be copied to specified file.
Artem Titova6a273d2019-02-07 16:43:51 +0100255 absl::optional<std::string> output_dump_file_name;
Artem Titovbc558ce2019-07-08 19:13:21 +0200256
Artem Titovb6c62012019-01-08 14:58:23 +0100257 // Audio options to use.
258 cricket::AudioOptions audio_options;
Artem Titovbc558ce2019-07-08 19:13:21 +0200259 // Sampling frequency of input audio data (from file or generated).
260 int sampling_frequency_in_hz = 48000;
Artem Titov4a6f8182020-02-27 13:24:19 +0100261 // If specified, determines a sync group to which this audio stream belongs.
262 // According to bugs.webrtc.org/4762 WebRTC supports synchronization only
263 // for pair of single audio and single video stream. Framework won't do any
264 // enforcements on this field.
265 absl::optional<std::string> sync_group;
Artem Titovb6c62012019-01-08 14:58:23 +0100266 };
267
Artem Titovd09bc552019-03-20 11:18:58 +0100268 // This class is used to fully configure one peer inside the call.
269 class PeerConfigurer {
270 public:
271 virtual ~PeerConfigurer() = default;
272
Artem Titov524417f2020-01-17 12:18:20 +0100273 // The parameters of the following 9 methods will be passed to the
Artem Titovd09bc552019-03-20 11:18:58 +0100274 // PeerConnectionFactoryInterface implementation that will be created for
275 // this peer.
Danil Chapovalov1a5fc902019-06-10 12:58:03 +0200276 virtual PeerConfigurer* SetTaskQueueFactory(
277 std::unique_ptr<TaskQueueFactory> task_queue_factory) = 0;
Artem Titovd09bc552019-03-20 11:18:58 +0100278 virtual PeerConfigurer* SetCallFactory(
279 std::unique_ptr<CallFactoryInterface> call_factory) = 0;
280 virtual PeerConfigurer* SetEventLogFactory(
281 std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory) = 0;
282 virtual PeerConfigurer* SetFecControllerFactory(
283 std::unique_ptr<FecControllerFactoryInterface>
284 fec_controller_factory) = 0;
285 virtual PeerConfigurer* SetNetworkControllerFactory(
286 std::unique_ptr<NetworkControllerFactoryInterface>
287 network_controller_factory) = 0;
288 virtual PeerConfigurer* SetMediaTransportFactory(
289 std::unique_ptr<MediaTransportFactory> media_transport_factory) = 0;
290 virtual PeerConfigurer* SetVideoEncoderFactory(
291 std::unique_ptr<VideoEncoderFactory> video_encoder_factory) = 0;
292 virtual PeerConfigurer* SetVideoDecoderFactory(
293 std::unique_ptr<VideoDecoderFactory> video_decoder_factory) = 0;
Artem Titov524417f2020-01-17 12:18:20 +0100294 // Set a custom NetEqFactory to be used in the call.
295 virtual PeerConfigurer* SetNetEqFactory(
296 std::unique_ptr<NetEqFactory> neteq_factory) = 0;
Artem Titovd09bc552019-03-20 11:18:58 +0100297
Jonas Orelandc7bce992020-01-16 11:27:17 +0100298 // The parameters of the following 4 methods will be passed to the
Artem Titovd09bc552019-03-20 11:18:58 +0100299 // PeerConnectionInterface implementation that will be created for this
300 // peer.
301 virtual PeerConfigurer* SetAsyncResolverFactory(
302 std::unique_ptr<webrtc::AsyncResolverFactory>
303 async_resolver_factory) = 0;
304 virtual PeerConfigurer* SetRTCCertificateGenerator(
305 std::unique_ptr<rtc::RTCCertificateGeneratorInterface>
306 cert_generator) = 0;
307 virtual PeerConfigurer* SetSSLCertificateVerifier(
308 std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier) = 0;
Jonas Orelandc7bce992020-01-16 11:27:17 +0100309 virtual PeerConfigurer* SetIceTransportFactory(
310 std::unique_ptr<IceTransportFactory> factory) = 0;
Artem Titovd09bc552019-03-20 11:18:58 +0100311
312 // Add new video stream to the call that will be sent from this peer.
313 virtual PeerConfigurer* AddVideoConfig(VideoConfig config) = 0;
Artem Titovb4463ee2019-11-12 17:27:44 +0100314 // Add new video stream to the call that will be sent from this peer with
Artem Titov00202262019-12-04 22:34:41 +0100315 // provided own implementation of video frames generator.
Artem Titovb4463ee2019-11-12 17:27:44 +0100316 virtual PeerConfigurer* AddVideoConfig(
317 VideoConfig config,
Artem Titov00202262019-12-04 22:34:41 +0100318 std::unique_ptr<test::FrameGeneratorInterface> generator) = 0;
Artem Titovd09bc552019-03-20 11:18:58 +0100319 // Set the audio stream for the call from this peer. If this method won't
320 // be invoked, this peer will send no audio.
321 virtual PeerConfigurer* SetAudioConfig(AudioConfig config) = 0;
322 // If is set, an RTCEventLog will be saved in that location and it will be
323 // available for further analysis.
324 virtual PeerConfigurer* SetRtcEventLogPath(std::string path) = 0;
Artem Titov70f80e52019-04-12 13:13:39 +0200325 // If is set, an AEC dump will be saved in that location and it will be
326 // available for further analysis.
327 virtual PeerConfigurer* SetAecDumpPath(std::string path) = 0;
Artem Titovd09bc552019-03-20 11:18:58 +0100328 virtual PeerConfigurer* SetRTCConfiguration(
329 PeerConnectionInterface::RTCConfiguration configuration) = 0;
Artem Titov85a9d912019-05-29 14:36:50 +0200330 // Set bitrate parameters on PeerConnection. This constraints will be
331 // applied to all summed RTP streams for this peer.
332 virtual PeerConfigurer* SetBitrateParameters(
333 PeerConnectionInterface::BitrateParameters bitrate_params) = 0;
Artem Titovd09bc552019-03-20 11:18:58 +0100334 };
335
Artem Titov728a0ee2019-08-20 13:36:35 +0200336 // Contains configuration for echo emulator.
337 struct EchoEmulationConfig {
338 // Delay which represents the echo path delay, i.e. how soon rendered signal
339 // should reach capturer.
Danil Chapovalov0c626af2020-02-10 11:16:00 +0100340 TimeDelta echo_delay = TimeDelta::Millis(50);
Artem Titov728a0ee2019-08-20 13:36:35 +0200341 };
342
Artem Titov9fbe9ae2020-01-20 11:53:26 +0100343 struct VideoCodecConfig {
344 explicit VideoCodecConfig(std::string name)
345 : name(std::move(name)), required_params() {}
346 VideoCodecConfig(std::string name,
347 std::map<std::string, std::string> required_params)
348 : name(std::move(name)), required_params(std::move(required_params)) {}
349 // Next two fields are used to specify concrete video codec, that should be
350 // used in the test. Video code will be negotiated in SDP during offer/
351 // answer exchange.
352 // Video codec name. You can find valid names in
353 // media/base/media_constants.h
354 std::string name = cricket::kVp8CodecName;
355 // Map of parameters, that have to be specified on SDP codec. Each parameter
356 // is described by key and value. Codec parameters will match the specified
357 // map if and only if for each key from |required_params| there will be
358 // a parameter with name equal to this key and parameter value will be equal
359 // to the value from |required_params| for this key.
360 // If empty then only name will be used to match the codec.
361 std::map<std::string, std::string> required_params;
362 };
363
Artem Titova6a273d2019-02-07 16:43:51 +0100364 // Contains parameters, that describe how long framework should run quality
365 // test.
366 struct RunParams {
Artem Titovade945d2019-04-02 18:31:48 +0200367 explicit RunParams(TimeDelta run_duration) : run_duration(run_duration) {}
368
Artem Titova6a273d2019-02-07 16:43:51 +0100369 // Specifies how long the test should be run. This time shows how long
370 // the media should flow after connection was established and before
371 // it will be shut downed.
372 TimeDelta run_duration;
Artem Titovade945d2019-04-02 18:31:48 +0200373
Artem Titov9fbe9ae2020-01-20 11:53:26 +0100374 // List of video codecs to use during the test. These codecs will be
375 // negotiated in SDP during offer/answer exchange. The order of these codecs
376 // during negotiation will be the same as in |video_codecs|. Codecs have
377 // to be available in codecs list provided by peer connection to be
378 // negotiated. If some of specified codecs won't be found, the test will
379 // crash.
Artem Titov80a82f12020-02-12 16:28:14 +0100380 // If list is empty Vp8 with no required_params will be used.
Artem Titov9fbe9ae2020-01-20 11:53:26 +0100381 std::vector<VideoCodecConfig> video_codecs;
Artem Titovf65a89b2019-05-07 11:56:44 +0200382 bool use_ulp_fec = false;
383 bool use_flex_fec = false;
Artem Titovade945d2019-04-02 18:31:48 +0200384 // Specifies how much video encoder target bitrate should be different than
385 // target bitrate, provided by WebRTC stack. Must be greater then 0. Can be
386 // used to emulate overshooting of video encoders. This multiplier will
387 // be applied for all video encoder on both sides for all layers. Bitrate
388 // estimated by WebRTC stack will be multiplied on this multiplier and then
Erik Språng16cb8f52019-04-12 13:59:09 +0200389 // provided into VideoEncoder::SetRates(...).
Artem Titovade945d2019-04-02 18:31:48 +0200390 double video_encoder_bitrate_multiplier = 1.0;
Artem Titov39483c62019-07-19 17:03:52 +0200391 // If true will set conference mode in SDP media section for all video
392 // tracks for all peers.
393 bool use_conference_mode = false;
Artem Titov728a0ee2019-08-20 13:36:35 +0200394 // If specified echo emulation will be done, by mixing the render audio into
395 // the capture signal. In such case input signal will be reduced by half to
396 // avoid saturation or compression in the echo path simulation.
397 absl::optional<EchoEmulationConfig> echo_emulation_config;
Artem Titova6a273d2019-02-07 16:43:51 +0100398 };
399
Artem Titov18459222019-04-24 11:09:35 +0200400 // Represent an entity that will report quality metrics after test.
Artem Titova8549212019-08-19 14:38:06 +0200401 class QualityMetricsReporter : public StatsObserverInterface {
Artem Titov18459222019-04-24 11:09:35 +0200402 public:
403 virtual ~QualityMetricsReporter() = default;
404
405 // Invoked by framework after peer connection factory and peer connection
406 // itself will be created but before offer/answer exchange will be started.
407 virtual void Start(absl::string_view test_case_name) = 0;
408
409 // Invoked by framework after call is ended and peer connection factory and
410 // peer connection are destroyed.
411 virtual void StopAndReportResults() = 0;
412 };
413
Artem Titovd09bc552019-03-20 11:18:58 +0100414 virtual ~PeerConnectionE2EQualityTestFixture() = default;
415
Artem Titovba82e002019-03-15 15:57:53 +0100416 // Add activity that will be executed on the best effort at least after
417 // |target_time_since_start| after call will be set up (after offer/answer
418 // exchange, ICE gathering will be done and ICE candidates will passed to
419 // remote side). |func| param is amount of time spent from the call set up.
420 virtual void ExecuteAt(TimeDelta target_time_since_start,
421 std::function<void(TimeDelta)> func) = 0;
422 // Add activity that will be executed every |interval| with first execution
423 // on the best effort at least after |initial_delay_since_start| after call
424 // will be set up (after all participants will be connected). |func| param is
425 // amount of time spent from the call set up.
426 virtual void ExecuteEvery(TimeDelta initial_delay_since_start,
427 TimeDelta interval,
428 std::function<void(TimeDelta)> func) = 0;
429
Artem Titov18459222019-04-24 11:09:35 +0200430 // Add stats reporter entity to observe the test.
431 virtual void AddQualityMetricsReporter(
432 std::unique_ptr<QualityMetricsReporter> quality_metrics_reporter) = 0;
433
Artem Titovd09bc552019-03-20 11:18:58 +0100434 // Add a new peer to the call and return an object through which caller
435 // can configure peer's behavior.
436 // |network_thread| will be used as network thread for peer's peer connection
437 // |network_manager| will be used to provide network interfaces for peer's
438 // peer connection.
439 // |configurer| function will be used to configure peer in the call.
440 virtual void AddPeer(rtc::Thread* network_thread,
441 rtc::NetworkManager* network_manager,
442 rtc::FunctionView<void(PeerConfigurer*)> configurer) = 0;
443 virtual void Run(RunParams run_params) = 0;
Artem Titovb93c4e62019-05-02 10:52:07 +0200444
445 // Returns real test duration - the time of test execution measured during
446 // test. Client must call this method only after test is finished (after
447 // Run(...) method returned). Test execution time is time from end of call
448 // setup (offer/answer, ICE candidates exchange done and ICE connected) to
449 // start of call tear down (PeerConnection closed).
450 virtual TimeDelta GetRealTestDuration() const = 0;
Artem Titovb6c62012019-01-08 14:58:23 +0100451};
452
Artem Titov0b443142019-03-20 11:11:08 +0100453} // namespace webrtc_pc_e2e
Artem Titovb6c62012019-01-08 14:58:23 +0100454} // namespace webrtc
455
Artem Titovd57628f2019-03-22 12:34:25 +0100456#endif // API_TEST_PEERCONNECTION_QUALITY_TEST_FIXTURE_H_