blob: 2741ebf95edc8f5ad0619be125f9e9d9a045b672 [file] [log] [blame]
pbos@webrtc.org744fbc72013-09-10 09:26:25 +00001/*
2 * Copyright (c) 2013 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 */
pbos@webrtc.org744fbc72013-09-10 09:26:25 +000010
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "call/rampup_tests.h"
stefanff483612015-12-21 03:14:00 -080012
Danil Chapovalov304ea5f2019-04-11 15:18:18 +020013#include <memory>
14
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020015#include "absl/flags/flag.h"
Danil Chapovalov4ba04b72019-06-26 15:49:47 +020016#include "api/rtc_event_log/rtc_event_log_factory.h"
Niels Möllerd8b9ed72019-05-08 13:53:51 +020017#include "api/rtc_event_log_output_file.h"
Danil Chapovalov304ea5f2019-04-11 15:18:18 +020018#include "api/task_queue/default_task_queue_factory.h"
Danil Chapovalov44db4362019-09-30 04:16:28 +020019#include "api/task_queue/task_queue_base.h"
Danil Chapovalov304ea5f2019-04-11 15:18:18 +020020#include "api/task_queue/task_queue_factory.h"
Artem Titov4e199e92018-08-20 13:30:39 +020021#include "call/fake_network_pipe.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020022#include "rtc_base/checks.h"
23#include "rtc_base/logging.h"
24#include "rtc_base/platform_thread.h"
Steve Anton10542f22019-01-11 09:11:00 -080025#include "rtc_base/string_encode.h"
Danil Chapovalov82a3f0a2019-10-21 09:24:27 +020026#include "rtc_base/task_queue_for_test.h"
Tommi6b117a52019-08-20 09:58:56 +020027#include "rtc_base/time_utils.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020028#include "test/encoder_settings.h"
Per Kjellander914351d2019-02-15 10:54:55 +010029#include "test/field_trial.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020030#include "test/gtest.h"
31#include "test/testsupport/perf_test.h"
pbos@webrtc.org744fbc72013-09-10 09:26:25 +000032
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020033ABSL_FLAG(std::string,
34 ramp_dump_name,
35 "",
36 "Filename for dumped received RTP stream.");
37
pbos@webrtc.org744fbc72013-09-10 09:26:25 +000038namespace webrtc {
pbos@webrtc.org29023282013-09-11 10:14:56 +000039namespace {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000040
Stefan Holmer723dff12015-10-05 14:59:41 +020041static const int64_t kPollIntervalMs = 20;
philipel5ef2bc12017-02-21 07:28:31 -080042static const int kExpectedHighVideoBitrateBps = 80000;
stefandb752f92016-12-05 08:23:40 -080043static const int kExpectedHighAudioBitrateBps = 30000;
44static const int kLowBandwidthLimitBps = 20000;
Sebastian Jansson12fb1702018-02-23 11:34:18 +010045// Set target detected bitrate to slightly larger than the target bitrate to
46// avoid flakiness.
47static const int kLowBitrateMarginBps = 2000;
pbos@webrtc.org29023282013-09-11 10:14:56 +000048
stefanff483612015-12-21 03:14:00 -080049std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000050 std::vector<uint32_t> ssrcs;
51 for (size_t i = 0; i != num_streams; ++i)
52 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i));
53 return ssrcs;
54}
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +000055} // namespace
henrik.lundin@webrtc.org845862f2014-03-06 07:19:28 +000056
Yves Gerey6516f762019-08-29 11:50:23 +020057RampUpTester::RampUpTester(
58 size_t num_video_streams,
59 size_t num_audio_streams,
60 size_t num_flexfec_streams,
61 unsigned int start_bitrate_bps,
62 int64_t min_run_time_ms,
63 const std::string& extension_type,
64 bool rtx,
65 bool red,
66 bool report_perf_stats,
67 test::DEPRECATED_SingleThreadedTaskQueueForTesting* task_queue)
stefan4fbd1452015-09-28 03:57:14 -070068 : EndToEndTest(test::CallTest::kLongTimeoutMs),
stefan4fbd1452015-09-28 03:57:14 -070069 clock_(Clock::GetRealTimeClock()),
stefanff483612015-12-21 03:14:00 -080070 num_video_streams_(num_video_streams),
71 num_audio_streams_(num_audio_streams),
philipel5ef2bc12017-02-21 07:28:31 -080072 num_flexfec_streams_(num_flexfec_streams),
stefan4fbd1452015-09-28 03:57:14 -070073 rtx_(rtx),
74 red_(red),
stefan45b5fe52017-03-09 06:27:02 -080075 report_perf_stats_(report_perf_stats),
mflodman86cc6ff2016-07-26 04:44:06 -070076 sender_call_(nullptr),
stefan4fbd1452015-09-28 03:57:14 -070077 send_stream_(nullptr),
sprang4847ae62017-06-27 07:06:52 -070078 send_transport_(nullptr),
Artem Titov631cafa2018-08-21 21:01:00 +020079 send_simulated_network_(nullptr),
stefan4fbd1452015-09-28 03:57:14 -070080 start_bitrate_bps_(start_bitrate_bps),
stefan5a2c5062017-01-27 06:43:18 -080081 min_run_time_ms_(min_run_time_ms),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000082 expected_bitrate_bps_(0),
Erik Språngf3a7c9d2015-10-05 14:03:22 +020083 test_start_ms_(-1),
stefan4fbd1452015-09-28 03:57:14 -070084 ramp_up_finished_ms_(-1),
85 extension_type_(extension_type),
stefanff483612015-12-21 03:14:00 -080086 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)),
87 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)),
88 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)),
Tommi5e005f42019-08-05 15:29:14 +020089 task_queue_(task_queue) {
philipel5ef2bc12017-02-21 07:28:31 -080090 if (red_)
91 EXPECT_EQ(0u, num_flexfec_streams_);
Stefan Holmerff2a6352016-01-14 10:00:21 +010092 EXPECT_LE(num_audio_streams_, 1u);
stefan4fbd1452015-09-28 03:57:14 -070093}
94
Tommi5e005f42019-08-05 15:29:14 +020095RampUpTester::~RampUpTester() {
96 // Special case for WebRTC-QuickPerfTest/Enabled/
Danil Chapovalov82a3f0a2019-10-21 09:24:27 +020097 SendTask(RTC_FROM_HERE, task_queue_, [this]() {
Tommi5e005f42019-08-05 15:29:14 +020098 if (pending_task_ !=
Yves Gerey6516f762019-08-29 11:50:23 +020099 static_cast<test::DEPRECATED_SingleThreadedTaskQueueForTesting::TaskId>(
100 -1)) {
Tommi5e005f42019-08-05 15:29:14 +0200101 task_queue_->CancelTask(pending_task_);
102 pending_task_ = -1;
103 }
104 });
105}
stefan4fbd1452015-09-28 03:57:14 -0700106
Niels Möllerde8e6e62018-11-13 15:10:33 +0100107void RampUpTester::ModifySenderBitrateConfig(
108 BitrateConstraints* bitrate_config) {
stefan4fbd1452015-09-28 03:57:14 -0700109 if (start_bitrate_bps_ != 0) {
Niels Möllerde8e6e62018-11-13 15:10:33 +0100110 bitrate_config->start_bitrate_bps = start_bitrate_bps_;
stefan4fbd1452015-09-28 03:57:14 -0700111 }
Niels Möllerde8e6e62018-11-13 15:10:33 +0100112 bitrate_config->min_bitrate_bps = 10000;
stefan4fbd1452015-09-28 03:57:14 -0700113}
114
stefanff483612015-12-21 03:14:00 -0800115void RampUpTester::OnVideoStreamsCreated(
stefan4fbd1452015-09-28 03:57:14 -0700116 VideoSendStream* send_stream,
117 const std::vector<VideoReceiveStream*>& receive_streams) {
118 send_stream_ = send_stream;
119}
120
Danil Chapovalov44db4362019-09-30 04:16:28 +0200121std::unique_ptr<test::PacketTransport> RampUpTester::CreateSendTransport(
122 TaskQueueBase* task_queue,
eladalon413ee9a2017-08-22 04:02:52 -0700123 Call* sender_call) {
Mirko Bonadei317a1f02019-09-17 17:06:18 +0200124 auto network = std::make_unique<SimulatedNetwork>(forward_transport_config_);
Artem Titov631cafa2018-08-21 21:01:00 +0200125 send_simulated_network_ = network.get();
Danil Chapovalov44db4362019-09-30 04:16:28 +0200126 auto send_transport = std::make_unique<test::PacketTransport>(
eladalon413ee9a2017-08-22 04:02:52 -0700127 task_queue, sender_call, this, test::PacketTransport::kSender,
Artem Titov4e199e92018-08-20 13:30:39 +0200128 test::CallTest::payload_type_map_,
Mirko Bonadei317a1f02019-09-17 17:06:18 +0200129 std::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
130 std::move(network)));
Danil Chapovalov44db4362019-09-30 04:16:28 +0200131 send_transport_ = send_transport.get();
132 return send_transport;
stefanf116bd02015-10-27 08:29:42 -0700133}
134
Stefan Holmerd20e6512016-01-12 15:51:22 +0100135size_t RampUpTester::GetNumVideoStreams() const {
136 return num_video_streams_;
137}
138
Stefan Holmerff2a6352016-01-14 10:00:21 +0100139size_t RampUpTester::GetNumAudioStreams() const {
140 return num_audio_streams_;
141}
142
philipel5ef2bc12017-02-21 07:28:31 -0800143size_t RampUpTester::GetNumFlexfecStreams() const {
144 return num_flexfec_streams_;
145}
146
perkjfa10b552016-10-02 23:45:26 -0700147class RampUpTester::VideoStreamFactory
148 : public VideoEncoderConfig::VideoStreamFactoryInterface {
149 public:
150 VideoStreamFactory() {}
151
152 private:
153 std::vector<VideoStream> CreateEncoderStreams(
154 int width,
155 int height,
156 const VideoEncoderConfig& encoder_config) override {
157 std::vector<VideoStream> streams =
158 test::CreateVideoStreams(width, height, encoder_config);
159 if (encoder_config.number_of_streams == 1) {
160 streams[0].target_bitrate_bps = streams[0].max_bitrate_bps = 2000000;
161 }
162 return streams;
163 }
164};
165
stefanff483612015-12-21 03:14:00 -0800166void RampUpTester::ModifyVideoConfigs(
stefan4fbd1452015-09-28 03:57:14 -0700167 VideoSendStream::Config* send_config,
168 std::vector<VideoReceiveStream::Config>* receive_configs,
169 VideoEncoderConfig* encoder_config) {
170 send_config->suspend_below_min_bitrate = true;
perkjfa10b552016-10-02 23:45:26 -0700171 encoder_config->number_of_streams = num_video_streams_;
172 encoder_config->max_bitrate_bps = 2000000;
173 encoder_config->video_stream_factory =
174 new rtc::RefCountedObject<RampUpTester::VideoStreamFactory>();
stefanff483612015-12-21 03:14:00 -0800175 if (num_video_streams_ == 1) {
stefan4fbd1452015-09-28 03:57:14 -0700176 // For single stream rampup until 1mbps
177 expected_bitrate_bps_ = kSingleStreamTargetBps;
178 } else {
Ilya Nikolaevskiyb0588e62018-08-27 14:12:27 +0200179 // To ensure simulcast rate allocation.
180 send_config->rtp.payload_name = "VP8";
181 encoder_config->codec_type = kVideoCodecVP8;
perkjfa10b552016-10-02 23:45:26 -0700182 std::vector<VideoStream> streams = test::CreateVideoStreams(
183 test::CallTest::kDefaultWidth, test::CallTest::kDefaultHeight,
184 *encoder_config);
Ilya Nikolaevskiyb0588e62018-08-27 14:12:27 +0200185 // For multi stream rampup until all streams are being sent. That means
186 // enough bitrate to send all the target streams plus the min bitrate of
187 // the last one.
perkjfa10b552016-10-02 23:45:26 -0700188 expected_bitrate_bps_ = streams.back().min_bitrate_bps;
189 for (size_t i = 0; i < streams.size() - 1; ++i) {
190 expected_bitrate_bps_ += streams[i].target_bitrate_bps;
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000191 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000192 }
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000193
stefan4fbd1452015-09-28 03:57:14 -0700194 send_config->rtp.extensions.clear();
195
196 bool remb;
stefan43edf0f2015-11-20 18:05:48 -0800197 bool transport_cc;
isheriff6f8d6862016-05-26 11:24:55 -0700198 if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
stefan4fbd1452015-09-28 03:57:14 -0700199 remb = true;
stefan43edf0f2015-11-20 18:05:48 -0800200 transport_cc = false;
stefan4fbd1452015-09-28 03:57:14 -0700201 send_config->rtp.extensions.push_back(
202 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
isheriff6f8d6862016-05-26 11:24:55 -0700203 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
stefan4fbd1452015-09-28 03:57:14 -0700204 remb = false;
stefan43edf0f2015-11-20 18:05:48 -0800205 transport_cc = true;
stefan4fbd1452015-09-28 03:57:14 -0700206 send_config->rtp.extensions.push_back(RtpExtension(
207 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000208 } else {
stefan4fbd1452015-09-28 03:57:14 -0700209 remb = true;
stefan43edf0f2015-11-20 18:05:48 -0800210 transport_cc = false;
stefan4fbd1452015-09-28 03:57:14 -0700211 send_config->rtp.extensions.push_back(RtpExtension(
212 extension_type_.c_str(), kTransmissionTimeOffsetExtensionId));
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000213 }
stefan4fbd1452015-09-28 03:57:14 -0700214
215 send_config->rtp.nack.rtp_history_ms = test::CallTest::kNackRtpHistoryMs;
stefanff483612015-12-21 03:14:00 -0800216 send_config->rtp.ssrcs = video_ssrcs_;
stefan4fbd1452015-09-28 03:57:14 -0700217 if (rtx_) {
218 send_config->rtp.rtx.payload_type = test::CallTest::kSendRtxPayloadType;
stefanff483612015-12-21 03:14:00 -0800219 send_config->rtp.rtx.ssrcs = video_rtx_ssrcs_;
stefan4fbd1452015-09-28 03:57:14 -0700220 }
221 if (red_) {
brandtrb5f2c3f2016-10-04 23:28:39 -0700222 send_config->rtp.ulpfec.ulpfec_payload_type =
stefan4fbd1452015-09-28 03:57:14 -0700223 test::CallTest::kUlpfecPayloadType;
brandtrb5f2c3f2016-10-04 23:28:39 -0700224 send_config->rtp.ulpfec.red_payload_type = test::CallTest::kRedPayloadType;
brandtrfbfb5362016-11-17 04:18:37 -0800225 if (rtx_) {
226 send_config->rtp.ulpfec.red_rtx_payload_type =
227 test::CallTest::kRtxRedPayloadType;
228 }
stefan4fbd1452015-09-28 03:57:14 -0700229 }
230
231 size_t i = 0;
232 for (VideoReceiveStream::Config& recv_config : *receive_configs) {
stefan43edf0f2015-11-20 18:05:48 -0800233 recv_config.rtp.transport_cc = transport_cc;
stefan4fbd1452015-09-28 03:57:14 -0700234 recv_config.rtp.extensions = send_config->rtp.extensions;
Ilya Nikolaevskiyb0588e62018-08-27 14:12:27 +0200235 recv_config.decoders.reserve(1);
236 recv_config.decoders[0].payload_type = send_config->rtp.payload_type;
Niels Möllercb7e1d22018-09-11 15:56:04 +0200237 recv_config.decoders[0].video_format =
238 SdpVideoFormat(send_config->rtp.payload_name);
stefan4fbd1452015-09-28 03:57:14 -0700239
stefanff483612015-12-21 03:14:00 -0800240 recv_config.rtp.remote_ssrc = video_ssrcs_[i];
stefan4fbd1452015-09-28 03:57:14 -0700241 recv_config.rtp.nack.rtp_history_ms = send_config->rtp.nack.rtp_history_ms;
242
243 if (red_) {
nisse3b3622f2017-09-26 02:49:21 -0700244 recv_config.rtp.red_payload_type =
brandtrb5f2c3f2016-10-04 23:28:39 -0700245 send_config->rtp.ulpfec.red_payload_type;
nisse3b3622f2017-09-26 02:49:21 -0700246 recv_config.rtp.ulpfec_payload_type =
brandtrb5f2c3f2016-10-04 23:28:39 -0700247 send_config->rtp.ulpfec.ulpfec_payload_type;
brandtrfbfb5362016-11-17 04:18:37 -0800248 if (rtx_) {
nisseca5706d2017-09-11 02:32:16 -0700249 recv_config.rtp.rtx_associated_payload_types
250 [send_config->rtp.ulpfec.red_rtx_payload_type] =
251 send_config->rtp.ulpfec.red_payload_type;
brandtrfbfb5362016-11-17 04:18:37 -0800252 }
stefan4fbd1452015-09-28 03:57:14 -0700253 }
254
255 if (rtx_) {
brandtr14742122017-01-27 04:53:07 -0800256 recv_config.rtp.rtx_ssrc = video_rtx_ssrcs_[i];
257 recv_config.rtp
nisse26e3abb2017-08-25 04:44:25 -0700258 .rtx_associated_payload_types[send_config->rtp.rtx.payload_type] =
Niels Möller259a4972018-04-05 15:36:51 +0200259 send_config->rtp.payload_type;
stefan4fbd1452015-09-28 03:57:14 -0700260 }
261 ++i;
262 }
philipel5ef2bc12017-02-21 07:28:31 -0800263
264 RTC_DCHECK_LE(num_flexfec_streams_, 1);
265 if (num_flexfec_streams_ == 1) {
266 send_config->rtp.flexfec.payload_type = test::CallTest::kFlexfecPayloadType;
267 send_config->rtp.flexfec.ssrc = test::CallTest::kFlexfecSendSsrc;
268 send_config->rtp.flexfec.protected_media_ssrcs = {video_ssrcs_[0]};
269 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000270}
271
Stefan Holmerff2a6352016-01-14 10:00:21 +0100272void RampUpTester::ModifyAudioConfigs(
273 AudioSendStream::Config* send_config,
274 std::vector<AudioReceiveStream::Config>* receive_configs) {
275 if (num_audio_streams_ == 0)
276 return;
277
isheriff6f8d6862016-05-26 11:24:55 -0700278 EXPECT_NE(RtpExtension::kTimestampOffsetUri, extension_type_)
Stefan Holmerff2a6352016-01-14 10:00:21 +0100279 << "Audio BWE not supported with toffset.";
philipel5ef2bc12017-02-21 07:28:31 -0800280 EXPECT_NE(RtpExtension::kAbsSendTimeUri, extension_type_)
281 << "Audio BWE not supported with abs-send-time.";
Stefan Holmerff2a6352016-01-14 10:00:21 +0100282
283 send_config->rtp.ssrc = audio_ssrcs_[0];
284 send_config->rtp.extensions.clear();
285
minyue10cbb462016-11-07 09:29:22 -0800286 send_config->min_bitrate_bps = 6000;
287 send_config->max_bitrate_bps = 60000;
mflodman86cc6ff2016-07-26 04:44:06 -0700288
Stefan Holmerff2a6352016-01-14 10:00:21 +0100289 bool transport_cc = false;
philipel5ef2bc12017-02-21 07:28:31 -0800290 if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
Stefan Holmerff2a6352016-01-14 10:00:21 +0100291 transport_cc = true;
292 send_config->rtp.extensions.push_back(RtpExtension(
293 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
294 }
295
296 for (AudioReceiveStream::Config& recv_config : *receive_configs) {
Stefan Holmerff2a6352016-01-14 10:00:21 +0100297 recv_config.rtp.transport_cc = transport_cc;
298 recv_config.rtp.extensions = send_config->rtp.extensions;
299 recv_config.rtp.remote_ssrc = send_config->rtp.ssrc;
300 }
301}
302
philipel5ef2bc12017-02-21 07:28:31 -0800303void RampUpTester::ModifyFlexfecConfigs(
304 std::vector<FlexfecReceiveStream::Config>* receive_configs) {
305 if (num_flexfec_streams_ == 0)
306 return;
307 RTC_DCHECK_EQ(1, num_flexfec_streams_);
308 (*receive_configs)[0].payload_type = test::CallTest::kFlexfecPayloadType;
309 (*receive_configs)[0].remote_ssrc = test::CallTest::kFlexfecSendSsrc;
310 (*receive_configs)[0].protected_media_ssrcs = {video_ssrcs_[0]};
311 (*receive_configs)[0].local_ssrc = video_ssrcs_[0];
312 if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
313 (*receive_configs)[0].transport_cc = false;
314 (*receive_configs)[0].rtp_header_extensions.push_back(
315 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
316 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
317 (*receive_configs)[0].transport_cc = true;
318 (*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension(
319 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
320 }
321}
322
stefan4fbd1452015-09-28 03:57:14 -0700323void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
Tommi5e005f42019-08-05 15:29:14 +0200324 RTC_DCHECK(sender_call);
stefan4fbd1452015-09-28 03:57:14 -0700325 sender_call_ = sender_call;
Tommi5e005f42019-08-05 15:29:14 +0200326 pending_task_ = task_queue_->PostTask([this]() { PollStats(); });
pbos@webrtc.org32452b22014-10-22 12:15:24 +0000327}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000328
tommi0f8b4032017-02-22 11:22:05 -0800329void RampUpTester::PollStats() {
Tommi6b117a52019-08-20 09:58:56 +0200330 RTC_DCHECK_RUN_ON(task_queue_);
331
332 EnsurePollTimeSet();
333
Tommi5e005f42019-08-05 15:29:14 +0200334 pending_task_ = -1;
335 Call::Stats stats = sender_call_->GetStats();
336 EXPECT_GE(expected_bitrate_bps_, 0);
stefan4fbd1452015-09-28 03:57:14 -0700337
Tommi5e005f42019-08-05 15:29:14 +0200338 if (stats.send_bandwidth_bps >= expected_bitrate_bps_ &&
339 (min_run_time_ms_ == -1 ||
340 clock_->TimeInMilliseconds() - test_start_ms_ >= min_run_time_ms_)) {
341 ramp_up_finished_ms_ = clock_->TimeInMilliseconds();
342 observation_complete_.Set();
343 } else {
344 pending_task_ = task_queue_->PostDelayedTask([this]() { PollStats(); },
Tommi6b117a52019-08-20 09:58:56 +0200345 GetIntervalForNextPoll());
Tommi5e005f42019-08-05 15:29:14 +0200346 }
Erik Språng468e62a2015-07-06 10:50:47 +0200347}
348
stefan4fbd1452015-09-28 03:57:14 -0700349void RampUpTester::ReportResult(const std::string& measurement,
350 size_t value,
351 const std::string& units) const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000352 webrtc::test::PrintResult(
353 measurement, "",
stefanff483612015-12-21 03:14:00 -0800354 ::testing::UnitTest::GetInstance()->current_test_info()->name(), value,
355 units, false);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000356}
357
stefan092508a2015-09-29 02:26:42 -0700358void RampUpTester::AccumulateStats(const VideoSendStream::StreamStats& stream,
359 size_t* total_packets_sent,
360 size_t* total_sent,
361 size_t* padding_sent,
362 size_t* media_sent) const {
stefan4fbd1452015-09-28 03:57:14 -0700363 *total_packets_sent += stream.rtp_stats.transmitted.packets +
364 stream.rtp_stats.retransmitted.packets +
365 stream.rtp_stats.fec.packets;
366 *total_sent += stream.rtp_stats.transmitted.TotalBytes() +
367 stream.rtp_stats.retransmitted.TotalBytes() +
368 stream.rtp_stats.fec.TotalBytes();
369 *padding_sent += stream.rtp_stats.transmitted.padding_bytes +
370 stream.rtp_stats.retransmitted.padding_bytes +
371 stream.rtp_stats.fec.padding_bytes;
372 *media_sent += stream.rtp_stats.MediaPayloadBytes();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000373}
374
stefan4fbd1452015-09-28 03:57:14 -0700375void RampUpTester::TriggerTestDone() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200376 RTC_DCHECK_GE(test_start_ms_, 0);
377
Stefan Holmerff2a6352016-01-14 10:00:21 +0100378 // TODO(holmer): Add audio send stats here too when those APIs are available.
mflodman86cc6ff2016-07-26 04:44:06 -0700379 if (!send_stream_)
380 return;
381
Tommi5e005f42019-08-05 15:29:14 +0200382 // Stop polling stats.
383 // Corner case for field_trials=WebRTC-QuickPerfTest/Enabled/
Danil Chapovalov82a3f0a2019-10-21 09:24:27 +0200384 SendTask(RTC_FROM_HERE, task_queue_, [this]() {
Tommi5e005f42019-08-05 15:29:14 +0200385 if (pending_task_ !=
Yves Gerey6516f762019-08-29 11:50:23 +0200386 static_cast<test::DEPRECATED_SingleThreadedTaskQueueForTesting::TaskId>(
387 -1)) {
Tommi5e005f42019-08-05 15:29:14 +0200388 task_queue_->CancelTask(pending_task_);
389 pending_task_ = -1;
390 }
391 });
392
stefan4fbd1452015-09-28 03:57:14 -0700393 VideoSendStream::Stats send_stats = send_stream_->GetStats();
Tommi5e005f42019-08-05 15:29:14 +0200394 send_stream_ = nullptr; // To avoid dereferencing a bad pointer.
stefan4fbd1452015-09-28 03:57:14 -0700395
396 size_t total_packets_sent = 0;
397 size_t total_sent = 0;
398 size_t padding_sent = 0;
399 size_t media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800400 for (uint32_t ssrc : video_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700401 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent,
402 &total_sent, &padding_sent, &media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700403 }
404
405 size_t rtx_total_packets_sent = 0;
406 size_t rtx_total_sent = 0;
407 size_t rtx_padding_sent = 0;
408 size_t rtx_media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800409 for (uint32_t rtx_ssrc : video_rtx_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700410 AccumulateStats(send_stats.substreams[rtx_ssrc], &rtx_total_packets_sent,
411 &rtx_total_sent, &rtx_padding_sent, &rtx_media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700412 }
413
stefan5a2c5062017-01-27 06:43:18 -0800414 if (report_perf_stats_) {
stefan5a2c5062017-01-27 06:43:18 -0800415 ReportResult("ramp-up-media-sent", media_sent, "bytes");
416 ReportResult("ramp-up-padding-sent", padding_sent, "bytes");
stefan5a2c5062017-01-27 06:43:18 -0800417 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes");
418 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes");
419 if (ramp_up_finished_ms_ >= 0) {
420 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_,
421 "milliseconds");
422 }
423 ReportResult("ramp-up-average-network-latency",
424 send_transport_->GetAverageDelayMs(), "milliseconds");
stefan4fbd1452015-09-28 03:57:14 -0700425 }
426}
427
428void RampUpTester::PerformTest() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200429 test_start_ms_ = clock_->TimeInMilliseconds();
Peter Boström5811a392015-12-10 13:02:50 +0100430 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete.";
stefan4fbd1452015-09-28 03:57:14 -0700431 TriggerTestDone();
432}
433
Tommi6b117a52019-08-20 09:58:56 +0200434void RampUpTester::EnsurePollTimeSet() {
435 RTC_DCHECK_RUN_ON(task_queue_);
436 if (!next_scheduled_poll_time_ms_)
437 next_scheduled_poll_time_ms_ = rtc::TimeMillis();
438}
439
440int64_t RampUpTester::GetIntervalForNextPoll() {
441 RTC_DCHECK_RUN_ON(task_queue_);
442 RTC_DCHECK_NE(next_scheduled_poll_time_ms_, 0)
443 << "No call to EnsurePollTimeSet()";
444 auto now = rtc::TimeMillis();
445 next_scheduled_poll_time_ms_ += kPollIntervalMs;
446 auto interval = next_scheduled_poll_time_ms_ - now;
447 return interval > 0 ? interval : 0;
448}
449
Tommi5e005f42019-08-05 15:29:14 +0200450RampUpDownUpTester::RampUpDownUpTester(
451 size_t num_video_streams,
452 size_t num_audio_streams,
453 size_t num_flexfec_streams,
454 unsigned int start_bitrate_bps,
455 const std::string& extension_type,
456 bool rtx,
457 bool red,
458 const std::vector<int>& loss_rates,
459 bool report_perf_stats,
Yves Gerey6516f762019-08-29 11:50:23 +0200460 test::DEPRECATED_SingleThreadedTaskQueueForTesting* task_queue)
Stefan Holmerff2a6352016-01-14 10:00:21 +0100461 : RampUpTester(num_video_streams,
462 num_audio_streams,
philipel5ef2bc12017-02-21 07:28:31 -0800463 num_flexfec_streams,
Stefan Holmerff2a6352016-01-14 10:00:21 +0100464 start_bitrate_bps,
stefan5a2c5062017-01-27 06:43:18 -0800465 0,
Stefan Holmerff2a6352016-01-14 10:00:21 +0100466 extension_type,
467 rtx,
stefan5a2c5062017-01-27 06:43:18 -0800468 red,
Tommi5e005f42019-08-05 15:29:14 +0200469 report_perf_stats,
470 task_queue),
stefan76d9c9c2017-04-01 06:51:09 -0700471 link_rates_({4 * GetExpectedHighBitrate() / (3 * 1000),
472 kLowBandwidthLimitBps / 1000,
473 4 * GetExpectedHighBitrate() / (3 * 1000), 0}),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000474 test_state_(kFirstRampup),
philipel5ef2bc12017-02-21 07:28:31 -0800475 next_state_(kTransitionToNextState),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000476 state_start_ms_(clock_->TimeInMilliseconds()),
stefan4fbd1452015-09-28 03:57:14 -0700477 interval_start_ms_(clock_->TimeInMilliseconds()),
philipel5ef2bc12017-02-21 07:28:31 -0800478 sent_bytes_(0),
479 loss_rates_(loss_rates) {
480 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
481 forward_transport_config_.queue_delay_ms = 100;
482 forward_transport_config_.loss_percent = loss_rates_[test_state_];
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000483}
484
stefan4fbd1452015-09-28 03:57:14 -0700485RampUpDownUpTester::~RampUpDownUpTester() {}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000486
tommi0f8b4032017-02-22 11:22:05 -0800487void RampUpDownUpTester::PollStats() {
Tommi6b117a52019-08-20 09:58:56 +0200488 EnsurePollTimeSet();
489
Tommi5e005f42019-08-05 15:29:14 +0200490 pending_task_ = -1;
491 bool last_round = (test_state_ == kTestEnd);
492
493 int transmit_bitrate_bps = 0;
494 bool suspended = false;
495 if (num_video_streams_ > 0 && send_stream_) {
496 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
497 for (const auto& it : stats.substreams) {
498 transmit_bitrate_bps += it.second.total_bitrate_bps;
Alex Narest78609d52017-10-20 10:37:47 +0200499 }
Tommi5e005f42019-08-05 15:29:14 +0200500 suspended = stats.suspended;
501 }
502 if (num_audio_streams_ > 0 && sender_call_) {
503 // An audio send stream doesn't have bitrate stats, so the call send BW is
504 // currently used instead.
505 transmit_bitrate_bps = sender_call_->GetStats().send_bandwidth_bps;
506 }
507
508 EvolveTestState(transmit_bitrate_bps, suspended);
509
510 if (!last_round) {
511 pending_task_ = task_queue_->PostDelayedTask([this]() { PollStats(); },
Tommi6b117a52019-08-20 09:58:56 +0200512 GetIntervalForNextPoll());
Tommi5e005f42019-08-05 15:29:14 +0200513 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000514}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000515
Niels Möllerde8e6e62018-11-13 15:10:33 +0100516void RampUpDownUpTester::ModifyReceiverBitrateConfig(
517 BitrateConstraints* bitrate_config) {
518 bitrate_config->min_bitrate_bps = 10000;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000519}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000520
stefan4fbd1452015-09-28 03:57:14 -0700521std::string RampUpDownUpTester::GetModifierString() const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000522 std::string str("_");
stefanff483612015-12-21 03:14:00 -0800523 if (num_video_streams_ > 0) {
Jonas Olsson0a713b62018-04-04 15:49:32 +0200524 str += rtc::ToString(num_video_streams_);
stefanff483612015-12-21 03:14:00 -0800525 str += "stream";
526 str += (num_video_streams_ > 1 ? "s" : "");
527 str += "_";
528 }
529 if (num_audio_streams_ > 0) {
Jonas Olsson0a713b62018-04-04 15:49:32 +0200530 str += rtc::ToString(num_audio_streams_);
stefanff483612015-12-21 03:14:00 -0800531 str += "stream";
532 str += (num_audio_streams_ > 1 ? "s" : "");
533 str += "_";
534 }
stefan4fbd1452015-09-28 03:57:14 -0700535 str += (rtx_ ? "" : "no");
Edward Lemurdd3987f2018-01-04 19:44:54 +0100536 str += "rtx_";
537 str += (red_ ? "" : "no");
538 str += "red";
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000539 return str;
540}
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000541
stefandb752f92016-12-05 08:23:40 -0800542int RampUpDownUpTester::GetExpectedHighBitrate() const {
stefan38d8b3c2017-01-09 04:19:24 -0800543 int expected_bitrate_bps = 0;
544 if (num_audio_streams_ > 0)
545 expected_bitrate_bps += kExpectedHighAudioBitrateBps;
546 if (num_video_streams_ > 0)
547 expected_bitrate_bps += kExpectedHighVideoBitrateBps;
548 return expected_bitrate_bps;
549}
550
philipel5ef2bc12017-02-21 07:28:31 -0800551size_t RampUpDownUpTester::GetFecBytes() const {
552 size_t flex_fec_bytes = 0;
553 if (num_flexfec_streams_ > 0) {
554 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
555 for (const auto& kv : stats.substreams)
556 flex_fec_bytes += kv.second.rtp_stats.fec.TotalBytes();
557 }
558 return flex_fec_bytes;
559}
560
561bool RampUpDownUpTester::ExpectingFec() const {
562 return num_flexfec_streams_ > 0 && forward_transport_config_.loss_percent > 0;
563}
564
stefan4fbd1452015-09-28 03:57:14 -0700565void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000566 int64_t now = clock_->TimeInMilliseconds();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000567 switch (test_state_) {
philipel5ef2bc12017-02-21 07:28:31 -0800568 case kFirstRampup:
stefan4fbd1452015-09-28 03:57:14 -0700569 EXPECT_FALSE(suspended);
stefandb752f92016-12-05 08:23:40 -0800570 if (bitrate_bps >= GetExpectedHighBitrate()) {
stefan45b5fe52017-03-09 06:27:02 -0800571 if (report_perf_stats_) {
572 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
573 "first_rampup", now - state_start_ms_, "ms",
574 false);
575 }
philipel5ef2bc12017-02-21 07:28:31 -0800576 // Apply loss during the transition between states if FEC is enabled.
577 forward_transport_config_.loss_percent = loss_rates_[test_state_];
578 test_state_ = kTransitionToNextState;
579 next_state_ = kLowRate;
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000580 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000581 break;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000582 case kLowRate: {
mflodman86cc6ff2016-07-26 04:44:06 -0700583 // Audio streams are never suspended.
584 bool check_suspend_state = num_video_streams_ > 0;
Sebastian Jansson12fb1702018-02-23 11:34:18 +0100585 if (bitrate_bps < kLowBandwidthLimitBps + kLowBitrateMarginBps &&
mflodman86cc6ff2016-07-26 04:44:06 -0700586 suspended == check_suspend_state) {
stefan45b5fe52017-03-09 06:27:02 -0800587 if (report_perf_stats_) {
588 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
589 "rampdown", now - state_start_ms_, "ms",
590 false);
591 }
philipel5ef2bc12017-02-21 07:28:31 -0800592 // Apply loss during the transition between states if FEC is enabled.
593 forward_transport_config_.loss_percent = loss_rates_[test_state_];
594 test_state_ = kTransitionToNextState;
595 next_state_ = kSecondRampup;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000596 }
597 break;
598 }
philipel5ef2bc12017-02-21 07:28:31 -0800599 case kSecondRampup:
stefandb752f92016-12-05 08:23:40 -0800600 if (bitrate_bps >= GetExpectedHighBitrate() && !suspended) {
stefan45b5fe52017-03-09 06:27:02 -0800601 if (report_perf_stats_) {
602 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
603 "second_rampup", now - state_start_ms_,
604 "ms", false);
605 ReportResult("ramp-up-down-up-average-network-latency",
606 send_transport_->GetAverageDelayMs(), "milliseconds");
607 }
philipel5ef2bc12017-02-21 07:28:31 -0800608 // Apply loss during the transition between states if FEC is enabled.
609 forward_transport_config_.loss_percent = loss_rates_[test_state_];
610 test_state_ = kTransitionToNextState;
611 next_state_ = kTestEnd;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000612 }
613 break;
philipel5ef2bc12017-02-21 07:28:31 -0800614 case kTestEnd:
615 observation_complete_.Set();
616 break;
617 case kTransitionToNextState:
618 if (!ExpectingFec() || GetFecBytes() > 0) {
619 test_state_ = next_state_;
620 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
621 // No loss while ramping up and down as it may affect the BWE
622 // negatively, making the test flaky.
623 forward_transport_config_.loss_percent = 0;
624 state_start_ms_ = now;
625 interval_start_ms_ = now;
626 sent_bytes_ = 0;
Artem Titov631cafa2018-08-21 21:01:00 +0200627 send_simulated_network_->SetConfig(forward_transport_config_);
philipel5ef2bc12017-02-21 07:28:31 -0800628 }
629 break;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000630 }
631}
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000632
stefan4fbd1452015-09-28 03:57:14 -0700633class RampUpTest : public test::CallTest {
Erik Språng6b8d3552015-09-24 15:06:57 +0200634 public:
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200635 RampUpTest()
636 : task_queue_factory_(CreateDefaultTaskQueueFactory()),
637 rtc_event_log_factory_(task_queue_factory_.get()) {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200638 std::string dump_name(absl::GetFlag(FLAGS_ramp_dump_name));
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200639 if (!dump_name.empty()) {
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200640 send_event_log_ = rtc_event_log_factory_.CreateRtcEventLog(
641 RtcEventLog::EncodingType::Legacy);
642 recv_event_log_ = rtc_event_log_factory_.CreateRtcEventLog(
643 RtcEventLog::EncodingType::Legacy);
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200644 bool event_log_started =
645 send_event_log_->StartLogging(
Mirko Bonadei317a1f02019-09-17 17:06:18 +0200646 std::make_unique<RtcEventLogOutputFile>(
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200647 dump_name + ".send.rtc.dat", RtcEventLog::kUnlimitedOutput),
648 RtcEventLog::kImmediateOutput) &&
649 recv_event_log_->StartLogging(
Mirko Bonadei317a1f02019-09-17 17:06:18 +0200650 std::make_unique<RtcEventLogOutputFile>(
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200651 dump_name + ".recv.rtc.dat", RtcEventLog::kUnlimitedOutput),
652 RtcEventLog::kImmediateOutput);
653 RTC_DCHECK(event_log_started);
654 }
655 }
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200656
657 private:
658 const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
659 RtcEventLogFactory rtc_event_log_factory_;
Erik Språng6b8d3552015-09-24 15:06:57 +0200660};
661
Stefan Holmerff2a6352016-01-14 10:00:21 +0100662static const uint32_t kStartBitrateBps = 60000;
663
stefan38d8b3c2017-01-09 04:19:24 -0800664TEST_F(RampUpTest, UpDownUpAbsSendTimeSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800665 std::vector<int> loss_rates = {0, 0, 0, 0};
666 RampUpDownUpTester test(3, 0, 0, kStartBitrateBps,
stefan45b5fe52017-03-09 06:27:02 -0800667 RtpExtension::kAbsSendTimeUri, true, true, loss_rates,
Tommi5e005f42019-08-05 15:29:14 +0200668 true, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800669 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800670}
Stefan Holmerff2a6352016-01-14 10:00:21 +0100671
Taylor Brandstetterba6b5032018-02-16 09:59:56 -0800672// TODO(bugs.webrtc.org/8878)
673#if defined(WEBRTC_MAC)
674#define MAYBE_UpDownUpTransportSequenceNumberRtx \
675 DISABLED_UpDownUpTransportSequenceNumberRtx
676#else
677#define MAYBE_UpDownUpTransportSequenceNumberRtx \
678 UpDownUpTransportSequenceNumberRtx
679#endif
680TEST_F(RampUpTest, MAYBE_UpDownUpTransportSequenceNumberRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800681 std::vector<int> loss_rates = {0, 0, 0, 0};
682 RampUpDownUpTester test(3, 0, 0, kStartBitrateBps,
isheriff6f8d6862016-05-26 11:24:55 -0700683 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200684 false, loss_rates, true, &task_queue_);
philipel5ef2bc12017-02-21 07:28:31 -0800685 RunBaseTest(&test);
686}
687
stefan45b5fe52017-03-09 06:27:02 -0800688// TODO(holmer): Tests which don't report perf stats should be moved to a
689// different executable since they per definition are not perf tests.
Taylor Brandstetter05d98222017-10-10 12:12:53 -0700690// This test is disabled because it crashes on Linux, and is flaky on other
691// platforms. See: crbug.com/webrtc/7919
692TEST_F(RampUpTest, DISABLED_UpDownUpTransportSequenceNumberPacketLoss) {
philipel5ef2bc12017-02-21 07:28:31 -0800693 std::vector<int> loss_rates = {20, 0, 0, 0};
694 RampUpDownUpTester test(1, 0, 1, kStartBitrateBps,
695 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200696 false, loss_rates, false, &task_queue_);
Stefan Holmerff2a6352016-01-14 10:00:21 +0100697 RunBaseTest(&test);
698}
699
Taylor Brandstetterab86e7f2018-02-12 15:16:02 -0800700// TODO(bugs.webrtc.org/8878)
701#if defined(WEBRTC_MAC)
702#define MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx \
703 DISABLED_UpDownUpAudioVideoTransportSequenceNumberRtx
704#else
705#define MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx \
706 UpDownUpAudioVideoTransportSequenceNumberRtx
707#endif
708TEST_F(RampUpTest, MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx) {
Per Kjellander914351d2019-02-15 10:54:55 +0100709 test::ScopedFieldTrials field_trials("WebRTC-Audio-SendSideBwe/Enabled/");
philipel5ef2bc12017-02-21 07:28:31 -0800710 std::vector<int> loss_rates = {0, 0, 0, 0};
711 RampUpDownUpTester test(3, 1, 0, kStartBitrateBps,
isheriff6f8d6862016-05-26 11:24:55 -0700712 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200713 false, loss_rates, false, &task_queue_);
Stefan Holmerff2a6352016-01-14 10:00:21 +0100714 RunBaseTest(&test);
715}
716
stefan38d8b3c2017-01-09 04:19:24 -0800717TEST_F(RampUpTest, UpDownUpAudioTransportSequenceNumberRtx) {
Per Kjellander914351d2019-02-15 10:54:55 +0100718 test::ScopedFieldTrials field_trials("WebRTC-Audio-SendSideBwe/Enabled/");
philipel5ef2bc12017-02-21 07:28:31 -0800719 std::vector<int> loss_rates = {0, 0, 0, 0};
720 RampUpDownUpTester test(0, 1, 0, kStartBitrateBps,
mflodman86cc6ff2016-07-26 04:44:06 -0700721 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200722 false, loss_rates, false, &task_queue_);
mflodman86cc6ff2016-07-26 04:44:06 -0700723 RunBaseTest(&test);
724}
725
stefan38d8b3c2017-01-09 04:19:24 -0800726TEST_F(RampUpTest, TOffsetSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800727 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTimestampOffsetUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200728 true, true, &task_queue_);
stefan38d8b3c2017-01-09 04:19:24 -0800729 RunBaseTest(&test);
730}
731
732TEST_F(RampUpTest, AbsSendTime) {
philipel5ef2bc12017-02-21 07:28:31 -0800733 RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, false, false,
Tommi5e005f42019-08-05 15:29:14 +0200734 false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800735 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000736}
737
stefan38d8b3c2017-01-09 04:19:24 -0800738TEST_F(RampUpTest, AbsSendTimeSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800739 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, true, true,
Tommi5e005f42019-08-05 15:29:14 +0200740 true, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800741 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000742}
743
stefan38d8b3c2017-01-09 04:19:24 -0800744TEST_F(RampUpTest, TransportSequenceNumber) {
philipel5ef2bc12017-02-21 07:28:31 -0800745 RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200746 false, false, false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800747 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200748}
749
750TEST_F(RampUpTest, TransportSequenceNumberSimulcast) {
philipel5ef2bc12017-02-21 07:28:31 -0800751 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200752 false, false, false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800753 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200754}
755
stefan38d8b3c2017-01-09 04:19:24 -0800756TEST_F(RampUpTest, TransportSequenceNumberSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800757 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200758 true, true, true, &task_queue_);
stefan5a2c5062017-01-27 06:43:18 -0800759 RunBaseTest(&test);
760}
761
Niels Möllercd2e1052018-11-08 10:23:13 +0100762TEST_F(RampUpTest, AudioTransportSequenceNumber) {
philipel5ef2bc12017-02-21 07:28:31 -0800763 RampUpTester test(0, 1, 0, 300000, 10000,
stefan5a2c5062017-01-27 06:43:18 -0800764 RtpExtension::kTransportSequenceNumberUri, false, false,
Tommi5e005f42019-08-05 15:29:14 +0200765 false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800766 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200767}
pbos@webrtc.org744fbc72013-09-10 09:26:25 +0000768} // namespace webrtc