blob: 841f4d6189b06ff39373df9dfdb2d888cf45660d [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"
19#include "api/task_queue/task_queue_factory.h"
Artem Titov4e199e92018-08-20 13:30:39 +020020#include "call/fake_network_pipe.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020021#include "rtc_base/checks.h"
22#include "rtc_base/logging.h"
23#include "rtc_base/platform_thread.h"
Steve Anton10542f22019-01-11 09:11:00 -080024#include "rtc_base/string_encode.h"
Tommi6b117a52019-08-20 09:58:56 +020025#include "rtc_base/time_utils.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020026#include "test/encoder_settings.h"
Per Kjellander914351d2019-02-15 10:54:55 +010027#include "test/field_trial.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020028#include "test/gtest.h"
29#include "test/testsupport/perf_test.h"
pbos@webrtc.org744fbc72013-09-10 09:26:25 +000030
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020031ABSL_FLAG(std::string,
32 ramp_dump_name,
33 "",
34 "Filename for dumped received RTP stream.");
35
pbos@webrtc.org744fbc72013-09-10 09:26:25 +000036namespace webrtc {
pbos@webrtc.org29023282013-09-11 10:14:56 +000037namespace {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000038
Stefan Holmer723dff12015-10-05 14:59:41 +020039static const int64_t kPollIntervalMs = 20;
philipel5ef2bc12017-02-21 07:28:31 -080040static const int kExpectedHighVideoBitrateBps = 80000;
stefandb752f92016-12-05 08:23:40 -080041static const int kExpectedHighAudioBitrateBps = 30000;
42static const int kLowBandwidthLimitBps = 20000;
Sebastian Jansson12fb1702018-02-23 11:34:18 +010043// Set target detected bitrate to slightly larger than the target bitrate to
44// avoid flakiness.
45static const int kLowBitrateMarginBps = 2000;
pbos@webrtc.org29023282013-09-11 10:14:56 +000046
stefanff483612015-12-21 03:14:00 -080047std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000048 std::vector<uint32_t> ssrcs;
49 for (size_t i = 0; i != num_streams; ++i)
50 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i));
51 return ssrcs;
52}
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +000053} // namespace
henrik.lundin@webrtc.org845862f2014-03-06 07:19:28 +000054
Yves Gerey6516f762019-08-29 11:50:23 +020055RampUpTester::RampUpTester(
56 size_t num_video_streams,
57 size_t num_audio_streams,
58 size_t num_flexfec_streams,
59 unsigned int start_bitrate_bps,
60 int64_t min_run_time_ms,
61 const std::string& extension_type,
62 bool rtx,
63 bool red,
64 bool report_perf_stats,
65 test::DEPRECATED_SingleThreadedTaskQueueForTesting* task_queue)
stefan4fbd1452015-09-28 03:57:14 -070066 : EndToEndTest(test::CallTest::kLongTimeoutMs),
stefan4fbd1452015-09-28 03:57:14 -070067 clock_(Clock::GetRealTimeClock()),
stefanff483612015-12-21 03:14:00 -080068 num_video_streams_(num_video_streams),
69 num_audio_streams_(num_audio_streams),
philipel5ef2bc12017-02-21 07:28:31 -080070 num_flexfec_streams_(num_flexfec_streams),
stefan4fbd1452015-09-28 03:57:14 -070071 rtx_(rtx),
72 red_(red),
stefan45b5fe52017-03-09 06:27:02 -080073 report_perf_stats_(report_perf_stats),
mflodman86cc6ff2016-07-26 04:44:06 -070074 sender_call_(nullptr),
stefan4fbd1452015-09-28 03:57:14 -070075 send_stream_(nullptr),
sprang4847ae62017-06-27 07:06:52 -070076 send_transport_(nullptr),
Artem Titov631cafa2018-08-21 21:01:00 +020077 send_simulated_network_(nullptr),
stefan4fbd1452015-09-28 03:57:14 -070078 start_bitrate_bps_(start_bitrate_bps),
stefan5a2c5062017-01-27 06:43:18 -080079 min_run_time_ms_(min_run_time_ms),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000080 expected_bitrate_bps_(0),
Erik Språngf3a7c9d2015-10-05 14:03:22 +020081 test_start_ms_(-1),
stefan4fbd1452015-09-28 03:57:14 -070082 ramp_up_finished_ms_(-1),
83 extension_type_(extension_type),
stefanff483612015-12-21 03:14:00 -080084 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)),
85 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)),
86 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)),
Tommi5e005f42019-08-05 15:29:14 +020087 task_queue_(task_queue) {
philipel5ef2bc12017-02-21 07:28:31 -080088 if (red_)
89 EXPECT_EQ(0u, num_flexfec_streams_);
Stefan Holmerff2a6352016-01-14 10:00:21 +010090 EXPECT_LE(num_audio_streams_, 1u);
stefan4fbd1452015-09-28 03:57:14 -070091}
92
Tommi5e005f42019-08-05 15:29:14 +020093RampUpTester::~RampUpTester() {
94 // Special case for WebRTC-QuickPerfTest/Enabled/
95 task_queue_->SendTask([this]() {
96 if (pending_task_ !=
Yves Gerey6516f762019-08-29 11:50:23 +020097 static_cast<test::DEPRECATED_SingleThreadedTaskQueueForTesting::TaskId>(
98 -1)) {
Tommi5e005f42019-08-05 15:29:14 +020099 task_queue_->CancelTask(pending_task_);
100 pending_task_ = -1;
101 }
102 });
103}
stefan4fbd1452015-09-28 03:57:14 -0700104
Niels Möllerde8e6e62018-11-13 15:10:33 +0100105void RampUpTester::ModifySenderBitrateConfig(
106 BitrateConstraints* bitrate_config) {
stefan4fbd1452015-09-28 03:57:14 -0700107 if (start_bitrate_bps_ != 0) {
Niels Möllerde8e6e62018-11-13 15:10:33 +0100108 bitrate_config->start_bitrate_bps = start_bitrate_bps_;
stefan4fbd1452015-09-28 03:57:14 -0700109 }
Niels Möllerde8e6e62018-11-13 15:10:33 +0100110 bitrate_config->min_bitrate_bps = 10000;
stefan4fbd1452015-09-28 03:57:14 -0700111}
112
stefanff483612015-12-21 03:14:00 -0800113void RampUpTester::OnVideoStreamsCreated(
stefan4fbd1452015-09-28 03:57:14 -0700114 VideoSendStream* send_stream,
115 const std::vector<VideoReceiveStream*>& receive_streams) {
116 send_stream_ = send_stream;
117}
118
eladalon413ee9a2017-08-22 04:02:52 -0700119test::PacketTransport* RampUpTester::CreateSendTransport(
Yves Gerey6516f762019-08-29 11:50:23 +0200120 test::DEPRECATED_SingleThreadedTaskQueueForTesting* task_queue,
eladalon413ee9a2017-08-22 04:02:52 -0700121 Call* sender_call) {
Mirko Bonadei317a1f02019-09-17 17:06:18 +0200122 auto network = std::make_unique<SimulatedNetwork>(forward_transport_config_);
Artem Titov631cafa2018-08-21 21:01:00 +0200123 send_simulated_network_ = network.get();
minyue20c84cc2017-04-10 16:57:57 -0700124 send_transport_ = new test::PacketTransport(
eladalon413ee9a2017-08-22 04:02:52 -0700125 task_queue, sender_call, this, test::PacketTransport::kSender,
Artem Titov4e199e92018-08-20 13:30:39 +0200126 test::CallTest::payload_type_map_,
Mirko Bonadei317a1f02019-09-17 17:06:18 +0200127 std::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
128 std::move(network)));
stefane74eef12016-01-08 06:47:13 -0800129 return send_transport_;
stefanf116bd02015-10-27 08:29:42 -0700130}
131
Stefan Holmerd20e6512016-01-12 15:51:22 +0100132size_t RampUpTester::GetNumVideoStreams() const {
133 return num_video_streams_;
134}
135
Stefan Holmerff2a6352016-01-14 10:00:21 +0100136size_t RampUpTester::GetNumAudioStreams() const {
137 return num_audio_streams_;
138}
139
philipel5ef2bc12017-02-21 07:28:31 -0800140size_t RampUpTester::GetNumFlexfecStreams() const {
141 return num_flexfec_streams_;
142}
143
perkjfa10b552016-10-02 23:45:26 -0700144class RampUpTester::VideoStreamFactory
145 : public VideoEncoderConfig::VideoStreamFactoryInterface {
146 public:
147 VideoStreamFactory() {}
148
149 private:
150 std::vector<VideoStream> CreateEncoderStreams(
151 int width,
152 int height,
153 const VideoEncoderConfig& encoder_config) override {
154 std::vector<VideoStream> streams =
155 test::CreateVideoStreams(width, height, encoder_config);
156 if (encoder_config.number_of_streams == 1) {
157 streams[0].target_bitrate_bps = streams[0].max_bitrate_bps = 2000000;
158 }
159 return streams;
160 }
161};
162
stefanff483612015-12-21 03:14:00 -0800163void RampUpTester::ModifyVideoConfigs(
stefan4fbd1452015-09-28 03:57:14 -0700164 VideoSendStream::Config* send_config,
165 std::vector<VideoReceiveStream::Config>* receive_configs,
166 VideoEncoderConfig* encoder_config) {
167 send_config->suspend_below_min_bitrate = true;
perkjfa10b552016-10-02 23:45:26 -0700168 encoder_config->number_of_streams = num_video_streams_;
169 encoder_config->max_bitrate_bps = 2000000;
170 encoder_config->video_stream_factory =
171 new rtc::RefCountedObject<RampUpTester::VideoStreamFactory>();
stefanff483612015-12-21 03:14:00 -0800172 if (num_video_streams_ == 1) {
stefan4fbd1452015-09-28 03:57:14 -0700173 // For single stream rampup until 1mbps
174 expected_bitrate_bps_ = kSingleStreamTargetBps;
175 } else {
Ilya Nikolaevskiyb0588e62018-08-27 14:12:27 +0200176 // To ensure simulcast rate allocation.
177 send_config->rtp.payload_name = "VP8";
178 encoder_config->codec_type = kVideoCodecVP8;
perkjfa10b552016-10-02 23:45:26 -0700179 std::vector<VideoStream> streams = test::CreateVideoStreams(
180 test::CallTest::kDefaultWidth, test::CallTest::kDefaultHeight,
181 *encoder_config);
Ilya Nikolaevskiyb0588e62018-08-27 14:12:27 +0200182 // For multi stream rampup until all streams are being sent. That means
183 // enough bitrate to send all the target streams plus the min bitrate of
184 // the last one.
perkjfa10b552016-10-02 23:45:26 -0700185 expected_bitrate_bps_ = streams.back().min_bitrate_bps;
186 for (size_t i = 0; i < streams.size() - 1; ++i) {
187 expected_bitrate_bps_ += streams[i].target_bitrate_bps;
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000188 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000189 }
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000190
stefan4fbd1452015-09-28 03:57:14 -0700191 send_config->rtp.extensions.clear();
192
193 bool remb;
stefan43edf0f2015-11-20 18:05:48 -0800194 bool transport_cc;
isheriff6f8d6862016-05-26 11:24:55 -0700195 if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
stefan4fbd1452015-09-28 03:57:14 -0700196 remb = true;
stefan43edf0f2015-11-20 18:05:48 -0800197 transport_cc = false;
stefan4fbd1452015-09-28 03:57:14 -0700198 send_config->rtp.extensions.push_back(
199 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
isheriff6f8d6862016-05-26 11:24:55 -0700200 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
stefan4fbd1452015-09-28 03:57:14 -0700201 remb = false;
stefan43edf0f2015-11-20 18:05:48 -0800202 transport_cc = true;
stefan4fbd1452015-09-28 03:57:14 -0700203 send_config->rtp.extensions.push_back(RtpExtension(
204 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000205 } else {
stefan4fbd1452015-09-28 03:57:14 -0700206 remb = true;
stefan43edf0f2015-11-20 18:05:48 -0800207 transport_cc = false;
stefan4fbd1452015-09-28 03:57:14 -0700208 send_config->rtp.extensions.push_back(RtpExtension(
209 extension_type_.c_str(), kTransmissionTimeOffsetExtensionId));
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000210 }
stefan4fbd1452015-09-28 03:57:14 -0700211
212 send_config->rtp.nack.rtp_history_ms = test::CallTest::kNackRtpHistoryMs;
stefanff483612015-12-21 03:14:00 -0800213 send_config->rtp.ssrcs = video_ssrcs_;
stefan4fbd1452015-09-28 03:57:14 -0700214 if (rtx_) {
215 send_config->rtp.rtx.payload_type = test::CallTest::kSendRtxPayloadType;
stefanff483612015-12-21 03:14:00 -0800216 send_config->rtp.rtx.ssrcs = video_rtx_ssrcs_;
stefan4fbd1452015-09-28 03:57:14 -0700217 }
218 if (red_) {
brandtrb5f2c3f2016-10-04 23:28:39 -0700219 send_config->rtp.ulpfec.ulpfec_payload_type =
stefan4fbd1452015-09-28 03:57:14 -0700220 test::CallTest::kUlpfecPayloadType;
brandtrb5f2c3f2016-10-04 23:28:39 -0700221 send_config->rtp.ulpfec.red_payload_type = test::CallTest::kRedPayloadType;
brandtrfbfb5362016-11-17 04:18:37 -0800222 if (rtx_) {
223 send_config->rtp.ulpfec.red_rtx_payload_type =
224 test::CallTest::kRtxRedPayloadType;
225 }
stefan4fbd1452015-09-28 03:57:14 -0700226 }
227
228 size_t i = 0;
229 for (VideoReceiveStream::Config& recv_config : *receive_configs) {
stefan43edf0f2015-11-20 18:05:48 -0800230 recv_config.rtp.transport_cc = transport_cc;
stefan4fbd1452015-09-28 03:57:14 -0700231 recv_config.rtp.extensions = send_config->rtp.extensions;
Ilya Nikolaevskiyb0588e62018-08-27 14:12:27 +0200232 recv_config.decoders.reserve(1);
233 recv_config.decoders[0].payload_type = send_config->rtp.payload_type;
Niels Möllercb7e1d22018-09-11 15:56:04 +0200234 recv_config.decoders[0].video_format =
235 SdpVideoFormat(send_config->rtp.payload_name);
stefan4fbd1452015-09-28 03:57:14 -0700236
stefanff483612015-12-21 03:14:00 -0800237 recv_config.rtp.remote_ssrc = video_ssrcs_[i];
stefan4fbd1452015-09-28 03:57:14 -0700238 recv_config.rtp.nack.rtp_history_ms = send_config->rtp.nack.rtp_history_ms;
239
240 if (red_) {
nisse3b3622f2017-09-26 02:49:21 -0700241 recv_config.rtp.red_payload_type =
brandtrb5f2c3f2016-10-04 23:28:39 -0700242 send_config->rtp.ulpfec.red_payload_type;
nisse3b3622f2017-09-26 02:49:21 -0700243 recv_config.rtp.ulpfec_payload_type =
brandtrb5f2c3f2016-10-04 23:28:39 -0700244 send_config->rtp.ulpfec.ulpfec_payload_type;
brandtrfbfb5362016-11-17 04:18:37 -0800245 if (rtx_) {
nisseca5706d2017-09-11 02:32:16 -0700246 recv_config.rtp.rtx_associated_payload_types
247 [send_config->rtp.ulpfec.red_rtx_payload_type] =
248 send_config->rtp.ulpfec.red_payload_type;
brandtrfbfb5362016-11-17 04:18:37 -0800249 }
stefan4fbd1452015-09-28 03:57:14 -0700250 }
251
252 if (rtx_) {
brandtr14742122017-01-27 04:53:07 -0800253 recv_config.rtp.rtx_ssrc = video_rtx_ssrcs_[i];
254 recv_config.rtp
nisse26e3abb2017-08-25 04:44:25 -0700255 .rtx_associated_payload_types[send_config->rtp.rtx.payload_type] =
Niels Möller259a4972018-04-05 15:36:51 +0200256 send_config->rtp.payload_type;
stefan4fbd1452015-09-28 03:57:14 -0700257 }
258 ++i;
259 }
philipel5ef2bc12017-02-21 07:28:31 -0800260
261 RTC_DCHECK_LE(num_flexfec_streams_, 1);
262 if (num_flexfec_streams_ == 1) {
263 send_config->rtp.flexfec.payload_type = test::CallTest::kFlexfecPayloadType;
264 send_config->rtp.flexfec.ssrc = test::CallTest::kFlexfecSendSsrc;
265 send_config->rtp.flexfec.protected_media_ssrcs = {video_ssrcs_[0]};
266 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000267}
268
Stefan Holmerff2a6352016-01-14 10:00:21 +0100269void RampUpTester::ModifyAudioConfigs(
270 AudioSendStream::Config* send_config,
271 std::vector<AudioReceiveStream::Config>* receive_configs) {
272 if (num_audio_streams_ == 0)
273 return;
274
isheriff6f8d6862016-05-26 11:24:55 -0700275 EXPECT_NE(RtpExtension::kTimestampOffsetUri, extension_type_)
Stefan Holmerff2a6352016-01-14 10:00:21 +0100276 << "Audio BWE not supported with toffset.";
philipel5ef2bc12017-02-21 07:28:31 -0800277 EXPECT_NE(RtpExtension::kAbsSendTimeUri, extension_type_)
278 << "Audio BWE not supported with abs-send-time.";
Stefan Holmerff2a6352016-01-14 10:00:21 +0100279
280 send_config->rtp.ssrc = audio_ssrcs_[0];
281 send_config->rtp.extensions.clear();
282
minyue10cbb462016-11-07 09:29:22 -0800283 send_config->min_bitrate_bps = 6000;
284 send_config->max_bitrate_bps = 60000;
mflodman86cc6ff2016-07-26 04:44:06 -0700285
Stefan Holmerff2a6352016-01-14 10:00:21 +0100286 bool transport_cc = false;
philipel5ef2bc12017-02-21 07:28:31 -0800287 if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
Stefan Holmerff2a6352016-01-14 10:00:21 +0100288 transport_cc = true;
289 send_config->rtp.extensions.push_back(RtpExtension(
290 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
291 }
292
293 for (AudioReceiveStream::Config& recv_config : *receive_configs) {
Stefan Holmerff2a6352016-01-14 10:00:21 +0100294 recv_config.rtp.transport_cc = transport_cc;
295 recv_config.rtp.extensions = send_config->rtp.extensions;
296 recv_config.rtp.remote_ssrc = send_config->rtp.ssrc;
297 }
298}
299
philipel5ef2bc12017-02-21 07:28:31 -0800300void RampUpTester::ModifyFlexfecConfigs(
301 std::vector<FlexfecReceiveStream::Config>* receive_configs) {
302 if (num_flexfec_streams_ == 0)
303 return;
304 RTC_DCHECK_EQ(1, num_flexfec_streams_);
305 (*receive_configs)[0].payload_type = test::CallTest::kFlexfecPayloadType;
306 (*receive_configs)[0].remote_ssrc = test::CallTest::kFlexfecSendSsrc;
307 (*receive_configs)[0].protected_media_ssrcs = {video_ssrcs_[0]};
308 (*receive_configs)[0].local_ssrc = video_ssrcs_[0];
309 if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
310 (*receive_configs)[0].transport_cc = false;
311 (*receive_configs)[0].rtp_header_extensions.push_back(
312 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
313 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
314 (*receive_configs)[0].transport_cc = true;
315 (*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension(
316 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
317 }
318}
319
stefan4fbd1452015-09-28 03:57:14 -0700320void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
Tommi5e005f42019-08-05 15:29:14 +0200321 RTC_DCHECK(sender_call);
stefan4fbd1452015-09-28 03:57:14 -0700322 sender_call_ = sender_call;
Tommi5e005f42019-08-05 15:29:14 +0200323 pending_task_ = task_queue_->PostTask([this]() { PollStats(); });
pbos@webrtc.org32452b22014-10-22 12:15:24 +0000324}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000325
tommi0f8b4032017-02-22 11:22:05 -0800326void RampUpTester::PollStats() {
Tommi6b117a52019-08-20 09:58:56 +0200327 RTC_DCHECK_RUN_ON(task_queue_);
328
329 EnsurePollTimeSet();
330
Tommi5e005f42019-08-05 15:29:14 +0200331 pending_task_ = -1;
332 Call::Stats stats = sender_call_->GetStats();
333 EXPECT_GE(expected_bitrate_bps_, 0);
stefan4fbd1452015-09-28 03:57:14 -0700334
Tommi5e005f42019-08-05 15:29:14 +0200335 if (stats.send_bandwidth_bps >= expected_bitrate_bps_ &&
336 (min_run_time_ms_ == -1 ||
337 clock_->TimeInMilliseconds() - test_start_ms_ >= min_run_time_ms_)) {
338 ramp_up_finished_ms_ = clock_->TimeInMilliseconds();
339 observation_complete_.Set();
340 } else {
341 pending_task_ = task_queue_->PostDelayedTask([this]() { PollStats(); },
Tommi6b117a52019-08-20 09:58:56 +0200342 GetIntervalForNextPoll());
Tommi5e005f42019-08-05 15:29:14 +0200343 }
Erik Språng468e62a2015-07-06 10:50:47 +0200344}
345
stefan4fbd1452015-09-28 03:57:14 -0700346void RampUpTester::ReportResult(const std::string& measurement,
347 size_t value,
348 const std::string& units) const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000349 webrtc::test::PrintResult(
350 measurement, "",
stefanff483612015-12-21 03:14:00 -0800351 ::testing::UnitTest::GetInstance()->current_test_info()->name(), value,
352 units, false);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000353}
354
stefan092508a2015-09-29 02:26:42 -0700355void RampUpTester::AccumulateStats(const VideoSendStream::StreamStats& stream,
356 size_t* total_packets_sent,
357 size_t* total_sent,
358 size_t* padding_sent,
359 size_t* media_sent) const {
stefan4fbd1452015-09-28 03:57:14 -0700360 *total_packets_sent += stream.rtp_stats.transmitted.packets +
361 stream.rtp_stats.retransmitted.packets +
362 stream.rtp_stats.fec.packets;
363 *total_sent += stream.rtp_stats.transmitted.TotalBytes() +
364 stream.rtp_stats.retransmitted.TotalBytes() +
365 stream.rtp_stats.fec.TotalBytes();
366 *padding_sent += stream.rtp_stats.transmitted.padding_bytes +
367 stream.rtp_stats.retransmitted.padding_bytes +
368 stream.rtp_stats.fec.padding_bytes;
369 *media_sent += stream.rtp_stats.MediaPayloadBytes();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000370}
371
stefan4fbd1452015-09-28 03:57:14 -0700372void RampUpTester::TriggerTestDone() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200373 RTC_DCHECK_GE(test_start_ms_, 0);
374
Stefan Holmerff2a6352016-01-14 10:00:21 +0100375 // TODO(holmer): Add audio send stats here too when those APIs are available.
mflodman86cc6ff2016-07-26 04:44:06 -0700376 if (!send_stream_)
377 return;
378
Tommi5e005f42019-08-05 15:29:14 +0200379 // Stop polling stats.
380 // Corner case for field_trials=WebRTC-QuickPerfTest/Enabled/
381 task_queue_->SendTask([this]() {
382 if (pending_task_ !=
Yves Gerey6516f762019-08-29 11:50:23 +0200383 static_cast<test::DEPRECATED_SingleThreadedTaskQueueForTesting::TaskId>(
384 -1)) {
Tommi5e005f42019-08-05 15:29:14 +0200385 task_queue_->CancelTask(pending_task_);
386 pending_task_ = -1;
387 }
388 });
389
stefan4fbd1452015-09-28 03:57:14 -0700390 VideoSendStream::Stats send_stats = send_stream_->GetStats();
Tommi5e005f42019-08-05 15:29:14 +0200391 send_stream_ = nullptr; // To avoid dereferencing a bad pointer.
stefan4fbd1452015-09-28 03:57:14 -0700392
393 size_t total_packets_sent = 0;
394 size_t total_sent = 0;
395 size_t padding_sent = 0;
396 size_t media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800397 for (uint32_t ssrc : video_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700398 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent,
399 &total_sent, &padding_sent, &media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700400 }
401
402 size_t rtx_total_packets_sent = 0;
403 size_t rtx_total_sent = 0;
404 size_t rtx_padding_sent = 0;
405 size_t rtx_media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800406 for (uint32_t rtx_ssrc : video_rtx_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700407 AccumulateStats(send_stats.substreams[rtx_ssrc], &rtx_total_packets_sent,
408 &rtx_total_sent, &rtx_padding_sent, &rtx_media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700409 }
410
stefan5a2c5062017-01-27 06:43:18 -0800411 if (report_perf_stats_) {
stefan5a2c5062017-01-27 06:43:18 -0800412 ReportResult("ramp-up-media-sent", media_sent, "bytes");
413 ReportResult("ramp-up-padding-sent", padding_sent, "bytes");
stefan5a2c5062017-01-27 06:43:18 -0800414 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes");
415 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes");
416 if (ramp_up_finished_ms_ >= 0) {
417 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_,
418 "milliseconds");
419 }
420 ReportResult("ramp-up-average-network-latency",
421 send_transport_->GetAverageDelayMs(), "milliseconds");
stefan4fbd1452015-09-28 03:57:14 -0700422 }
423}
424
425void RampUpTester::PerformTest() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200426 test_start_ms_ = clock_->TimeInMilliseconds();
Peter Boström5811a392015-12-10 13:02:50 +0100427 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete.";
stefan4fbd1452015-09-28 03:57:14 -0700428 TriggerTestDone();
429}
430
Tommi6b117a52019-08-20 09:58:56 +0200431void RampUpTester::EnsurePollTimeSet() {
432 RTC_DCHECK_RUN_ON(task_queue_);
433 if (!next_scheduled_poll_time_ms_)
434 next_scheduled_poll_time_ms_ = rtc::TimeMillis();
435}
436
437int64_t RampUpTester::GetIntervalForNextPoll() {
438 RTC_DCHECK_RUN_ON(task_queue_);
439 RTC_DCHECK_NE(next_scheduled_poll_time_ms_, 0)
440 << "No call to EnsurePollTimeSet()";
441 auto now = rtc::TimeMillis();
442 next_scheduled_poll_time_ms_ += kPollIntervalMs;
443 auto interval = next_scheduled_poll_time_ms_ - now;
444 return interval > 0 ? interval : 0;
445}
446
Tommi5e005f42019-08-05 15:29:14 +0200447RampUpDownUpTester::RampUpDownUpTester(
448 size_t num_video_streams,
449 size_t num_audio_streams,
450 size_t num_flexfec_streams,
451 unsigned int start_bitrate_bps,
452 const std::string& extension_type,
453 bool rtx,
454 bool red,
455 const std::vector<int>& loss_rates,
456 bool report_perf_stats,
Yves Gerey6516f762019-08-29 11:50:23 +0200457 test::DEPRECATED_SingleThreadedTaskQueueForTesting* task_queue)
Stefan Holmerff2a6352016-01-14 10:00:21 +0100458 : RampUpTester(num_video_streams,
459 num_audio_streams,
philipel5ef2bc12017-02-21 07:28:31 -0800460 num_flexfec_streams,
Stefan Holmerff2a6352016-01-14 10:00:21 +0100461 start_bitrate_bps,
stefan5a2c5062017-01-27 06:43:18 -0800462 0,
Stefan Holmerff2a6352016-01-14 10:00:21 +0100463 extension_type,
464 rtx,
stefan5a2c5062017-01-27 06:43:18 -0800465 red,
Tommi5e005f42019-08-05 15:29:14 +0200466 report_perf_stats,
467 task_queue),
stefan76d9c9c2017-04-01 06:51:09 -0700468 link_rates_({4 * GetExpectedHighBitrate() / (3 * 1000),
469 kLowBandwidthLimitBps / 1000,
470 4 * GetExpectedHighBitrate() / (3 * 1000), 0}),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000471 test_state_(kFirstRampup),
philipel5ef2bc12017-02-21 07:28:31 -0800472 next_state_(kTransitionToNextState),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000473 state_start_ms_(clock_->TimeInMilliseconds()),
stefan4fbd1452015-09-28 03:57:14 -0700474 interval_start_ms_(clock_->TimeInMilliseconds()),
philipel5ef2bc12017-02-21 07:28:31 -0800475 sent_bytes_(0),
476 loss_rates_(loss_rates) {
477 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
478 forward_transport_config_.queue_delay_ms = 100;
479 forward_transport_config_.loss_percent = loss_rates_[test_state_];
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000480}
481
stefan4fbd1452015-09-28 03:57:14 -0700482RampUpDownUpTester::~RampUpDownUpTester() {}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000483
tommi0f8b4032017-02-22 11:22:05 -0800484void RampUpDownUpTester::PollStats() {
Tommi6b117a52019-08-20 09:58:56 +0200485 EnsurePollTimeSet();
486
Tommi5e005f42019-08-05 15:29:14 +0200487 pending_task_ = -1;
488 bool last_round = (test_state_ == kTestEnd);
489
490 int transmit_bitrate_bps = 0;
491 bool suspended = false;
492 if (num_video_streams_ > 0 && send_stream_) {
493 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
494 for (const auto& it : stats.substreams) {
495 transmit_bitrate_bps += it.second.total_bitrate_bps;
Alex Narest78609d52017-10-20 10:37:47 +0200496 }
Tommi5e005f42019-08-05 15:29:14 +0200497 suspended = stats.suspended;
498 }
499 if (num_audio_streams_ > 0 && sender_call_) {
500 // An audio send stream doesn't have bitrate stats, so the call send BW is
501 // currently used instead.
502 transmit_bitrate_bps = sender_call_->GetStats().send_bandwidth_bps;
503 }
504
505 EvolveTestState(transmit_bitrate_bps, suspended);
506
507 if (!last_round) {
508 pending_task_ = task_queue_->PostDelayedTask([this]() { PollStats(); },
Tommi6b117a52019-08-20 09:58:56 +0200509 GetIntervalForNextPoll());
Tommi5e005f42019-08-05 15:29:14 +0200510 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000511}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000512
Niels Möllerde8e6e62018-11-13 15:10:33 +0100513void RampUpDownUpTester::ModifyReceiverBitrateConfig(
514 BitrateConstraints* bitrate_config) {
515 bitrate_config->min_bitrate_bps = 10000;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000516}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000517
stefan4fbd1452015-09-28 03:57:14 -0700518std::string RampUpDownUpTester::GetModifierString() const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000519 std::string str("_");
stefanff483612015-12-21 03:14:00 -0800520 if (num_video_streams_ > 0) {
Jonas Olsson0a713b62018-04-04 15:49:32 +0200521 str += rtc::ToString(num_video_streams_);
stefanff483612015-12-21 03:14:00 -0800522 str += "stream";
523 str += (num_video_streams_ > 1 ? "s" : "");
524 str += "_";
525 }
526 if (num_audio_streams_ > 0) {
Jonas Olsson0a713b62018-04-04 15:49:32 +0200527 str += rtc::ToString(num_audio_streams_);
stefanff483612015-12-21 03:14:00 -0800528 str += "stream";
529 str += (num_audio_streams_ > 1 ? "s" : "");
530 str += "_";
531 }
stefan4fbd1452015-09-28 03:57:14 -0700532 str += (rtx_ ? "" : "no");
Edward Lemurdd3987f2018-01-04 19:44:54 +0100533 str += "rtx_";
534 str += (red_ ? "" : "no");
535 str += "red";
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000536 return str;
537}
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000538
stefandb752f92016-12-05 08:23:40 -0800539int RampUpDownUpTester::GetExpectedHighBitrate() const {
stefan38d8b3c2017-01-09 04:19:24 -0800540 int expected_bitrate_bps = 0;
541 if (num_audio_streams_ > 0)
542 expected_bitrate_bps += kExpectedHighAudioBitrateBps;
543 if (num_video_streams_ > 0)
544 expected_bitrate_bps += kExpectedHighVideoBitrateBps;
545 return expected_bitrate_bps;
546}
547
philipel5ef2bc12017-02-21 07:28:31 -0800548size_t RampUpDownUpTester::GetFecBytes() const {
549 size_t flex_fec_bytes = 0;
550 if (num_flexfec_streams_ > 0) {
551 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
552 for (const auto& kv : stats.substreams)
553 flex_fec_bytes += kv.second.rtp_stats.fec.TotalBytes();
554 }
555 return flex_fec_bytes;
556}
557
558bool RampUpDownUpTester::ExpectingFec() const {
559 return num_flexfec_streams_ > 0 && forward_transport_config_.loss_percent > 0;
560}
561
stefan4fbd1452015-09-28 03:57:14 -0700562void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000563 int64_t now = clock_->TimeInMilliseconds();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000564 switch (test_state_) {
philipel5ef2bc12017-02-21 07:28:31 -0800565 case kFirstRampup:
stefan4fbd1452015-09-28 03:57:14 -0700566 EXPECT_FALSE(suspended);
stefandb752f92016-12-05 08:23:40 -0800567 if (bitrate_bps >= GetExpectedHighBitrate()) {
stefan45b5fe52017-03-09 06:27:02 -0800568 if (report_perf_stats_) {
569 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
570 "first_rampup", now - state_start_ms_, "ms",
571 false);
572 }
philipel5ef2bc12017-02-21 07:28:31 -0800573 // Apply loss during the transition between states if FEC is enabled.
574 forward_transport_config_.loss_percent = loss_rates_[test_state_];
575 test_state_ = kTransitionToNextState;
576 next_state_ = kLowRate;
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000577 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000578 break;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000579 case kLowRate: {
mflodman86cc6ff2016-07-26 04:44:06 -0700580 // Audio streams are never suspended.
581 bool check_suspend_state = num_video_streams_ > 0;
Sebastian Jansson12fb1702018-02-23 11:34:18 +0100582 if (bitrate_bps < kLowBandwidthLimitBps + kLowBitrateMarginBps &&
mflodman86cc6ff2016-07-26 04:44:06 -0700583 suspended == check_suspend_state) {
stefan45b5fe52017-03-09 06:27:02 -0800584 if (report_perf_stats_) {
585 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
586 "rampdown", now - state_start_ms_, "ms",
587 false);
588 }
philipel5ef2bc12017-02-21 07:28:31 -0800589 // Apply loss during the transition between states if FEC is enabled.
590 forward_transport_config_.loss_percent = loss_rates_[test_state_];
591 test_state_ = kTransitionToNextState;
592 next_state_ = kSecondRampup;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000593 }
594 break;
595 }
philipel5ef2bc12017-02-21 07:28:31 -0800596 case kSecondRampup:
stefandb752f92016-12-05 08:23:40 -0800597 if (bitrate_bps >= GetExpectedHighBitrate() && !suspended) {
stefan45b5fe52017-03-09 06:27:02 -0800598 if (report_perf_stats_) {
599 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
600 "second_rampup", now - state_start_ms_,
601 "ms", false);
602 ReportResult("ramp-up-down-up-average-network-latency",
603 send_transport_->GetAverageDelayMs(), "milliseconds");
604 }
philipel5ef2bc12017-02-21 07:28:31 -0800605 // Apply loss during the transition between states if FEC is enabled.
606 forward_transport_config_.loss_percent = loss_rates_[test_state_];
607 test_state_ = kTransitionToNextState;
608 next_state_ = kTestEnd;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000609 }
610 break;
philipel5ef2bc12017-02-21 07:28:31 -0800611 case kTestEnd:
612 observation_complete_.Set();
613 break;
614 case kTransitionToNextState:
615 if (!ExpectingFec() || GetFecBytes() > 0) {
616 test_state_ = next_state_;
617 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
618 // No loss while ramping up and down as it may affect the BWE
619 // negatively, making the test flaky.
620 forward_transport_config_.loss_percent = 0;
621 state_start_ms_ = now;
622 interval_start_ms_ = now;
623 sent_bytes_ = 0;
Artem Titov631cafa2018-08-21 21:01:00 +0200624 send_simulated_network_->SetConfig(forward_transport_config_);
philipel5ef2bc12017-02-21 07:28:31 -0800625 }
626 break;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000627 }
628}
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000629
stefan4fbd1452015-09-28 03:57:14 -0700630class RampUpTest : public test::CallTest {
Erik Språng6b8d3552015-09-24 15:06:57 +0200631 public:
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200632 RampUpTest()
633 : task_queue_factory_(CreateDefaultTaskQueueFactory()),
634 rtc_event_log_factory_(task_queue_factory_.get()) {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200635 std::string dump_name(absl::GetFlag(FLAGS_ramp_dump_name));
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200636 if (!dump_name.empty()) {
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200637 send_event_log_ = rtc_event_log_factory_.CreateRtcEventLog(
638 RtcEventLog::EncodingType::Legacy);
639 recv_event_log_ = rtc_event_log_factory_.CreateRtcEventLog(
640 RtcEventLog::EncodingType::Legacy);
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200641 bool event_log_started =
642 send_event_log_->StartLogging(
Mirko Bonadei317a1f02019-09-17 17:06:18 +0200643 std::make_unique<RtcEventLogOutputFile>(
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200644 dump_name + ".send.rtc.dat", RtcEventLog::kUnlimitedOutput),
645 RtcEventLog::kImmediateOutput) &&
646 recv_event_log_->StartLogging(
Mirko Bonadei317a1f02019-09-17 17:06:18 +0200647 std::make_unique<RtcEventLogOutputFile>(
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200648 dump_name + ".recv.rtc.dat", RtcEventLog::kUnlimitedOutput),
649 RtcEventLog::kImmediateOutput);
650 RTC_DCHECK(event_log_started);
651 }
652 }
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200653
654 private:
655 const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
656 RtcEventLogFactory rtc_event_log_factory_;
Erik Språng6b8d3552015-09-24 15:06:57 +0200657};
658
Stefan Holmerff2a6352016-01-14 10:00:21 +0100659static const uint32_t kStartBitrateBps = 60000;
660
stefan38d8b3c2017-01-09 04:19:24 -0800661TEST_F(RampUpTest, UpDownUpAbsSendTimeSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800662 std::vector<int> loss_rates = {0, 0, 0, 0};
663 RampUpDownUpTester test(3, 0, 0, kStartBitrateBps,
stefan45b5fe52017-03-09 06:27:02 -0800664 RtpExtension::kAbsSendTimeUri, true, true, loss_rates,
Tommi5e005f42019-08-05 15:29:14 +0200665 true, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800666 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800667}
Stefan Holmerff2a6352016-01-14 10:00:21 +0100668
Taylor Brandstetterba6b5032018-02-16 09:59:56 -0800669// TODO(bugs.webrtc.org/8878)
670#if defined(WEBRTC_MAC)
671#define MAYBE_UpDownUpTransportSequenceNumberRtx \
672 DISABLED_UpDownUpTransportSequenceNumberRtx
673#else
674#define MAYBE_UpDownUpTransportSequenceNumberRtx \
675 UpDownUpTransportSequenceNumberRtx
676#endif
677TEST_F(RampUpTest, MAYBE_UpDownUpTransportSequenceNumberRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800678 std::vector<int> loss_rates = {0, 0, 0, 0};
679 RampUpDownUpTester test(3, 0, 0, kStartBitrateBps,
isheriff6f8d6862016-05-26 11:24:55 -0700680 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200681 false, loss_rates, true, &task_queue_);
philipel5ef2bc12017-02-21 07:28:31 -0800682 RunBaseTest(&test);
683}
684
stefan45b5fe52017-03-09 06:27:02 -0800685// TODO(holmer): Tests which don't report perf stats should be moved to a
686// different executable since they per definition are not perf tests.
Taylor Brandstetter05d98222017-10-10 12:12:53 -0700687// This test is disabled because it crashes on Linux, and is flaky on other
688// platforms. See: crbug.com/webrtc/7919
689TEST_F(RampUpTest, DISABLED_UpDownUpTransportSequenceNumberPacketLoss) {
philipel5ef2bc12017-02-21 07:28:31 -0800690 std::vector<int> loss_rates = {20, 0, 0, 0};
691 RampUpDownUpTester test(1, 0, 1, kStartBitrateBps,
692 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200693 false, loss_rates, false, &task_queue_);
Stefan Holmerff2a6352016-01-14 10:00:21 +0100694 RunBaseTest(&test);
695}
696
Taylor Brandstetterab86e7f2018-02-12 15:16:02 -0800697// TODO(bugs.webrtc.org/8878)
698#if defined(WEBRTC_MAC)
699#define MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx \
700 DISABLED_UpDownUpAudioVideoTransportSequenceNumberRtx
701#else
702#define MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx \
703 UpDownUpAudioVideoTransportSequenceNumberRtx
704#endif
705TEST_F(RampUpTest, MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx) {
Per Kjellander914351d2019-02-15 10:54:55 +0100706 test::ScopedFieldTrials field_trials("WebRTC-Audio-SendSideBwe/Enabled/");
philipel5ef2bc12017-02-21 07:28:31 -0800707 std::vector<int> loss_rates = {0, 0, 0, 0};
708 RampUpDownUpTester test(3, 1, 0, kStartBitrateBps,
isheriff6f8d6862016-05-26 11:24:55 -0700709 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200710 false, loss_rates, false, &task_queue_);
Stefan Holmerff2a6352016-01-14 10:00:21 +0100711 RunBaseTest(&test);
712}
713
stefan38d8b3c2017-01-09 04:19:24 -0800714TEST_F(RampUpTest, UpDownUpAudioTransportSequenceNumberRtx) {
Per Kjellander914351d2019-02-15 10:54:55 +0100715 test::ScopedFieldTrials field_trials("WebRTC-Audio-SendSideBwe/Enabled/");
philipel5ef2bc12017-02-21 07:28:31 -0800716 std::vector<int> loss_rates = {0, 0, 0, 0};
717 RampUpDownUpTester test(0, 1, 0, kStartBitrateBps,
mflodman86cc6ff2016-07-26 04:44:06 -0700718 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200719 false, loss_rates, false, &task_queue_);
mflodman86cc6ff2016-07-26 04:44:06 -0700720 RunBaseTest(&test);
721}
722
stefan38d8b3c2017-01-09 04:19:24 -0800723TEST_F(RampUpTest, TOffsetSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800724 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTimestampOffsetUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200725 true, true, &task_queue_);
stefan38d8b3c2017-01-09 04:19:24 -0800726 RunBaseTest(&test);
727}
728
729TEST_F(RampUpTest, AbsSendTime) {
philipel5ef2bc12017-02-21 07:28:31 -0800730 RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, false, false,
Tommi5e005f42019-08-05 15:29:14 +0200731 false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800732 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000733}
734
stefan38d8b3c2017-01-09 04:19:24 -0800735TEST_F(RampUpTest, AbsSendTimeSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800736 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, true, true,
Tommi5e005f42019-08-05 15:29:14 +0200737 true, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800738 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000739}
740
stefan38d8b3c2017-01-09 04:19:24 -0800741TEST_F(RampUpTest, TransportSequenceNumber) {
philipel5ef2bc12017-02-21 07:28:31 -0800742 RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200743 false, false, false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800744 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200745}
746
747TEST_F(RampUpTest, TransportSequenceNumberSimulcast) {
philipel5ef2bc12017-02-21 07:28:31 -0800748 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200749 false, false, false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800750 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200751}
752
stefan38d8b3c2017-01-09 04:19:24 -0800753TEST_F(RampUpTest, TransportSequenceNumberSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800754 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200755 true, true, true, &task_queue_);
stefan5a2c5062017-01-27 06:43:18 -0800756 RunBaseTest(&test);
757}
758
Niels Möllercd2e1052018-11-08 10:23:13 +0100759TEST_F(RampUpTest, AudioTransportSequenceNumber) {
philipel5ef2bc12017-02-21 07:28:31 -0800760 RampUpTester test(0, 1, 0, 300000, 10000,
stefan5a2c5062017-01-27 06:43:18 -0800761 RtpExtension::kTransportSequenceNumberUri, false, false,
Tommi5e005f42019-08-05 15:29:14 +0200762 false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800763 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200764}
pbos@webrtc.org744fbc72013-09-10 09:26:25 +0000765} // namespace webrtc