blob: b3f206325aec8faf0a126c3d9d86589459238b25 [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) {
stefan43edf0f2015-11-20 18:05:48 -0800231 recv_config.rtp.transport_cc = transport_cc;
stefan4fbd1452015-09-28 03:57:14 -0700232 recv_config.rtp.extensions = send_config->rtp.extensions;
Ilya Nikolaevskiyb0588e62018-08-27 14:12:27 +0200233 recv_config.decoders.reserve(1);
234 recv_config.decoders[0].payload_type = send_config->rtp.payload_type;
Niels Möllercb7e1d22018-09-11 15:56:04 +0200235 recv_config.decoders[0].video_format =
236 SdpVideoFormat(send_config->rtp.payload_name);
stefan4fbd1452015-09-28 03:57:14 -0700237
stefanff483612015-12-21 03:14:00 -0800238 recv_config.rtp.remote_ssrc = video_ssrcs_[i];
stefan4fbd1452015-09-28 03:57:14 -0700239 recv_config.rtp.nack.rtp_history_ms = send_config->rtp.nack.rtp_history_ms;
240
241 if (red_) {
nisse3b3622f2017-09-26 02:49:21 -0700242 recv_config.rtp.red_payload_type =
brandtrb5f2c3f2016-10-04 23:28:39 -0700243 send_config->rtp.ulpfec.red_payload_type;
nisse3b3622f2017-09-26 02:49:21 -0700244 recv_config.rtp.ulpfec_payload_type =
brandtrb5f2c3f2016-10-04 23:28:39 -0700245 send_config->rtp.ulpfec.ulpfec_payload_type;
brandtrfbfb5362016-11-17 04:18:37 -0800246 if (rtx_) {
nisseca5706d2017-09-11 02:32:16 -0700247 recv_config.rtp.rtx_associated_payload_types
248 [send_config->rtp.ulpfec.red_rtx_payload_type] =
249 send_config->rtp.ulpfec.red_payload_type;
brandtrfbfb5362016-11-17 04:18:37 -0800250 }
stefan4fbd1452015-09-28 03:57:14 -0700251 }
252
253 if (rtx_) {
brandtr14742122017-01-27 04:53:07 -0800254 recv_config.rtp.rtx_ssrc = video_rtx_ssrcs_[i];
255 recv_config.rtp
nisse26e3abb2017-08-25 04:44:25 -0700256 .rtx_associated_payload_types[send_config->rtp.rtx.payload_type] =
Niels Möller259a4972018-04-05 15:36:51 +0200257 send_config->rtp.payload_type;
stefan4fbd1452015-09-28 03:57:14 -0700258 }
259 ++i;
260 }
philipel5ef2bc12017-02-21 07:28:31 -0800261
262 RTC_DCHECK_LE(num_flexfec_streams_, 1);
263 if (num_flexfec_streams_ == 1) {
264 send_config->rtp.flexfec.payload_type = test::CallTest::kFlexfecPayloadType;
265 send_config->rtp.flexfec.ssrc = test::CallTest::kFlexfecSendSsrc;
266 send_config->rtp.flexfec.protected_media_ssrcs = {video_ssrcs_[0]};
267 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000268}
269
Stefan Holmerff2a6352016-01-14 10:00:21 +0100270void RampUpTester::ModifyAudioConfigs(
271 AudioSendStream::Config* send_config,
272 std::vector<AudioReceiveStream::Config>* receive_configs) {
273 if (num_audio_streams_ == 0)
274 return;
275
isheriff6f8d6862016-05-26 11:24:55 -0700276 EXPECT_NE(RtpExtension::kTimestampOffsetUri, extension_type_)
Stefan Holmerff2a6352016-01-14 10:00:21 +0100277 << "Audio BWE not supported with toffset.";
philipel5ef2bc12017-02-21 07:28:31 -0800278 EXPECT_NE(RtpExtension::kAbsSendTimeUri, extension_type_)
279 << "Audio BWE not supported with abs-send-time.";
Stefan Holmerff2a6352016-01-14 10:00:21 +0100280
281 send_config->rtp.ssrc = audio_ssrcs_[0];
282 send_config->rtp.extensions.clear();
283
minyue10cbb462016-11-07 09:29:22 -0800284 send_config->min_bitrate_bps = 6000;
285 send_config->max_bitrate_bps = 60000;
mflodman86cc6ff2016-07-26 04:44:06 -0700286
Stefan Holmerff2a6352016-01-14 10:00:21 +0100287 bool transport_cc = false;
philipel5ef2bc12017-02-21 07:28:31 -0800288 if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
Stefan Holmerff2a6352016-01-14 10:00:21 +0100289 transport_cc = true;
290 send_config->rtp.extensions.push_back(RtpExtension(
291 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
292 }
293
294 for (AudioReceiveStream::Config& recv_config : *receive_configs) {
Stefan Holmerff2a6352016-01-14 10:00:21 +0100295 recv_config.rtp.transport_cc = transport_cc;
296 recv_config.rtp.extensions = send_config->rtp.extensions;
297 recv_config.rtp.remote_ssrc = send_config->rtp.ssrc;
298 }
299}
300
philipel5ef2bc12017-02-21 07:28:31 -0800301void RampUpTester::ModifyFlexfecConfigs(
302 std::vector<FlexfecReceiveStream::Config>* receive_configs) {
303 if (num_flexfec_streams_ == 0)
304 return;
305 RTC_DCHECK_EQ(1, num_flexfec_streams_);
306 (*receive_configs)[0].payload_type = test::CallTest::kFlexfecPayloadType;
307 (*receive_configs)[0].remote_ssrc = test::CallTest::kFlexfecSendSsrc;
308 (*receive_configs)[0].protected_media_ssrcs = {video_ssrcs_[0]};
309 (*receive_configs)[0].local_ssrc = video_ssrcs_[0];
310 if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
311 (*receive_configs)[0].transport_cc = false;
312 (*receive_configs)[0].rtp_header_extensions.push_back(
313 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
314 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
315 (*receive_configs)[0].transport_cc = true;
316 (*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension(
317 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
318 }
319}
320
stefan4fbd1452015-09-28 03:57:14 -0700321void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
Tommi5e005f42019-08-05 15:29:14 +0200322 RTC_DCHECK(sender_call);
stefan4fbd1452015-09-28 03:57:14 -0700323 sender_call_ = sender_call;
Tommi5e005f42019-08-05 15:29:14 +0200324 pending_task_ = task_queue_->PostTask([this]() { PollStats(); });
pbos@webrtc.org32452b22014-10-22 12:15:24 +0000325}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000326
tommi0f8b4032017-02-22 11:22:05 -0800327void RampUpTester::PollStats() {
Tommi6b117a52019-08-20 09:58:56 +0200328 RTC_DCHECK_RUN_ON(task_queue_);
329
330 EnsurePollTimeSet();
331
Tommi5e005f42019-08-05 15:29:14 +0200332 pending_task_ = -1;
333 Call::Stats stats = sender_call_->GetStats();
334 EXPECT_GE(expected_bitrate_bps_, 0);
stefan4fbd1452015-09-28 03:57:14 -0700335
Tommi5e005f42019-08-05 15:29:14 +0200336 if (stats.send_bandwidth_bps >= expected_bitrate_bps_ &&
337 (min_run_time_ms_ == -1 ||
338 clock_->TimeInMilliseconds() - test_start_ms_ >= min_run_time_ms_)) {
339 ramp_up_finished_ms_ = clock_->TimeInMilliseconds();
340 observation_complete_.Set();
341 } else {
342 pending_task_ = task_queue_->PostDelayedTask([this]() { PollStats(); },
Tommi6b117a52019-08-20 09:58:56 +0200343 GetIntervalForNextPoll());
Tommi5e005f42019-08-05 15:29:14 +0200344 }
Erik Språng468e62a2015-07-06 10:50:47 +0200345}
346
stefan4fbd1452015-09-28 03:57:14 -0700347void RampUpTester::ReportResult(const std::string& measurement,
348 size_t value,
349 const std::string& units) const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000350 webrtc::test::PrintResult(
351 measurement, "",
stefanff483612015-12-21 03:14:00 -0800352 ::testing::UnitTest::GetInstance()->current_test_info()->name(), value,
353 units, false);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000354}
355
stefan092508a2015-09-29 02:26:42 -0700356void RampUpTester::AccumulateStats(const VideoSendStream::StreamStats& stream,
357 size_t* total_packets_sent,
358 size_t* total_sent,
359 size_t* padding_sent,
360 size_t* media_sent) const {
stefan4fbd1452015-09-28 03:57:14 -0700361 *total_packets_sent += stream.rtp_stats.transmitted.packets +
362 stream.rtp_stats.retransmitted.packets +
363 stream.rtp_stats.fec.packets;
364 *total_sent += stream.rtp_stats.transmitted.TotalBytes() +
365 stream.rtp_stats.retransmitted.TotalBytes() +
366 stream.rtp_stats.fec.TotalBytes();
367 *padding_sent += stream.rtp_stats.transmitted.padding_bytes +
368 stream.rtp_stats.retransmitted.padding_bytes +
369 stream.rtp_stats.fec.padding_bytes;
370 *media_sent += stream.rtp_stats.MediaPayloadBytes();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000371}
372
stefan4fbd1452015-09-28 03:57:14 -0700373void RampUpTester::TriggerTestDone() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200374 RTC_DCHECK_GE(test_start_ms_, 0);
375
Stefan Holmerff2a6352016-01-14 10:00:21 +0100376 // TODO(holmer): Add audio send stats here too when those APIs are available.
mflodman86cc6ff2016-07-26 04:44:06 -0700377 if (!send_stream_)
378 return;
379
Tommi5e005f42019-08-05 15:29:14 +0200380 // Stop polling stats.
381 // Corner case for field_trials=WebRTC-QuickPerfTest/Enabled/
382 task_queue_->SendTask([this]() {
383 if (pending_task_ !=
Yves Gerey6516f762019-08-29 11:50:23 +0200384 static_cast<test::DEPRECATED_SingleThreadedTaskQueueForTesting::TaskId>(
385 -1)) {
Tommi5e005f42019-08-05 15:29:14 +0200386 task_queue_->CancelTask(pending_task_);
387 pending_task_ = -1;
388 }
389 });
390
stefan4fbd1452015-09-28 03:57:14 -0700391 VideoSendStream::Stats send_stats = send_stream_->GetStats();
Tommi5e005f42019-08-05 15:29:14 +0200392 send_stream_ = nullptr; // To avoid dereferencing a bad pointer.
stefan4fbd1452015-09-28 03:57:14 -0700393
394 size_t total_packets_sent = 0;
395 size_t total_sent = 0;
396 size_t padding_sent = 0;
397 size_t media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800398 for (uint32_t ssrc : video_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700399 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent,
400 &total_sent, &padding_sent, &media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700401 }
402
403 size_t rtx_total_packets_sent = 0;
404 size_t rtx_total_sent = 0;
405 size_t rtx_padding_sent = 0;
406 size_t rtx_media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800407 for (uint32_t rtx_ssrc : video_rtx_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700408 AccumulateStats(send_stats.substreams[rtx_ssrc], &rtx_total_packets_sent,
409 &rtx_total_sent, &rtx_padding_sent, &rtx_media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700410 }
411
stefan5a2c5062017-01-27 06:43:18 -0800412 if (report_perf_stats_) {
stefan5a2c5062017-01-27 06:43:18 -0800413 ReportResult("ramp-up-media-sent", media_sent, "bytes");
414 ReportResult("ramp-up-padding-sent", padding_sent, "bytes");
stefan5a2c5062017-01-27 06:43:18 -0800415 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes");
416 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes");
417 if (ramp_up_finished_ms_ >= 0) {
418 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_,
419 "milliseconds");
420 }
421 ReportResult("ramp-up-average-network-latency",
422 send_transport_->GetAverageDelayMs(), "milliseconds");
stefan4fbd1452015-09-28 03:57:14 -0700423 }
424}
425
426void RampUpTester::PerformTest() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200427 test_start_ms_ = clock_->TimeInMilliseconds();
Peter Boström5811a392015-12-10 13:02:50 +0100428 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete.";
stefan4fbd1452015-09-28 03:57:14 -0700429 TriggerTestDone();
430}
431
Tommi6b117a52019-08-20 09:58:56 +0200432void RampUpTester::EnsurePollTimeSet() {
433 RTC_DCHECK_RUN_ON(task_queue_);
434 if (!next_scheduled_poll_time_ms_)
435 next_scheduled_poll_time_ms_ = rtc::TimeMillis();
436}
437
438int64_t RampUpTester::GetIntervalForNextPoll() {
439 RTC_DCHECK_RUN_ON(task_queue_);
440 RTC_DCHECK_NE(next_scheduled_poll_time_ms_, 0)
441 << "No call to EnsurePollTimeSet()";
442 auto now = rtc::TimeMillis();
443 next_scheduled_poll_time_ms_ += kPollIntervalMs;
444 auto interval = next_scheduled_poll_time_ms_ - now;
445 return interval > 0 ? interval : 0;
446}
447
Tommi5e005f42019-08-05 15:29:14 +0200448RampUpDownUpTester::RampUpDownUpTester(
449 size_t num_video_streams,
450 size_t num_audio_streams,
451 size_t num_flexfec_streams,
452 unsigned int start_bitrate_bps,
453 const std::string& extension_type,
454 bool rtx,
455 bool red,
456 const std::vector<int>& loss_rates,
457 bool report_perf_stats,
Yves Gerey6516f762019-08-29 11:50:23 +0200458 test::DEPRECATED_SingleThreadedTaskQueueForTesting* task_queue)
Stefan Holmerff2a6352016-01-14 10:00:21 +0100459 : RampUpTester(num_video_streams,
460 num_audio_streams,
philipel5ef2bc12017-02-21 07:28:31 -0800461 num_flexfec_streams,
Stefan Holmerff2a6352016-01-14 10:00:21 +0100462 start_bitrate_bps,
stefan5a2c5062017-01-27 06:43:18 -0800463 0,
Stefan Holmerff2a6352016-01-14 10:00:21 +0100464 extension_type,
465 rtx,
stefan5a2c5062017-01-27 06:43:18 -0800466 red,
Tommi5e005f42019-08-05 15:29:14 +0200467 report_perf_stats,
468 task_queue),
stefan76d9c9c2017-04-01 06:51:09 -0700469 link_rates_({4 * GetExpectedHighBitrate() / (3 * 1000),
470 kLowBandwidthLimitBps / 1000,
471 4 * GetExpectedHighBitrate() / (3 * 1000), 0}),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000472 test_state_(kFirstRampup),
philipel5ef2bc12017-02-21 07:28:31 -0800473 next_state_(kTransitionToNextState),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000474 state_start_ms_(clock_->TimeInMilliseconds()),
stefan4fbd1452015-09-28 03:57:14 -0700475 interval_start_ms_(clock_->TimeInMilliseconds()),
philipel5ef2bc12017-02-21 07:28:31 -0800476 sent_bytes_(0),
477 loss_rates_(loss_rates) {
478 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
479 forward_transport_config_.queue_delay_ms = 100;
480 forward_transport_config_.loss_percent = loss_rates_[test_state_];
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000481}
482
stefan4fbd1452015-09-28 03:57:14 -0700483RampUpDownUpTester::~RampUpDownUpTester() {}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000484
tommi0f8b4032017-02-22 11:22:05 -0800485void RampUpDownUpTester::PollStats() {
Tommi6b117a52019-08-20 09:58:56 +0200486 EnsurePollTimeSet();
487
Tommi5e005f42019-08-05 15:29:14 +0200488 pending_task_ = -1;
489 bool last_round = (test_state_ == kTestEnd);
490
491 int transmit_bitrate_bps = 0;
492 bool suspended = false;
493 if (num_video_streams_ > 0 && send_stream_) {
494 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
495 for (const auto& it : stats.substreams) {
496 transmit_bitrate_bps += it.second.total_bitrate_bps;
Alex Narest78609d52017-10-20 10:37:47 +0200497 }
Tommi5e005f42019-08-05 15:29:14 +0200498 suspended = stats.suspended;
499 }
500 if (num_audio_streams_ > 0 && sender_call_) {
501 // An audio send stream doesn't have bitrate stats, so the call send BW is
502 // currently used instead.
503 transmit_bitrate_bps = sender_call_->GetStats().send_bandwidth_bps;
504 }
505
506 EvolveTestState(transmit_bitrate_bps, suspended);
507
508 if (!last_round) {
509 pending_task_ = task_queue_->PostDelayedTask([this]() { PollStats(); },
Tommi6b117a52019-08-20 09:58:56 +0200510 GetIntervalForNextPoll());
Tommi5e005f42019-08-05 15:29:14 +0200511 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000512}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000513
Niels Möllerde8e6e62018-11-13 15:10:33 +0100514void RampUpDownUpTester::ModifyReceiverBitrateConfig(
515 BitrateConstraints* bitrate_config) {
516 bitrate_config->min_bitrate_bps = 10000;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000517}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000518
stefan4fbd1452015-09-28 03:57:14 -0700519std::string RampUpDownUpTester::GetModifierString() const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000520 std::string str("_");
stefanff483612015-12-21 03:14:00 -0800521 if (num_video_streams_ > 0) {
Jonas Olsson0a713b62018-04-04 15:49:32 +0200522 str += rtc::ToString(num_video_streams_);
stefanff483612015-12-21 03:14:00 -0800523 str += "stream";
524 str += (num_video_streams_ > 1 ? "s" : "");
525 str += "_";
526 }
527 if (num_audio_streams_ > 0) {
Jonas Olsson0a713b62018-04-04 15:49:32 +0200528 str += rtc::ToString(num_audio_streams_);
stefanff483612015-12-21 03:14:00 -0800529 str += "stream";
530 str += (num_audio_streams_ > 1 ? "s" : "");
531 str += "_";
532 }
stefan4fbd1452015-09-28 03:57:14 -0700533 str += (rtx_ ? "" : "no");
Edward Lemurdd3987f2018-01-04 19:44:54 +0100534 str += "rtx_";
535 str += (red_ ? "" : "no");
536 str += "red";
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000537 return str;
538}
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000539
stefandb752f92016-12-05 08:23:40 -0800540int RampUpDownUpTester::GetExpectedHighBitrate() const {
stefan38d8b3c2017-01-09 04:19:24 -0800541 int expected_bitrate_bps = 0;
542 if (num_audio_streams_ > 0)
543 expected_bitrate_bps += kExpectedHighAudioBitrateBps;
544 if (num_video_streams_ > 0)
545 expected_bitrate_bps += kExpectedHighVideoBitrateBps;
546 return expected_bitrate_bps;
547}
548
philipel5ef2bc12017-02-21 07:28:31 -0800549size_t RampUpDownUpTester::GetFecBytes() const {
550 size_t flex_fec_bytes = 0;
551 if (num_flexfec_streams_ > 0) {
552 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
553 for (const auto& kv : stats.substreams)
554 flex_fec_bytes += kv.second.rtp_stats.fec.TotalBytes();
555 }
556 return flex_fec_bytes;
557}
558
559bool RampUpDownUpTester::ExpectingFec() const {
560 return num_flexfec_streams_ > 0 && forward_transport_config_.loss_percent > 0;
561}
562
stefan4fbd1452015-09-28 03:57:14 -0700563void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000564 int64_t now = clock_->TimeInMilliseconds();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000565 switch (test_state_) {
philipel5ef2bc12017-02-21 07:28:31 -0800566 case kFirstRampup:
stefan4fbd1452015-09-28 03:57:14 -0700567 EXPECT_FALSE(suspended);
stefandb752f92016-12-05 08:23:40 -0800568 if (bitrate_bps >= GetExpectedHighBitrate()) {
stefan45b5fe52017-03-09 06:27:02 -0800569 if (report_perf_stats_) {
570 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
571 "first_rampup", now - state_start_ms_, "ms",
572 false);
573 }
philipel5ef2bc12017-02-21 07:28:31 -0800574 // Apply loss during the transition between states if FEC is enabled.
575 forward_transport_config_.loss_percent = loss_rates_[test_state_];
576 test_state_ = kTransitionToNextState;
577 next_state_ = kLowRate;
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000578 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000579 break;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000580 case kLowRate: {
mflodman86cc6ff2016-07-26 04:44:06 -0700581 // Audio streams are never suspended.
582 bool check_suspend_state = num_video_streams_ > 0;
Sebastian Jansson12fb1702018-02-23 11:34:18 +0100583 if (bitrate_bps < kLowBandwidthLimitBps + kLowBitrateMarginBps &&
mflodman86cc6ff2016-07-26 04:44:06 -0700584 suspended == check_suspend_state) {
stefan45b5fe52017-03-09 06:27:02 -0800585 if (report_perf_stats_) {
586 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
587 "rampdown", now - state_start_ms_, "ms",
588 false);
589 }
philipel5ef2bc12017-02-21 07:28:31 -0800590 // Apply loss during the transition between states if FEC is enabled.
591 forward_transport_config_.loss_percent = loss_rates_[test_state_];
592 test_state_ = kTransitionToNextState;
593 next_state_ = kSecondRampup;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000594 }
595 break;
596 }
philipel5ef2bc12017-02-21 07:28:31 -0800597 case kSecondRampup:
stefandb752f92016-12-05 08:23:40 -0800598 if (bitrate_bps >= GetExpectedHighBitrate() && !suspended) {
stefan45b5fe52017-03-09 06:27:02 -0800599 if (report_perf_stats_) {
600 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
601 "second_rampup", now - state_start_ms_,
602 "ms", false);
603 ReportResult("ramp-up-down-up-average-network-latency",
604 send_transport_->GetAverageDelayMs(), "milliseconds");
605 }
philipel5ef2bc12017-02-21 07:28:31 -0800606 // Apply loss during the transition between states if FEC is enabled.
607 forward_transport_config_.loss_percent = loss_rates_[test_state_];
608 test_state_ = kTransitionToNextState;
609 next_state_ = kTestEnd;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000610 }
611 break;
philipel5ef2bc12017-02-21 07:28:31 -0800612 case kTestEnd:
613 observation_complete_.Set();
614 break;
615 case kTransitionToNextState:
616 if (!ExpectingFec() || GetFecBytes() > 0) {
617 test_state_ = next_state_;
618 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
619 // No loss while ramping up and down as it may affect the BWE
620 // negatively, making the test flaky.
621 forward_transport_config_.loss_percent = 0;
622 state_start_ms_ = now;
623 interval_start_ms_ = now;
624 sent_bytes_ = 0;
Artem Titov631cafa2018-08-21 21:01:00 +0200625 send_simulated_network_->SetConfig(forward_transport_config_);
philipel5ef2bc12017-02-21 07:28:31 -0800626 }
627 break;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000628 }
629}
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000630
stefan4fbd1452015-09-28 03:57:14 -0700631class RampUpTest : public test::CallTest {
Erik Språng6b8d3552015-09-24 15:06:57 +0200632 public:
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200633 RampUpTest()
634 : task_queue_factory_(CreateDefaultTaskQueueFactory()),
635 rtc_event_log_factory_(task_queue_factory_.get()) {
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200636 std::string dump_name(absl::GetFlag(FLAGS_ramp_dump_name));
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200637 if (!dump_name.empty()) {
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200638 send_event_log_ = rtc_event_log_factory_.CreateRtcEventLog(
639 RtcEventLog::EncodingType::Legacy);
640 recv_event_log_ = rtc_event_log_factory_.CreateRtcEventLog(
641 RtcEventLog::EncodingType::Legacy);
Sebastian Janssonf5e767d2018-10-15 13:24:31 +0200642 bool event_log_started =
643 send_event_log_->StartLogging(
644 absl::make_unique<RtcEventLogOutputFile>(
645 dump_name + ".send.rtc.dat", RtcEventLog::kUnlimitedOutput),
646 RtcEventLog::kImmediateOutput) &&
647 recv_event_log_->StartLogging(
648 absl::make_unique<RtcEventLogOutputFile>(
649 dump_name + ".recv.rtc.dat", RtcEventLog::kUnlimitedOutput),
650 RtcEventLog::kImmediateOutput);
651 RTC_DCHECK(event_log_started);
652 }
653 }
Danil Chapovalov304ea5f2019-04-11 15:18:18 +0200654
655 private:
656 const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
657 RtcEventLogFactory rtc_event_log_factory_;
Erik Språng6b8d3552015-09-24 15:06:57 +0200658};
659
Stefan Holmerff2a6352016-01-14 10:00:21 +0100660static const uint32_t kStartBitrateBps = 60000;
661
stefan38d8b3c2017-01-09 04:19:24 -0800662TEST_F(RampUpTest, UpDownUpAbsSendTimeSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800663 std::vector<int> loss_rates = {0, 0, 0, 0};
664 RampUpDownUpTester test(3, 0, 0, kStartBitrateBps,
stefan45b5fe52017-03-09 06:27:02 -0800665 RtpExtension::kAbsSendTimeUri, true, true, loss_rates,
Tommi5e005f42019-08-05 15:29:14 +0200666 true, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800667 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800668}
Stefan Holmerff2a6352016-01-14 10:00:21 +0100669
Taylor Brandstetterba6b5032018-02-16 09:59:56 -0800670// TODO(bugs.webrtc.org/8878)
671#if defined(WEBRTC_MAC)
672#define MAYBE_UpDownUpTransportSequenceNumberRtx \
673 DISABLED_UpDownUpTransportSequenceNumberRtx
674#else
675#define MAYBE_UpDownUpTransportSequenceNumberRtx \
676 UpDownUpTransportSequenceNumberRtx
677#endif
678TEST_F(RampUpTest, MAYBE_UpDownUpTransportSequenceNumberRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800679 std::vector<int> loss_rates = {0, 0, 0, 0};
680 RampUpDownUpTester test(3, 0, 0, kStartBitrateBps,
isheriff6f8d6862016-05-26 11:24:55 -0700681 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200682 false, loss_rates, true, &task_queue_);
philipel5ef2bc12017-02-21 07:28:31 -0800683 RunBaseTest(&test);
684}
685
stefan45b5fe52017-03-09 06:27:02 -0800686// TODO(holmer): Tests which don't report perf stats should be moved to a
687// different executable since they per definition are not perf tests.
Taylor Brandstetter05d98222017-10-10 12:12:53 -0700688// This test is disabled because it crashes on Linux, and is flaky on other
689// platforms. See: crbug.com/webrtc/7919
690TEST_F(RampUpTest, DISABLED_UpDownUpTransportSequenceNumberPacketLoss) {
philipel5ef2bc12017-02-21 07:28:31 -0800691 std::vector<int> loss_rates = {20, 0, 0, 0};
692 RampUpDownUpTester test(1, 0, 1, kStartBitrateBps,
693 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200694 false, loss_rates, false, &task_queue_);
Stefan Holmerff2a6352016-01-14 10:00:21 +0100695 RunBaseTest(&test);
696}
697
Taylor Brandstetterab86e7f2018-02-12 15:16:02 -0800698// TODO(bugs.webrtc.org/8878)
699#if defined(WEBRTC_MAC)
700#define MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx \
701 DISABLED_UpDownUpAudioVideoTransportSequenceNumberRtx
702#else
703#define MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx \
704 UpDownUpAudioVideoTransportSequenceNumberRtx
705#endif
706TEST_F(RampUpTest, MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx) {
Per Kjellander914351d2019-02-15 10:54:55 +0100707 test::ScopedFieldTrials field_trials("WebRTC-Audio-SendSideBwe/Enabled/");
philipel5ef2bc12017-02-21 07:28:31 -0800708 std::vector<int> loss_rates = {0, 0, 0, 0};
709 RampUpDownUpTester test(3, 1, 0, kStartBitrateBps,
isheriff6f8d6862016-05-26 11:24:55 -0700710 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200711 false, loss_rates, false, &task_queue_);
Stefan Holmerff2a6352016-01-14 10:00:21 +0100712 RunBaseTest(&test);
713}
714
stefan38d8b3c2017-01-09 04:19:24 -0800715TEST_F(RampUpTest, UpDownUpAudioTransportSequenceNumberRtx) {
Per Kjellander914351d2019-02-15 10:54:55 +0100716 test::ScopedFieldTrials field_trials("WebRTC-Audio-SendSideBwe/Enabled/");
philipel5ef2bc12017-02-21 07:28:31 -0800717 std::vector<int> loss_rates = {0, 0, 0, 0};
718 RampUpDownUpTester test(0, 1, 0, kStartBitrateBps,
mflodman86cc6ff2016-07-26 04:44:06 -0700719 RtpExtension::kTransportSequenceNumberUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200720 false, loss_rates, false, &task_queue_);
mflodman86cc6ff2016-07-26 04:44:06 -0700721 RunBaseTest(&test);
722}
723
stefan38d8b3c2017-01-09 04:19:24 -0800724TEST_F(RampUpTest, TOffsetSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800725 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTimestampOffsetUri, true,
Tommi5e005f42019-08-05 15:29:14 +0200726 true, true, &task_queue_);
stefan38d8b3c2017-01-09 04:19:24 -0800727 RunBaseTest(&test);
728}
729
730TEST_F(RampUpTest, AbsSendTime) {
philipel5ef2bc12017-02-21 07:28:31 -0800731 RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, false, false,
Tommi5e005f42019-08-05 15:29:14 +0200732 false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800733 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000734}
735
stefan38d8b3c2017-01-09 04:19:24 -0800736TEST_F(RampUpTest, AbsSendTimeSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800737 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, true, true,
Tommi5e005f42019-08-05 15:29:14 +0200738 true, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800739 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000740}
741
stefan38d8b3c2017-01-09 04:19:24 -0800742TEST_F(RampUpTest, TransportSequenceNumber) {
philipel5ef2bc12017-02-21 07:28:31 -0800743 RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200744 false, false, false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800745 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200746}
747
748TEST_F(RampUpTest, TransportSequenceNumberSimulcast) {
philipel5ef2bc12017-02-21 07:28:31 -0800749 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200750 false, false, false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800751 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200752}
753
stefan38d8b3c2017-01-09 04:19:24 -0800754TEST_F(RampUpTest, TransportSequenceNumberSimulcastRedRtx) {
philipel5ef2bc12017-02-21 07:28:31 -0800755 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
Tommi5e005f42019-08-05 15:29:14 +0200756 true, true, true, &task_queue_);
stefan5a2c5062017-01-27 06:43:18 -0800757 RunBaseTest(&test);
758}
759
Niels Möllercd2e1052018-11-08 10:23:13 +0100760TEST_F(RampUpTest, AudioTransportSequenceNumber) {
philipel5ef2bc12017-02-21 07:28:31 -0800761 RampUpTester test(0, 1, 0, 300000, 10000,
stefan5a2c5062017-01-27 06:43:18 -0800762 RtpExtension::kTransportSequenceNumberUri, false, false,
Tommi5e005f42019-08-05 15:29:14 +0200763 false, &task_queue_);
stefane74eef12016-01-08 06:47:13 -0800764 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200765}
pbos@webrtc.org744fbc72013-09-10 09:26:25 +0000766} // namespace webrtc