blob: b5cf651f3c49fad185e6df18bed4046ef6ede687 [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"
Steve Anton40d55332019-01-07 10:21:47 -080016#include "absl/memory/memory.h"
Danil Chapovalov4ba04b72019-06-26 15:49:47 +020017#include "api/rtc_event_log/rtc_event_log_factory.h"
Niels Möllerd8b9ed72019-05-08 13:53:51 +020018#include "api/rtc_event_log_output_file.h"
Danil Chapovalov304ea5f2019-04-11 15:18:18 +020019#include "api/task_queue/default_task_queue_factory.h"
20#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"
Tommi6b117a52019-08-20 09:58:56 +020026#include "rtc_base/time_utils.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020027#include "test/encoder_settings.h"
Per Kjellander914351d2019-02-15 10:54:55 +010028#include "test/field_trial.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020029#include "test/gtest.h"
30#include "test/testsupport/perf_test.h"
pbos@webrtc.org744fbc72013-09-10 09:26:25 +000031
Mirko Bonadei2ab97f62019-07-18 13:44:12 +020032ABSL_FLAG(std::string,
33 ramp_dump_name,
34 "",
35 "Filename for dumped received RTP stream.");
36
pbos@webrtc.org744fbc72013-09-10 09:26:25 +000037namespace webrtc {
pbos@webrtc.org29023282013-09-11 10:14:56 +000038namespace {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000039
Stefan Holmer723dff12015-10-05 14:59:41 +020040static const int64_t kPollIntervalMs = 20;
philipel5ef2bc12017-02-21 07:28:31 -080041static const int kExpectedHighVideoBitrateBps = 80000;
stefandb752f92016-12-05 08:23:40 -080042static const int kExpectedHighAudioBitrateBps = 30000;
43static const int kLowBandwidthLimitBps = 20000;
Sebastian Jansson12fb1702018-02-23 11:34:18 +010044// Set target detected bitrate to slightly larger than the target bitrate to
45// avoid flakiness.
46static const int kLowBitrateMarginBps = 2000;
pbos@webrtc.org29023282013-09-11 10:14:56 +000047
stefanff483612015-12-21 03:14:00 -080048std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000049 std::vector<uint32_t> ssrcs;
50 for (size_t i = 0; i != num_streams; ++i)
51 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i));
52 return ssrcs;
53}
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +000054} // namespace
henrik.lundin@webrtc.org845862f2014-03-06 07:19:28 +000055
Yves Gerey6516f762019-08-29 11:50:23 +020056RampUpTester::RampUpTester(
57 size_t num_video_streams,
58 size_t num_audio_streams,
59 size_t num_flexfec_streams,
60 unsigned int start_bitrate_bps,
61 int64_t min_run_time_ms,
62 const std::string& extension_type,
63 bool rtx,
64 bool red,
65 bool report_perf_stats,
66 test::DEPRECATED_SingleThreadedTaskQueueForTesting* task_queue)
stefan4fbd1452015-09-28 03:57:14 -070067 : EndToEndTest(test::CallTest::kLongTimeoutMs),
stefan4fbd1452015-09-28 03:57:14 -070068 clock_(Clock::GetRealTimeClock()),
stefanff483612015-12-21 03:14:00 -080069 num_video_streams_(num_video_streams),
70 num_audio_streams_(num_audio_streams),
philipel5ef2bc12017-02-21 07:28:31 -080071 num_flexfec_streams_(num_flexfec_streams),
stefan4fbd1452015-09-28 03:57:14 -070072 rtx_(rtx),
73 red_(red),
stefan45b5fe52017-03-09 06:27:02 -080074 report_perf_stats_(report_perf_stats),
mflodman86cc6ff2016-07-26 04:44:06 -070075 sender_call_(nullptr),
stefan4fbd1452015-09-28 03:57:14 -070076 send_stream_(nullptr),
sprang4847ae62017-06-27 07:06:52 -070077 send_transport_(nullptr),
Artem Titov631cafa2018-08-21 21:01:00 +020078 send_simulated_network_(nullptr),
stefan4fbd1452015-09-28 03:57:14 -070079 start_bitrate_bps_(start_bitrate_bps),
stefan5a2c5062017-01-27 06:43:18 -080080 min_run_time_ms_(min_run_time_ms),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000081 expected_bitrate_bps_(0),
Erik Språngf3a7c9d2015-10-05 14:03:22 +020082 test_start_ms_(-1),
stefan4fbd1452015-09-28 03:57:14 -070083 ramp_up_finished_ms_(-1),
84 extension_type_(extension_type),
stefanff483612015-12-21 03:14:00 -080085 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)),
86 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)),
87 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)),
Tommi5e005f42019-08-05 15:29:14 +020088 task_queue_(task_queue) {
philipel5ef2bc12017-02-21 07:28:31 -080089 if (red_)
90 EXPECT_EQ(0u, num_flexfec_streams_);
Stefan Holmerff2a6352016-01-14 10:00:21 +010091 EXPECT_LE(num_audio_streams_, 1u);
stefan4fbd1452015-09-28 03:57:14 -070092}
93
Tommi5e005f42019-08-05 15:29:14 +020094RampUpTester::~RampUpTester() {
95 // Special case for WebRTC-QuickPerfTest/Enabled/
96 task_queue_->SendTask([this]() {
97 if (pending_task_ !=
Yves Gerey6516f762019-08-29 11:50:23 +020098 static_cast<test::DEPRECATED_SingleThreadedTaskQueueForTesting::TaskId>(
99 -1)) {
Tommi5e005f42019-08-05 15:29:14 +0200100 task_queue_->CancelTask(pending_task_);
101 pending_task_ = -1;
102 }
103 });
104}
stefan4fbd1452015-09-28 03:57:14 -0700105
Niels Möllerde8e6e62018-11-13 15:10:33 +0100106void RampUpTester::ModifySenderBitrateConfig(
107 BitrateConstraints* bitrate_config) {
stefan4fbd1452015-09-28 03:57:14 -0700108 if (start_bitrate_bps_ != 0) {
Niels Möllerde8e6e62018-11-13 15:10:33 +0100109 bitrate_config->start_bitrate_bps = start_bitrate_bps_;
stefan4fbd1452015-09-28 03:57:14 -0700110 }
Niels Möllerde8e6e62018-11-13 15:10:33 +0100111 bitrate_config->min_bitrate_bps = 10000;
stefan4fbd1452015-09-28 03:57:14 -0700112}
113
stefanff483612015-12-21 03:14:00 -0800114void RampUpTester::OnVideoStreamsCreated(
stefan4fbd1452015-09-28 03:57:14 -0700115 VideoSendStream* send_stream,
116 const std::vector<VideoReceiveStream*>& receive_streams) {
117 send_stream_ = send_stream;
118}
119
eladalon413ee9a2017-08-22 04:02:52 -0700120test::PacketTransport* RampUpTester::CreateSendTransport(
Yves Gerey6516f762019-08-29 11:50:23 +0200121 test::DEPRECATED_SingleThreadedTaskQueueForTesting* task_queue,
eladalon413ee9a2017-08-22 04:02:52 -0700122 Call* sender_call) {
Artem Titov631cafa2018-08-21 21:01:00 +0200123 auto network = absl::make_unique<SimulatedNetwork>(forward_transport_config_);
124 send_simulated_network_ = network.get();
minyue20c84cc2017-04-10 16:57:57 -0700125 send_transport_ = new test::PacketTransport(
eladalon413ee9a2017-08-22 04:02:52 -0700126 task_queue, sender_call, this, test::PacketTransport::kSender,
Artem Titov4e199e92018-08-20 13:30:39 +0200127 test::CallTest::payload_type_map_,
Artem Titov631cafa2018-08-21 21:01:00 +0200128 absl::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
129 std::move(network)));
stefane74eef12016-01-08 06:47:13 -0800130 return send_transport_;
stefanf116bd02015-10-27 08:29:42 -0700131}
132
Stefan Holmerd20e6512016-01-12 15:51:22 +0100133size_t RampUpTester::GetNumVideoStreams() const {
134 return num_video_streams_;
135}
136
Stefan Holmerff2a6352016-01-14 10:00:21 +0100137size_t RampUpTester::GetNumAudioStreams() const {
138 return num_audio_streams_;
139}
140
philipel5ef2bc12017-02-21 07:28:31 -0800141size_t RampUpTester::GetNumFlexfecStreams() const {
142 return num_flexfec_streams_;
143}
144
perkjfa10b552016-10-02 23:45:26 -0700145class RampUpTester::VideoStreamFactory
146 : public VideoEncoderConfig::VideoStreamFactoryInterface {
147 public:
148 VideoStreamFactory() {}
149
150 private:
151 std::vector<VideoStream> CreateEncoderStreams(
152 int width,
153 int height,
154 const VideoEncoderConfig& encoder_config) override {
155 std::vector<VideoStream> streams =
156 test::CreateVideoStreams(width, height, encoder_config);
157 if (encoder_config.number_of_streams == 1) {
158 streams[0].target_bitrate_bps = streams[0].max_bitrate_bps = 2000000;
159 }
160 return streams;
161 }
162};
163
stefanff483612015-12-21 03:14:00 -0800164void RampUpTester::ModifyVideoConfigs(
stefan4fbd1452015-09-28 03:57:14 -0700165 VideoSendStream::Config* send_config,
166 std::vector<VideoReceiveStream::Config>* receive_configs,
167 VideoEncoderConfig* encoder_config) {
168 send_config->suspend_below_min_bitrate = true;
perkjfa10b552016-10-02 23:45:26 -0700169 encoder_config->number_of_streams = num_video_streams_;
170 encoder_config->max_bitrate_bps = 2000000;
171 encoder_config->video_stream_factory =
172 new rtc::RefCountedObject<RampUpTester::VideoStreamFactory>();
stefanff483612015-12-21 03:14:00 -0800173 if (num_video_streams_ == 1) {
stefan4fbd1452015-09-28 03:57:14 -0700174 // For single stream rampup until 1mbps
175 expected_bitrate_bps_ = kSingleStreamTargetBps;
176 } else {
Ilya Nikolaevskiyb0588e62018-08-27 14:12:27 +0200177 // To ensure simulcast rate allocation.
178 send_config->rtp.payload_name = "VP8";
179 encoder_config->codec_type = kVideoCodecVP8;
perkjfa10b552016-10-02 23:45:26 -0700180 std::vector<VideoStream> streams = test::CreateVideoStreams(
181 test::CallTest::kDefaultWidth, test::CallTest::kDefaultHeight,
182 *encoder_config);
Ilya Nikolaevskiyb0588e62018-08-27 14:12:27 +0200183 // For multi stream rampup until all streams are being sent. That means
184 // enough bitrate to send all the target streams plus the min bitrate of
185 // the last one.
perkjfa10b552016-10-02 23:45:26 -0700186 expected_bitrate_bps_ = streams.back().min_bitrate_bps;
187 for (size_t i = 0; i < streams.size() - 1; ++i) {
188 expected_bitrate_bps_ += streams[i].target_bitrate_bps;
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000189 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000190 }
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000191
stefan4fbd1452015-09-28 03:57:14 -0700192 send_config->rtp.extensions.clear();
193
194 bool remb;
stefan43edf0f2015-11-20 18:05:48 -0800195 bool transport_cc;
isheriff6f8d6862016-05-26 11:24:55 -0700196 if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
stefan4fbd1452015-09-28 03:57:14 -0700197 remb = true;
stefan43edf0f2015-11-20 18:05:48 -0800198 transport_cc = false;
stefan4fbd1452015-09-28 03:57:14 -0700199 send_config->rtp.extensions.push_back(
200 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
isheriff6f8d6862016-05-26 11:24:55 -0700201 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
stefan4fbd1452015-09-28 03:57:14 -0700202 remb = false;
stefan43edf0f2015-11-20 18:05:48 -0800203 transport_cc = true;
stefan4fbd1452015-09-28 03:57:14 -0700204 send_config->rtp.extensions.push_back(RtpExtension(
205 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000206 } else {
stefan4fbd1452015-09-28 03:57:14 -0700207 remb = true;
stefan43edf0f2015-11-20 18:05:48 -0800208 transport_cc = false;
stefan4fbd1452015-09-28 03:57:14 -0700209 send_config->rtp.extensions.push_back(RtpExtension(
210 extension_type_.c_str(), kTransmissionTimeOffsetExtensionId));
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000211 }
stefan4fbd1452015-09-28 03:57:14 -0700212
213 send_config->rtp.nack.rtp_history_ms = test::CallTest::kNackRtpHistoryMs;
stefanff483612015-12-21 03:14:00 -0800214 send_config->rtp.ssrcs = video_ssrcs_;
stefan4fbd1452015-09-28 03:57:14 -0700215 if (rtx_) {
216 send_config->rtp.rtx.payload_type = test::CallTest::kSendRtxPayloadType;
stefanff483612015-12-21 03:14:00 -0800217 send_config->rtp.rtx.ssrcs = video_rtx_ssrcs_;
stefan4fbd1452015-09-28 03:57:14 -0700218 }
219 if (red_) {
brandtrb5f2c3f2016-10-04 23:28:39 -0700220 send_config->rtp.ulpfec.ulpfec_payload_type =
stefan4fbd1452015-09-28 03:57:14 -0700221 test::CallTest::kUlpfecPayloadType;
brandtrb5f2c3f2016-10-04 23:28:39 -0700222 send_config->rtp.ulpfec.red_payload_type = test::CallTest::kRedPayloadType;
brandtrfbfb5362016-11-17 04:18:37 -0800223 if (rtx_) {
224 send_config->rtp.ulpfec.red_rtx_payload_type =
225 test::CallTest::kRtxRedPayloadType;
226 }
stefan4fbd1452015-09-28 03:57:14 -0700227 }
228
229 size_t i = 0;
230 for (VideoReceiveStream::Config& recv_config : *receive_configs) {
231 recv_config.rtp.remb = remb;
stefan43edf0f2015-11-20 18:05:48 -0800232 recv_config.rtp.transport_cc = transport_cc;
stefan4fbd1452015-09-28 03:57:14 -0700233 recv_config.rtp.extensions = send_config->rtp.extensions;
Ilya Nikolaevskiyb0588e62018-08-27 14:12:27 +0200234 recv_config.decoders.reserve(1);
235 recv_config.decoders[0].payload_type = send_config->rtp.payload_type;
Niels Möllercb7e1d22018-09-11 15:56:04 +0200236 recv_config.decoders[0].video_format =
237 SdpVideoFormat(send_config->rtp.payload_name);
stefan4fbd1452015-09-28 03:57:14 -0700238
stefanff483612015-12-21 03:14:00 -0800239 recv_config.rtp.remote_ssrc = video_ssrcs_[i];
stefan4fbd1452015-09-28 03:57:14 -0700240 recv_config.rtp.nack.rtp_history_ms = send_config->rtp.nack.rtp_history_ms;
241
242 if (red_) {
nisse3b3622f2017-09-26 02:49:21 -0700243 recv_config.rtp.red_payload_type =
brandtrb5f2c3f2016-10-04 23:28:39 -0700244 send_config->rtp.ulpfec.red_payload_type;
nisse3b3622f2017-09-26 02:49:21 -0700245 recv_config.rtp.ulpfec_payload_type =
brandtrb5f2c3f2016-10-04 23:28:39 -0700246 send_config->rtp.ulpfec.ulpfec_payload_type;
brandtrfbfb5362016-11-17 04:18:37 -0800247 if (rtx_) {
nisseca5706d2017-09-11 02:32:16 -0700248 recv_config.rtp.rtx_associated_payload_types
249 [send_config->rtp.ulpfec.red_rtx_payload_type] =
250 send_config->rtp.ulpfec.red_payload_type;
brandtrfbfb5362016-11-17 04:18:37 -0800251 }
stefan4fbd1452015-09-28 03:57:14 -0700252 }
253
254 if (rtx_) {
brandtr14742122017-01-27 04:53:07 -0800255 recv_config.rtp.rtx_ssrc = video_rtx_ssrcs_[i];
256 recv_config.rtp
nisse26e3abb2017-08-25 04:44:25 -0700257 .rtx_associated_payload_types[send_config->rtp.rtx.payload_type] =
Niels Möller259a4972018-04-05 15:36:51 +0200258 send_config->rtp.payload_type;
stefan4fbd1452015-09-28 03:57:14 -0700259 }
260 ++i;
261 }
philipel5ef2bc12017-02-21 07:28:31 -0800262
263 RTC_DCHECK_LE(num_flexfec_streams_, 1);
264 if (num_flexfec_streams_ == 1) {
265 send_config->rtp.flexfec.payload_type = test::CallTest::kFlexfecPayloadType;
266 send_config->rtp.flexfec.ssrc = test::CallTest::kFlexfecSendSsrc;
267 send_config->rtp.flexfec.protected_media_ssrcs = {video_ssrcs_[0]};
268 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000269}
270
Stefan Holmerff2a6352016-01-14 10:00:21 +0100271void RampUpTester::ModifyAudioConfigs(
272 AudioSendStream::Config* send_config,
273 std::vector<AudioReceiveStream::Config>* receive_configs) {
274 if (num_audio_streams_ == 0)
275 return;
276
isheriff6f8d6862016-05-26 11:24:55 -0700277 EXPECT_NE(RtpExtension::kTimestampOffsetUri, extension_type_)
Stefan Holmerff2a6352016-01-14 10:00:21 +0100278 << "Audio BWE not supported with toffset.";
philipel5ef2bc12017-02-21 07:28:31 -0800279 EXPECT_NE(RtpExtension::kAbsSendTimeUri, extension_type_)
280 << "Audio BWE not supported with abs-send-time.";
Stefan Holmerff2a6352016-01-14 10:00:21 +0100281
282 send_config->rtp.ssrc = audio_ssrcs_[0];
283 send_config->rtp.extensions.clear();
284
minyue10cbb462016-11-07 09:29:22 -0800285 send_config->min_bitrate_bps = 6000;
286 send_config->max_bitrate_bps = 60000;
mflodman86cc6ff2016-07-26 04:44:06 -0700287
Stefan Holmerff2a6352016-01-14 10:00:21 +0100288 bool transport_cc = false;
philipel5ef2bc12017-02-21 07:28:31 -0800289 if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
Stefan Holmerff2a6352016-01-14 10:00:21 +0100290 transport_cc = true;
291 send_config->rtp.extensions.push_back(RtpExtension(
292 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
293 }
294
295 for (AudioReceiveStream::Config& recv_config : *receive_configs) {
Stefan Holmerff2a6352016-01-14 10:00:21 +0100296 recv_config.rtp.transport_cc = transport_cc;
297 recv_config.rtp.extensions = send_config->rtp.extensions;
298 recv_config.rtp.remote_ssrc = send_config->rtp.ssrc;
299 }
300}
301
philipel5ef2bc12017-02-21 07:28:31 -0800302void RampUpTester::ModifyFlexfecConfigs(
303 std::vector<FlexfecReceiveStream::Config>* receive_configs) {
304 if (num_flexfec_streams_ == 0)
305 return;
306 RTC_DCHECK_EQ(1, num_flexfec_streams_);
307 (*receive_configs)[0].payload_type = test::CallTest::kFlexfecPayloadType;
308 (*receive_configs)[0].remote_ssrc = test::CallTest::kFlexfecSendSsrc;
309 (*receive_configs)[0].protected_media_ssrcs = {video_ssrcs_[0]};
310 (*receive_configs)[0].local_ssrc = video_ssrcs_[0];
311 if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
312 (*receive_configs)[0].transport_cc = false;
313 (*receive_configs)[0].rtp_header_extensions.push_back(
314 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
315 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
316 (*receive_configs)[0].transport_cc = true;
317 (*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension(
318 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
319 }
320}
321
stefan4fbd1452015-09-28 03:57:14 -0700322void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
Tommi5e005f42019-08-05 15:29:14 +0200323 RTC_DCHECK(sender_call);
stefan4fbd1452015-09-28 03:57:14 -0700324 sender_call_ = sender_call;
Tommi5e005f42019-08-05 15:29:14 +0200325 pending_task_ = task_queue_->PostTask([this]() { PollStats(); });
pbos@webrtc.org32452b22014-10-22 12:15:24 +0000326}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000327
tommi0f8b4032017-02-22 11:22:05 -0800328void RampUpTester::PollStats() {
Tommi6b117a52019-08-20 09:58:56 +0200329 RTC_DCHECK_RUN_ON(task_queue_);
330
331 EnsurePollTimeSet();
332
Tommi5e005f42019-08-05 15:29:14 +0200333 pending_task_ = -1;
334 Call::Stats stats = sender_call_->GetStats();
335 EXPECT_GE(expected_bitrate_bps_, 0);
stefan4fbd1452015-09-28 03:57:14 -0700336
Tommi5e005f42019-08-05 15:29:14 +0200337 if (stats.send_bandwidth_bps >= expected_bitrate_bps_ &&
338 (min_run_time_ms_ == -1 ||
339 clock_->TimeInMilliseconds() - test_start_ms_ >= min_run_time_ms_)) {
340 ramp_up_finished_ms_ = clock_->TimeInMilliseconds();
341 observation_complete_.Set();
342 } else {
343 pending_task_ = task_queue_->PostDelayedTask([this]() { PollStats(); },
Tommi6b117a52019-08-20 09:58:56 +0200344 GetIntervalForNextPoll());
Tommi5e005f42019-08-05 15:29:14 +0200345 }
Erik Språng468e62a2015-07-06 10:50:47 +0200346}
347
stefan4fbd1452015-09-28 03:57:14 -0700348void RampUpTester::ReportResult(const std::string& measurement,
349 size_t value,
350 const std::string& units) const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000351 webrtc::test::PrintResult(
352 measurement, "",
stefanff483612015-12-21 03:14:00 -0800353 ::testing::UnitTest::GetInstance()->current_test_info()->name(), value,
354 units, false);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000355}
356
stefan092508a2015-09-29 02:26:42 -0700357void RampUpTester::AccumulateStats(const VideoSendStream::StreamStats& stream,
358 size_t* total_packets_sent,
359 size_t* total_sent,
360 size_t* padding_sent,
361 size_t* media_sent) const {
stefan4fbd1452015-09-28 03:57:14 -0700362 *total_packets_sent += stream.rtp_stats.transmitted.packets +
363 stream.rtp_stats.retransmitted.packets +
364 stream.rtp_stats.fec.packets;
365 *total_sent += stream.rtp_stats.transmitted.TotalBytes() +
366 stream.rtp_stats.retransmitted.TotalBytes() +
367 stream.rtp_stats.fec.TotalBytes();
368 *padding_sent += stream.rtp_stats.transmitted.padding_bytes +
369 stream.rtp_stats.retransmitted.padding_bytes +
370 stream.rtp_stats.fec.padding_bytes;
371 *media_sent += stream.rtp_stats.MediaPayloadBytes();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000372}
373
stefan4fbd1452015-09-28 03:57:14 -0700374void RampUpTester::TriggerTestDone() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200375 RTC_DCHECK_GE(test_start_ms_, 0);
376
Stefan Holmerff2a6352016-01-14 10:00:21 +0100377 // TODO(holmer): Add audio send stats here too when those APIs are available.
mflodman86cc6ff2016-07-26 04:44:06 -0700378 if (!send_stream_)
379 return;
380
Tommi5e005f42019-08-05 15:29:14 +0200381 // Stop polling stats.
382 // Corner case for field_trials=WebRTC-QuickPerfTest/Enabled/
383 task_queue_->SendTask([this]() {
384 if (pending_task_ !=
Yves Gerey6516f762019-08-29 11:50:23 +0200385 static_cast<test::DEPRECATED_SingleThreadedTaskQueueForTesting::TaskId>(
386 -1)) {
Tommi5e005f42019-08-05 15:29:14 +0200387 task_queue_->CancelTask(pending_task_);
388 pending_task_ = -1;
389 }
390 });
391
stefan4fbd1452015-09-28 03:57:14 -0700392 VideoSendStream::Stats send_stats = send_stream_->GetStats();
Tommi5e005f42019-08-05 15:29:14 +0200393 send_stream_ = nullptr; // To avoid dereferencing a bad pointer.
stefan4fbd1452015-09-28 03:57:14 -0700394
395 size_t total_packets_sent = 0;
396 size_t total_sent = 0;
397 size_t padding_sent = 0;
398 size_t media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800399 for (uint32_t ssrc : video_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700400 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent,
401 &total_sent, &padding_sent, &media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700402 }
403
404 size_t rtx_total_packets_sent = 0;
405 size_t rtx_total_sent = 0;
406 size_t rtx_padding_sent = 0;
407 size_t rtx_media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800408 for (uint32_t rtx_ssrc : video_rtx_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700409 AccumulateStats(send_stats.substreams[rtx_ssrc], &rtx_total_packets_sent,
410 &rtx_total_sent, &rtx_padding_sent, &rtx_media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700411 }
412
stefan5a2c5062017-01-27 06:43:18 -0800413 if (report_perf_stats_) {
stefan5a2c5062017-01-27 06:43:18 -0800414 ReportResult("ramp-up-media-sent", media_sent, "bytes");
415 ReportResult("ramp-up-padding-sent", padding_sent, "bytes");
stefan5a2c5062017-01-27 06:43:18 -0800416 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes");
417 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes");
418 if (ramp_up_finished_ms_ >= 0) {
419 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_,
420 "milliseconds");
421 }
422 ReportResult("ramp-up-average-network-latency",
423 send_transport_->GetAverageDelayMs(), "milliseconds");
stefan4fbd1452015-09-28 03:57:14 -0700424 }
425}
426
427void RampUpTester::PerformTest() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200428 test_start_ms_ = clock_->TimeInMilliseconds();
Peter Boström5811a392015-12-10 13:02:50 +0100429 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete.";
stefan4fbd1452015-09-28 03:57:14 -0700430 TriggerTestDone();
431}
432
Tommi6b117a52019-08-20 09:58:56 +0200433void RampUpTester::EnsurePollTimeSet() {
434 RTC_DCHECK_RUN_ON(task_queue_);
435 if (!next_scheduled_poll_time_ms_)
436 next_scheduled_poll_time_ms_ = rtc::TimeMillis();
437}
438
439int64_t RampUpTester::GetIntervalForNextPoll() {
440 RTC_DCHECK_RUN_ON(task_queue_);
441 RTC_DCHECK_NE(next_scheduled_poll_time_ms_, 0)
442 << "No call to EnsurePollTimeSet()";
443 auto now = rtc::TimeMillis();
444 next_scheduled_poll_time_ms_ += kPollIntervalMs;
445 auto interval = next_scheduled_poll_time_ms_ - now;
446 return interval > 0 ? interval : 0;
447}
448
Tommi5e005f42019-08-05 15:29:14 +0200449RampUpDownUpTester::RampUpDownUpTester(
450 size_t num_video_streams,
451 size_t num_audio_streams,
452 size_t num_flexfec_streams,
453 unsigned int start_bitrate_bps,
454 const std::string& extension_type,
455 bool rtx,
456 bool red,
457 const std::vector<int>& loss_rates,
458 bool report_perf_stats,
Yves Gerey6516f762019-08-29 11:50:23 +0200459 test::DEPRECATED_SingleThreadedTaskQueueForTesting* task_queue)
Stefan Holmerff2a6352016-01-14 10:00:21 +0100460 : RampUpTester(num_video_streams,
461 num_audio_streams,
philipel5ef2bc12017-02-21 07:28:31 -0800462 num_flexfec_streams,
Stefan Holmerff2a6352016-01-14 10:00:21 +0100463 start_bitrate_bps,
stefan5a2c5062017-01-27 06:43:18 -0800464 0,
Stefan Holmerff2a6352016-01-14 10:00:21 +0100465 extension_type,
466 rtx,
stefan5a2c5062017-01-27 06:43:18 -0800467 red,
Tommi5e005f42019-08-05 15:29:14 +0200468 report_perf_stats,
469 task_queue),
stefan76d9c9c2017-04-01 06:51:09 -0700470 link_rates_({4 * GetExpectedHighBitrate() / (3 * 1000),
471 kLowBandwidthLimitBps / 1000,
472 4 * GetExpectedHighBitrate() / (3 * 1000), 0}),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000473 test_state_(kFirstRampup),
philipel5ef2bc12017-02-21 07:28:31 -0800474 next_state_(kTransitionToNextState),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000475 state_start_ms_(clock_->TimeInMilliseconds()),
stefan4fbd1452015-09-28 03:57:14 -0700476 interval_start_ms_(clock_->TimeInMilliseconds()),
philipel5ef2bc12017-02-21 07:28:31 -0800477 sent_bytes_(0),
478 loss_rates_(loss_rates) {
479 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
480 forward_transport_config_.queue_delay_ms = 100;
481 forward_transport_config_.loss_percent = loss_rates_[test_state_];
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000482}
483
stefan4fbd1452015-09-28 03:57:14 -0700484RampUpDownUpTester::~RampUpDownUpTester() {}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000485
tommi0f8b4032017-02-22 11:22:05 -0800486void RampUpDownUpTester::PollStats() {
Tommi6b117a52019-08-20 09:58:56 +0200487 EnsurePollTimeSet();
488
Tommi5e005f42019-08-05 15:29:14 +0200489 pending_task_ = -1;
490 bool last_round = (test_state_ == kTestEnd);
491
492 int transmit_bitrate_bps = 0;
493 bool suspended = false;
494 if (num_video_streams_ > 0 && send_stream_) {
495 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
496 for (const auto& it : stats.substreams) {
497 transmit_bitrate_bps += it.second.total_bitrate_bps;
Alex Narest78609d52017-10-20 10:37:47 +0200498 }
Tommi5e005f42019-08-05 15:29:14 +0200499 suspended = stats.suspended;
500 }
501 if (num_audio_streams_ > 0 && sender_call_) {
502 // An audio send stream doesn't have bitrate stats, so the call send BW is
503 // currently used instead.
504 transmit_bitrate_bps = sender_call_->GetStats().send_bandwidth_bps;
505 }
506
507 EvolveTestState(transmit_bitrate_bps, suspended);
508
509 if (!last_round) {
510 pending_task_ = task_queue_->PostDelayedTask([this]() { PollStats(); },
Tommi6b117a52019-08-20 09:58:56 +0200511 GetIntervalForNextPoll());
Tommi5e005f42019-08-05 15:29:14 +0200512 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000513}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000514
Niels Möllerde8e6e62018-11-13 15:10:33 +0100515void RampUpDownUpTester::ModifyReceiverBitrateConfig(
516 BitrateConstraints* bitrate_config) {
517 bitrate_config->min_bitrate_bps = 10000;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000518}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000519
stefan4fbd1452015-09-28 03:57:14 -0700520std::string RampUpDownUpTester::GetModifierString() const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000521 std::string str("_");
stefanff483612015-12-21 03:14:00 -0800522 if (num_video_streams_ > 0) {
Jonas Olsson0a713b62018-04-04 15:49:32 +0200523 str += rtc::ToString(num_video_streams_);
stefanff483612015-12-21 03:14:00 -0800524 str += "stream";
525 str += (num_video_streams_ > 1 ? "s" : "");
526 str += "_";
527 }
528 if (num_audio_streams_ > 0) {
Jonas Olsson0a713b62018-04-04 15:49:32 +0200529 str += rtc::ToString(num_audio_streams_);
stefanff483612015-12-21 03:14:00 -0800530 str += "stream";
531 str += (num_audio_streams_ > 1 ? "s" : "");
532 str += "_";
533 }
stefan4fbd1452015-09-28 03:57:14 -0700534 str += (rtx_ ? "" : "no");
Edward Lemurdd3987f2018-01-04 19:44:54 +0100535 str += "rtx_";
536 str += (red_ ? "" : "no");
537 str += "red";
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000538 return str;
539}
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000540
stefandb752f92016-12-05 08:23:40 -0800541int RampUpDownUpTester::GetExpectedHighBitrate() const {
stefan38d8b3c2017-01-09 04:19:24 -0800542 int expected_bitrate_bps = 0;
543 if (num_audio_streams_ > 0)
544 expected_bitrate_bps += kExpectedHighAudioBitrateBps;
545 if (num_video_streams_ > 0)
546 expected_bitrate_bps += kExpectedHighVideoBitrateBps;
547 return expected_bitrate_bps;
548}
549
philipel5ef2bc12017-02-21 07:28:31 -0800550size_t RampUpDownUpTester::GetFecBytes() const {
551 size_t flex_fec_bytes = 0;
552 if (num_flexfec_streams_ > 0) {
553 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
554 for (const auto& kv : stats.substreams)
555 flex_fec_bytes += kv.second.rtp_stats.fec.TotalBytes();
556 }
557 return flex_fec_bytes;
558}
559
560bool RampUpDownUpTester::ExpectingFec() const {
561 return num_flexfec_streams_ > 0 && forward_transport_config_.loss_percent > 0;
562}
563
stefan4fbd1452015-09-28 03:57:14 -0700564void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000565 int64_t now = clock_->TimeInMilliseconds();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000566 switch (test_state_) {
philipel5ef2bc12017-02-21 07:28:31 -0800567 case kFirstRampup:
stefan4fbd1452015-09-28 03:57:14 -0700568 EXPECT_FALSE(suspended);
stefandb752f92016-12-05 08:23:40 -0800569 if (bitrate_bps >= GetExpectedHighBitrate()) {
stefan45b5fe52017-03-09 06:27:02 -0800570 if (report_perf_stats_) {
571 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
572 "first_rampup", now - state_start_ms_, "ms",
573 false);
574 }
philipel5ef2bc12017-02-21 07:28:31 -0800575 // Apply loss during the transition between states if FEC is enabled.
576 forward_transport_config_.loss_percent = loss_rates_[test_state_];
577 test_state_ = kTransitionToNextState;
578 next_state_ = kLowRate;
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000579 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000580 break;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000581 case kLowRate: {
mflodman86cc6ff2016-07-26 04:44:06 -0700582 // Audio streams are never suspended.
583 bool check_suspend_state = num_video_streams_ > 0;
Sebastian Jansson12fb1702018-02-23 11:34:18 +0100584 if (bitrate_bps < kLowBandwidthLimitBps + kLowBitrateMarginBps &&
mflodman86cc6ff2016-07-26 04:44:06 -0700585 suspended == check_suspend_state) {
stefan45b5fe52017-03-09 06:27:02 -0800586 if (report_perf_stats_) {
587 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
588 "rampdown", now - state_start_ms_, "ms",
589 false);
590 }
philipel5ef2bc12017-02-21 07:28:31 -0800591 // Apply loss during the transition between states if FEC is enabled.
592 forward_transport_config_.loss_percent = loss_rates_[test_state_];
593 test_state_ = kTransitionToNextState;
594 next_state_ = kSecondRampup;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000595 }
596 break;
597 }
philipel5ef2bc12017-02-21 07:28:31 -0800598 case kSecondRampup:
stefandb752f92016-12-05 08:23:40 -0800599 if (bitrate_bps >= GetExpectedHighBitrate() && !suspended) {
stefan45b5fe52017-03-09 06:27:02 -0800600 if (report_perf_stats_) {
601 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
602 "second_rampup", now - state_start_ms_,
603 "ms", false);
604 ReportResult("ramp-up-down-up-average-network-latency",
605 send_transport_->GetAverageDelayMs(), "milliseconds");
606 }
philipel5ef2bc12017-02-21 07:28:31 -0800607 // Apply loss during the transition between states if FEC is enabled.
608 forward_transport_config_.loss_percent = loss_rates_[test_state_];
609 test_state_ = kTransitionToNextState;
610 next_state_ = kTestEnd;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000611 }
612 break;
philipel5ef2bc12017-02-21 07:28:31 -0800613 case kTestEnd:
614 observation_complete_.Set();
615 break;
616 case kTransitionToNextState:
617 if (!ExpectingFec() || GetFecBytes() > 0) {
618 test_state_ = next_state_;
619 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
620 // No loss while ramping up and down as it may affect the BWE
621 // negatively, making the test flaky.
622 forward_transport_config_.loss_percent = 0;
623 state_start_ms_ = now;
624 interval_start_ms_ = now;
625 sent_bytes_ = 0;
Artem Titov631cafa2018-08-21 21:01:00 +0200626 send_simulated_network_->SetConfig(forward_transport_config_);
philipel5ef2bc12017-02-21 07:28:31 -0800627 }
628 break;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000629 }
630}
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000631
stefan4fbd1452015-09-28 03:57:14 -0700632class RampUpTest : public test::CallTest {
Erik Språng6b8d3552015-09-24 15:06:57 +0200633 public:
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200634 RampUpTest()
635 : task_queue_factory_(CreateDefaultTaskQueueFactory()),
636 rtc_event_log_factory_(task_queue_factory_.get()) {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200637 std::string dump_name(absl::GetFlag(FLAGS_ramp_dump_name));
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200638 if (!dump_name.empty()) {
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200639 send_event_log_ = rtc_event_log_factory_.CreateRtcEventLog(
640 RtcEventLog::EncodingType::Legacy);
641 recv_event_log_ = rtc_event_log_factory_.CreateRtcEventLog(
642 RtcEventLog::EncodingType::Legacy);
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200643 bool event_log_started =
644 send_event_log_->StartLogging(
645 absl::make_unique<RtcEventLogOutputFile>(
646 dump_name + ".send.rtc.dat", RtcEventLog::kUnlimitedOutput),
647 RtcEventLog::kImmediateOutput) &&
648 recv_event_log_->StartLogging(
649 absl::make_unique<RtcEventLogOutputFile>(
650 dump_name + ".recv.rtc.dat", RtcEventLog::kUnlimitedOutput),
651 RtcEventLog::kImmediateOutput);
652 RTC_DCHECK(event_log_started);
653 }
654 }
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200655
656 private:
657 const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
658 RtcEventLogFactory rtc_event_log_factory_;
Erik Språng6b8d3552015-09-24 15:06:57 +0200659};
660
Stefan Holmerff2a6352016-01-14 10:00:21 +0100661static const uint32_t kStartBitrateBps = 60000;
662
stefan38d8b3c2017-01-09 04:19:24 -0800663TEST_F(RampUpTest, UpDownUpAbsSendTimeSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800664 std::vector<int> loss_rates = {0, 0, 0, 0};
665 RampUpDownUpTester test(3, 0, 0, kStartBitrateBps,
stefan45b5fe52017-03-09 06:27:02 -0800666 RtpExtension::kAbsSendTimeUri, true, true, loss_rates,
Tommi5e005f42019-08-05 15:29:14 +0200667 true, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800668 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800669}
Stefan Holmerff2a6352016-01-14 10:00:21 +0100670
Taylor Brandstetterba6b5032018-02-16 09:59:56 -0800671// TODO(bugs.webrtc.org/8878)
672#if defined(WEBRTC_MAC)
673#define MAYBE_UpDownUpTransportSequenceNumberRtx \
674 DISABLED_UpDownUpTransportSequenceNumberRtx
675#else
676#define MAYBE_UpDownUpTransportSequenceNumberRtx \
677 UpDownUpTransportSequenceNumberRtx
678#endif
679TEST_F(RampUpTest, MAYBE_UpDownUpTransportSequenceNumberRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800680 std::vector<int> loss_rates = {0, 0, 0, 0};
681 RampUpDownUpTester test(3, 0, 0, kStartBitrateBps,
isheriff6f8d6862016-05-26 11:24:55 -0700682 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200683 false, loss_rates, true, &task_queue_);
philipel5ef2bc12017-02-21 07:28:31 -0800684 RunBaseTest(&test);
685}
686
stefan45b5fe52017-03-09 06:27:02 -0800687// TODO(holmer): Tests which don't report perf stats should be moved to a
688// different executable since they per definition are not perf tests.
Taylor Brandstetter05d98222017-10-10 12:12:53 -0700689// This test is disabled because it crashes on Linux, and is flaky on other
690// platforms. See: crbug.com/webrtc/7919
691TEST_F(RampUpTest, DISABLED_UpDownUpTransportSequenceNumberPacketLoss) {
philipel5ef2bc12017-02-21 07:28:31 -0800692 std::vector<int> loss_rates = {20, 0, 0, 0};
693 RampUpDownUpTester test(1, 0, 1, kStartBitrateBps,
694 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200695 false, loss_rates, false, &task_queue_);
Stefan Holmerff2a6352016-01-14 10:00:21 +0100696 RunBaseTest(&test);
697}
698
Taylor Brandstetterab86e7f2018-02-12 15:16:02 -0800699// TODO(bugs.webrtc.org/8878)
700#if defined(WEBRTC_MAC)
701#define MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx \
702 DISABLED_UpDownUpAudioVideoTransportSequenceNumberRtx
703#else
704#define MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx \
705 UpDownUpAudioVideoTransportSequenceNumberRtx
706#endif
707TEST_F(RampUpTest, MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx) {
Per Kjellander914351d2019-02-15 10:54:55 +0100708 test::ScopedFieldTrials field_trials("WebRTC-Audio-SendSideBwe/Enabled/");
philipel5ef2bc12017-02-21 07:28:31 -0800709 std::vector<int> loss_rates = {0, 0, 0, 0};
710 RampUpDownUpTester test(3, 1, 0, kStartBitrateBps,
isheriff6f8d6862016-05-26 11:24:55 -0700711 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200712 false, loss_rates, false, &task_queue_);
Stefan Holmerff2a6352016-01-14 10:00:21 +0100713 RunBaseTest(&test);
714}
715
stefan38d8b3c2017-01-09 04:19:24 -0800716TEST_F(RampUpTest, UpDownUpAudioTransportSequenceNumberRtx) {
Per Kjellander914351d2019-02-15 10:54:55 +0100717 test::ScopedFieldTrials field_trials("WebRTC-Audio-SendSideBwe/Enabled/");
philipel5ef2bc12017-02-21 07:28:31 -0800718 std::vector<int> loss_rates = {0, 0, 0, 0};
719 RampUpDownUpTester test(0, 1, 0, kStartBitrateBps,
mflodman86cc6ff2016-07-26 04:44:06 -0700720 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200721 false, loss_rates, false, &task_queue_);
mflodman86cc6ff2016-07-26 04:44:06 -0700722 RunBaseTest(&test);
723}
724
stefan38d8b3c2017-01-09 04:19:24 -0800725TEST_F(RampUpTest, TOffsetSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800726 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTimestampOffsetUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200727 true, true, &task_queue_);
stefan38d8b3c2017-01-09 04:19:24 -0800728 RunBaseTest(&test);
729}
730
731TEST_F(RampUpTest, AbsSendTime) {
philipel5ef2bc12017-02-21 07:28:31 -0800732 RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, false, false,
Tommi5e005f42019-08-05 15:29:14 +0200733 false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800734 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000735}
736
stefan38d8b3c2017-01-09 04:19:24 -0800737TEST_F(RampUpTest, AbsSendTimeSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800738 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, true, true,
Tommi5e005f42019-08-05 15:29:14 +0200739 true, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800740 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000741}
742
stefan38d8b3c2017-01-09 04:19:24 -0800743TEST_F(RampUpTest, TransportSequenceNumber) {
philipel5ef2bc12017-02-21 07:28:31 -0800744 RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200745 false, false, false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800746 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200747}
748
749TEST_F(RampUpTest, TransportSequenceNumberSimulcast) {
philipel5ef2bc12017-02-21 07:28:31 -0800750 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200751 false, false, false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800752 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200753}
754
stefan38d8b3c2017-01-09 04:19:24 -0800755TEST_F(RampUpTest, TransportSequenceNumberSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800756 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200757 true, true, true, &task_queue_);
stefan5a2c5062017-01-27 06:43:18 -0800758 RunBaseTest(&test);
759}
760
Niels Möllercd2e1052018-11-08 10:23:13 +0100761TEST_F(RampUpTest, AudioTransportSequenceNumber) {
philipel5ef2bc12017-02-21 07:28:31 -0800762 RampUpTester test(0, 1, 0, 300000, 10000,
stefan5a2c5062017-01-27 06:43:18 -0800763 RtpExtension::kTransportSequenceNumberUri, false, false,
Tommi5e005f42019-08-05 15:29:14 +0200764 false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800765 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200766}
pbos@webrtc.org744fbc72013-09-10 09:26:25 +0000767} // namespace webrtc