blob: 9b31901b8a729b38a4cdefe964e3bb94ef98abb3 [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
stefanff483612015-12-21 03:14:00 -080011#include "webrtc/call/rampup_tests.h"
12
pbos@webrtc.org744fbc72013-09-10 09:26:25 +000013#include "testing/gtest/include/gtest/gtest.h"
pbos@webrtc.org2b4ce3a2015-03-23 13:12:24 +000014#include "webrtc/base/checks.h"
pbos12411ef2015-11-23 14:47:56 -080015#include "webrtc/base/platform_thread.h"
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +000016#include "webrtc/test/testsupport/perf_test.h"
pbos@webrtc.org744fbc72013-09-10 09:26:25 +000017
18namespace webrtc {
pbos@webrtc.org29023282013-09-11 10:14:56 +000019namespace {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000020
Stefan Holmer723dff12015-10-05 14:59:41 +020021static const int64_t kPollIntervalMs = 20;
pbos@webrtc.org29023282013-09-11 10:14:56 +000022
stefanff483612015-12-21 03:14:00 -080023std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000024 std::vector<uint32_t> ssrcs;
25 for (size_t i = 0; i != num_streams; ++i)
26 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i));
27 return ssrcs;
28}
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +000029} // namespace
henrik.lundin@webrtc.org845862f2014-03-06 07:19:28 +000030
stefanff483612015-12-21 03:14:00 -080031RampUpTester::RampUpTester(size_t num_video_streams,
32 size_t num_audio_streams,
stefan4fbd1452015-09-28 03:57:14 -070033 unsigned int start_bitrate_bps,
34 const std::string& extension_type,
35 bool rtx,
36 bool red)
37 : EndToEndTest(test::CallTest::kLongTimeoutMs),
38 event_(false, false),
39 clock_(Clock::GetRealTimeClock()),
stefanff483612015-12-21 03:14:00 -080040 num_video_streams_(num_video_streams),
41 num_audio_streams_(num_audio_streams),
stefan4fbd1452015-09-28 03:57:14 -070042 rtx_(rtx),
43 red_(red),
44 send_stream_(nullptr),
45 start_bitrate_bps_(start_bitrate_bps),
46 start_bitrate_verified_(false),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000047 expected_bitrate_bps_(0),
Erik Språngf3a7c9d2015-10-05 14:03:22 +020048 test_start_ms_(-1),
stefan4fbd1452015-09-28 03:57:14 -070049 ramp_up_finished_ms_(-1),
50 extension_type_(extension_type),
stefanff483612015-12-21 03:14:00 -080051 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)),
52 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)),
53 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)),
Peter Boström8c38e8b2015-11-26 17:45:47 +010054 poller_thread_(&BitrateStatsPollingThread,
55 this,
56 "BitrateStatsPollingThread"),
stefan4fbd1452015-09-28 03:57:14 -070057 sender_call_(nullptr) {
58 if (rtx_) {
stefanff483612015-12-21 03:14:00 -080059 for (size_t i = 0; i < video_ssrcs_.size(); ++i)
60 rtx_ssrc_map_[video_rtx_ssrcs_[i]] = video_ssrcs_[i];
stefan@webrtc.org3d7da882014-07-08 13:59:46 +000061 }
stefan4fbd1452015-09-28 03:57:14 -070062}
63
64RampUpTester::~RampUpTester() {
65 event_.Set();
stefan4fbd1452015-09-28 03:57:14 -070066}
67
68Call::Config RampUpTester::GetSenderCallConfig() {
69 Call::Config call_config;
70 if (start_bitrate_bps_ != 0) {
71 call_config.bitrate_config.start_bitrate_bps = start_bitrate_bps_;
72 }
73 call_config.bitrate_config.min_bitrate_bps = 10000;
74 return call_config;
75}
76
stefanff483612015-12-21 03:14:00 -080077void RampUpTester::OnVideoStreamsCreated(
stefan4fbd1452015-09-28 03:57:14 -070078 VideoSendStream* send_stream,
79 const std::vector<VideoReceiveStream*>& receive_streams) {
80 send_stream_ = send_stream;
81}
82
stefane74eef12016-01-08 06:47:13 -080083test::PacketTransport* RampUpTester::CreateSendTransport(Call* sender_call) {
84 send_transport_ = new test::PacketTransport(sender_call, this,
85 test::PacketTransport::kSender,
86 forward_transport_config_);
87 return send_transport_;
stefanf116bd02015-10-27 08:29:42 -070088}
89
stefanff483612015-12-21 03:14:00 -080090void RampUpTester::ModifyVideoConfigs(
stefan4fbd1452015-09-28 03:57:14 -070091 VideoSendStream::Config* send_config,
92 std::vector<VideoReceiveStream::Config>* receive_configs,
93 VideoEncoderConfig* encoder_config) {
94 send_config->suspend_below_min_bitrate = true;
95
stefanff483612015-12-21 03:14:00 -080096 if (num_video_streams_ == 1) {
stefan4fbd1452015-09-28 03:57:14 -070097 encoder_config->streams[0].target_bitrate_bps =
98 encoder_config->streams[0].max_bitrate_bps = 2000000;
99 // For single stream rampup until 1mbps
100 expected_bitrate_bps_ = kSingleStreamTargetBps;
101 } else {
102 // For multi stream rampup until all streams are being sent. That means
103 // enough birate to send all the target streams plus the min bitrate of
104 // the last one.
105 expected_bitrate_bps_ = encoder_config->streams.back().min_bitrate_bps;
106 for (size_t i = 0; i < encoder_config->streams.size() - 1; ++i) {
107 expected_bitrate_bps_ += encoder_config->streams[i].target_bitrate_bps;
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000108 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000109 }
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000110
stefan4fbd1452015-09-28 03:57:14 -0700111 send_config->rtp.extensions.clear();
112
113 bool remb;
stefan43edf0f2015-11-20 18:05:48 -0800114 bool transport_cc;
stefan4fbd1452015-09-28 03:57:14 -0700115 if (extension_type_ == RtpExtension::kAbsSendTime) {
116 remb = true;
stefan43edf0f2015-11-20 18:05:48 -0800117 transport_cc = false;
stefan4fbd1452015-09-28 03:57:14 -0700118 send_config->rtp.extensions.push_back(
119 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
120 } else if (extension_type_ == RtpExtension::kTransportSequenceNumber) {
121 remb = false;
stefan43edf0f2015-11-20 18:05:48 -0800122 transport_cc = true;
stefan4fbd1452015-09-28 03:57:14 -0700123 send_config->rtp.extensions.push_back(RtpExtension(
124 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000125 } else {
stefan4fbd1452015-09-28 03:57:14 -0700126 remb = true;
stefan43edf0f2015-11-20 18:05:48 -0800127 transport_cc = false;
stefan4fbd1452015-09-28 03:57:14 -0700128 send_config->rtp.extensions.push_back(RtpExtension(
129 extension_type_.c_str(), kTransmissionTimeOffsetExtensionId));
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000130 }
stefan4fbd1452015-09-28 03:57:14 -0700131
132 send_config->rtp.nack.rtp_history_ms = test::CallTest::kNackRtpHistoryMs;
stefanff483612015-12-21 03:14:00 -0800133 send_config->rtp.ssrcs = video_ssrcs_;
stefan4fbd1452015-09-28 03:57:14 -0700134 if (rtx_) {
135 send_config->rtp.rtx.payload_type = test::CallTest::kSendRtxPayloadType;
stefanff483612015-12-21 03:14:00 -0800136 send_config->rtp.rtx.ssrcs = video_rtx_ssrcs_;
stefan4fbd1452015-09-28 03:57:14 -0700137 }
138 if (red_) {
139 send_config->rtp.fec.ulpfec_payload_type =
140 test::CallTest::kUlpfecPayloadType;
141 send_config->rtp.fec.red_payload_type = test::CallTest::kRedPayloadType;
142 }
143
144 size_t i = 0;
145 for (VideoReceiveStream::Config& recv_config : *receive_configs) {
146 recv_config.rtp.remb = remb;
stefan43edf0f2015-11-20 18:05:48 -0800147 recv_config.rtp.transport_cc = transport_cc;
stefan4fbd1452015-09-28 03:57:14 -0700148 recv_config.rtp.extensions = send_config->rtp.extensions;
149
stefanff483612015-12-21 03:14:00 -0800150 recv_config.rtp.remote_ssrc = video_ssrcs_[i];
stefan4fbd1452015-09-28 03:57:14 -0700151 recv_config.rtp.nack.rtp_history_ms = send_config->rtp.nack.rtp_history_ms;
152
153 if (red_) {
154 recv_config.rtp.fec.red_payload_type =
155 send_config->rtp.fec.red_payload_type;
156 recv_config.rtp.fec.ulpfec_payload_type =
157 send_config->rtp.fec.ulpfec_payload_type;
158 }
159
160 if (rtx_) {
161 recv_config.rtp.rtx[send_config->encoder_settings.payload_type].ssrc =
stefanff483612015-12-21 03:14:00 -0800162 video_rtx_ssrcs_[i];
stefan4fbd1452015-09-28 03:57:14 -0700163 recv_config.rtp.rtx[send_config->encoder_settings.payload_type]
164 .payload_type = send_config->rtp.rtx.payload_type;
165 }
166 ++i;
167 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000168}
169
stefan4fbd1452015-09-28 03:57:14 -0700170void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
171 sender_call_ = sender_call;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000172}
173
stefan4fbd1452015-09-28 03:57:14 -0700174bool RampUpTester::BitrateStatsPollingThread(void* obj) {
175 return static_cast<RampUpTester*>(obj)->PollStats();
pbos@webrtc.org32452b22014-10-22 12:15:24 +0000176}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000177
stefan4fbd1452015-09-28 03:57:14 -0700178bool RampUpTester::PollStats() {
179 if (sender_call_) {
180 Call::Stats stats = sender_call_->GetStats();
181
182 RTC_DCHECK_GT(expected_bitrate_bps_, 0);
183 if (!start_bitrate_verified_ && start_bitrate_bps_ != 0) {
184 // For tests with an explicitly set start bitrate, verify the first
185 // bitrate estimate is close to the start bitrate and lower than the
186 // test target bitrate. This is to verify a call respects the configured
187 // start bitrate, but due to the BWE implementation we can't guarantee the
188 // first estimate really is as high as the start bitrate.
189 EXPECT_GT(stats.send_bandwidth_bps, 0.9 * start_bitrate_bps_);
190 start_bitrate_verified_ = true;
191 }
192 if (stats.send_bandwidth_bps >= expected_bitrate_bps_) {
193 ramp_up_finished_ms_ = clock_->TimeInMilliseconds();
Peter Boström5811a392015-12-10 13:02:50 +0100194 observation_complete_.Set();
stefan4fbd1452015-09-28 03:57:14 -0700195 }
196 }
197
198 return !event_.Wait(kPollIntervalMs);
Erik Språng468e62a2015-07-06 10:50:47 +0200199}
200
stefan4fbd1452015-09-28 03:57:14 -0700201void RampUpTester::ReportResult(const std::string& measurement,
202 size_t value,
203 const std::string& units) const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000204 webrtc::test::PrintResult(
205 measurement, "",
stefanff483612015-12-21 03:14:00 -0800206 ::testing::UnitTest::GetInstance()->current_test_info()->name(), value,
207 units, false);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000208}
209
stefan092508a2015-09-29 02:26:42 -0700210void RampUpTester::AccumulateStats(const VideoSendStream::StreamStats& stream,
211 size_t* total_packets_sent,
212 size_t* total_sent,
213 size_t* padding_sent,
214 size_t* media_sent) const {
stefan4fbd1452015-09-28 03:57:14 -0700215 *total_packets_sent += stream.rtp_stats.transmitted.packets +
216 stream.rtp_stats.retransmitted.packets +
217 stream.rtp_stats.fec.packets;
218 *total_sent += stream.rtp_stats.transmitted.TotalBytes() +
219 stream.rtp_stats.retransmitted.TotalBytes() +
220 stream.rtp_stats.fec.TotalBytes();
221 *padding_sent += stream.rtp_stats.transmitted.padding_bytes +
222 stream.rtp_stats.retransmitted.padding_bytes +
223 stream.rtp_stats.fec.padding_bytes;
224 *media_sent += stream.rtp_stats.MediaPayloadBytes();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000225}
226
stefan4fbd1452015-09-28 03:57:14 -0700227void RampUpTester::TriggerTestDone() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200228 RTC_DCHECK_GE(test_start_ms_, 0);
229
stefan4fbd1452015-09-28 03:57:14 -0700230 VideoSendStream::Stats send_stats = send_stream_->GetStats();
231
232 size_t total_packets_sent = 0;
233 size_t total_sent = 0;
234 size_t padding_sent = 0;
235 size_t media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800236 for (uint32_t ssrc : video_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700237 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent,
238 &total_sent, &padding_sent, &media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700239 }
240
241 size_t rtx_total_packets_sent = 0;
242 size_t rtx_total_sent = 0;
243 size_t rtx_padding_sent = 0;
244 size_t rtx_media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800245 for (uint32_t rtx_ssrc : video_rtx_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700246 AccumulateStats(send_stats.substreams[rtx_ssrc], &rtx_total_packets_sent,
247 &rtx_total_sent, &rtx_padding_sent, &rtx_media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700248 }
249
250 ReportResult("ramp-up-total-packets-sent", total_packets_sent, "packets");
251 ReportResult("ramp-up-total-sent", total_sent, "bytes");
252 ReportResult("ramp-up-media-sent", media_sent, "bytes");
253 ReportResult("ramp-up-padding-sent", padding_sent, "bytes");
254 ReportResult("ramp-up-rtx-total-packets-sent", rtx_total_packets_sent,
255 "packets");
256 ReportResult("ramp-up-rtx-total-sent", rtx_total_sent, "bytes");
257 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes");
258 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes");
259 if (ramp_up_finished_ms_ >= 0) {
260 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_,
261 "milliseconds");
262 }
263}
264
265void RampUpTester::PerformTest() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200266 test_start_ms_ = clock_->TimeInMilliseconds();
Peter Boström8c38e8b2015-11-26 17:45:47 +0100267 poller_thread_.Start();
Peter Boström5811a392015-12-10 13:02:50 +0100268 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete.";
stefan4fbd1452015-09-28 03:57:14 -0700269 TriggerTestDone();
Peter Boström8c38e8b2015-11-26 17:45:47 +0100270 poller_thread_.Stop();
stefan4fbd1452015-09-28 03:57:14 -0700271}
272
273RampUpDownUpTester::RampUpDownUpTester(size_t num_streams,
274 unsigned int start_bitrate_bps,
275 const std::string& extension_type,
276 bool rtx,
277 bool red)
stefanff483612015-12-21 03:14:00 -0800278 : RampUpTester(num_streams, 0, start_bitrate_bps, extension_type, rtx, red),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000279 test_state_(kFirstRampup),
280 state_start_ms_(clock_->TimeInMilliseconds()),
stefan4fbd1452015-09-28 03:57:14 -0700281 interval_start_ms_(clock_->TimeInMilliseconds()),
282 sent_bytes_(0) {
stefanff483612015-12-21 03:14:00 -0800283 forward_transport_config_.link_capacity_kbps = kHighBandwidthLimitBps / 1000;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000284}
285
stefan4fbd1452015-09-28 03:57:14 -0700286RampUpDownUpTester::~RampUpDownUpTester() {}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000287
stefan4fbd1452015-09-28 03:57:14 -0700288bool RampUpDownUpTester::PollStats() {
289 if (send_stream_) {
290 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
291 int transmit_bitrate_bps = 0;
292 for (auto it : stats.substreams) {
293 transmit_bitrate_bps += it.second.total_bitrate_bps;
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +0000294 }
stefan4fbd1452015-09-28 03:57:14 -0700295
296 EvolveTestState(transmit_bitrate_bps, stats.suspended);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000297 }
stefan4fbd1452015-09-28 03:57:14 -0700298
299 return !event_.Wait(kPollIntervalMs);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000300}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000301
stefan4fbd1452015-09-28 03:57:14 -0700302Call::Config RampUpDownUpTester::GetReceiverCallConfig() {
303 Call::Config config;
304 config.bitrate_config.min_bitrate_bps = 10000;
305 return config;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000306}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000307
stefan4fbd1452015-09-28 03:57:14 -0700308std::string RampUpDownUpTester::GetModifierString() const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000309 std::string str("_");
stefanff483612015-12-21 03:14:00 -0800310 if (num_video_streams_ > 0) {
311 std::ostringstream s;
312 s << num_video_streams_;
313 str += s.str();
314 str += "stream";
315 str += (num_video_streams_ > 1 ? "s" : "");
316 str += "_";
317 }
318 if (num_audio_streams_ > 0) {
319 std::ostringstream s;
320 s << num_audio_streams_;
321 str += s.str();
322 str += "stream";
323 str += (num_audio_streams_ > 1 ? "s" : "");
324 str += "_";
325 }
stefan4fbd1452015-09-28 03:57:14 -0700326 str += (rtx_ ? "" : "no");
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000327 str += "rtx";
328 return str;
329}
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000330
stefan4fbd1452015-09-28 03:57:14 -0700331void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000332 int64_t now = clock_->TimeInMilliseconds();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000333 switch (test_state_) {
334 case kFirstRampup: {
stefan4fbd1452015-09-28 03:57:14 -0700335 EXPECT_FALSE(suspended);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000336 if (bitrate_bps > kExpectedHighBitrateBps) {
337 // The first ramp-up has reached the target bitrate. Change the
338 // channel limit, and move to the next test state.
339 forward_transport_config_.link_capacity_kbps =
340 kLowBandwidthLimitBps / 1000;
stefanf116bd02015-10-27 08:29:42 -0700341 send_transport_->SetConfig(forward_transport_config_);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000342 test_state_ = kLowRate;
stefanff483612015-12-21 03:14:00 -0800343 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
344 "first_rampup", now - state_start_ms_, "ms",
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000345 false);
346 state_start_ms_ = now;
347 interval_start_ms_ = now;
348 sent_bytes_ = 0;
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000349 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000350 break;
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000351 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000352 case kLowRate: {
stefan4fbd1452015-09-28 03:57:14 -0700353 if (bitrate_bps < kExpectedLowBitrateBps && suspended) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000354 // The ramp-down was successful. Change the channel limit back to a
355 // high value, and move to the next test state.
356 forward_transport_config_.link_capacity_kbps =
357 kHighBandwidthLimitBps / 1000;
stefanf116bd02015-10-27 08:29:42 -0700358 send_transport_->SetConfig(forward_transport_config_);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000359 test_state_ = kSecondRampup;
stefanff483612015-12-21 03:14:00 -0800360 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
361 "rampdown", now - state_start_ms_, "ms",
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000362 false);
363 state_start_ms_ = now;
364 interval_start_ms_ = now;
365 sent_bytes_ = 0;
366 }
367 break;
368 }
369 case kSecondRampup: {
stefan4fbd1452015-09-28 03:57:14 -0700370 if (bitrate_bps > kExpectedHighBitrateBps && !suspended) {
stefanff483612015-12-21 03:14:00 -0800371 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
372 "second_rampup", now - state_start_ms_, "ms",
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000373 false);
Peter Boström5811a392015-12-10 13:02:50 +0100374 observation_complete_.Set();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000375 }
376 break;
377 }
378 }
379}
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000380
stefan4fbd1452015-09-28 03:57:14 -0700381class RampUpTest : public test::CallTest {
Erik Språng6b8d3552015-09-24 15:06:57 +0200382 public:
stefan4fbd1452015-09-28 03:57:14 -0700383 RampUpTest() {}
Erik Språng6b8d3552015-09-24 15:06:57 +0200384
stefan4fbd1452015-09-28 03:57:14 -0700385 virtual ~RampUpTest() {
stefanff483612015-12-21 03:14:00 -0800386 EXPECT_EQ(nullptr, video_send_stream_);
387 EXPECT_TRUE(video_receive_streams_.empty());
Erik Språng6b8d3552015-09-24 15:06:57 +0200388 }
Erik Språng6b8d3552015-09-24 15:06:57 +0200389};
390
stefan@webrtc.orgcb254aa2014-06-12 15:12:25 +0000391TEST_F(RampUpTest, SingleStream) {
stefanff483612015-12-21 03:14:00 -0800392 RampUpTester test(1, 0, 0, RtpExtension::kTOffset, false, false);
stefane74eef12016-01-08 06:47:13 -0800393 RunBaseTest(&test);
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000394}
pbos@webrtc.org744fbc72013-09-10 09:26:25 +0000395
stefan@webrtc.orgcb254aa2014-06-12 15:12:25 +0000396TEST_F(RampUpTest, Simulcast) {
stefanff483612015-12-21 03:14:00 -0800397 RampUpTester test(3, 0, 0, RtpExtension::kTOffset, false, false);
stefane74eef12016-01-08 06:47:13 -0800398 RunBaseTest(&test);
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000399}
400
stefan@webrtc.orgcb254aa2014-06-12 15:12:25 +0000401TEST_F(RampUpTest, SimulcastWithRtx) {
stefanff483612015-12-21 03:14:00 -0800402 RampUpTester test(3, 0, 0, RtpExtension::kTOffset, true, false);
stefane74eef12016-01-08 06:47:13 -0800403 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800404}
405
406TEST_F(RampUpTest, SimulcastByRedWithRtx) {
stefanff483612015-12-21 03:14:00 -0800407 RampUpTester test(3, 0, 0, RtpExtension::kTOffset, true, true);
stefane74eef12016-01-08 06:47:13 -0800408 RunBaseTest(&test);
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +0000409}
410
411TEST_F(RampUpTest, SingleStreamWithHighStartBitrate) {
stefanff483612015-12-21 03:14:00 -0800412 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, RtpExtension::kTOffset,
stefan4fbd1452015-09-28 03:57:14 -0700413 false, false);
stefane74eef12016-01-08 06:47:13 -0800414 RunBaseTest(&test);
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000415}
pbos@webrtc.org744fbc72013-09-10 09:26:25 +0000416
kjellanderf1685c72016-01-08 10:43:41 -0800417// Disabled on Mac due to flakiness, see
418// https://bugs.chromium.org/p/webrtc/issues/detail?id=5407
419#ifndef WEBRTC_MAC
Shao Changbine62202f2015-04-21 20:24:50 +0800420TEST_F(RampUpTest, UpDownUpOneStream) {
stefan4fbd1452015-09-28 03:57:14 -0700421 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, false, false);
stefane74eef12016-01-08 06:47:13 -0800422 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800423}
henrik.lundin@webrtc.org845862f2014-03-06 07:19:28 +0000424
Shao Changbine62202f2015-04-21 20:24:50 +0800425TEST_F(RampUpTest, UpDownUpThreeStreams) {
stefan4fbd1452015-09-28 03:57:14 -0700426 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, false, false);
stefane74eef12016-01-08 06:47:13 -0800427 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800428}
henrik.lundin@webrtc.org998cb8f2014-03-06 09:12:00 +0000429
Shao Changbine62202f2015-04-21 20:24:50 +0800430TEST_F(RampUpTest, UpDownUpOneStreamRtx) {
stefan4fbd1452015-09-28 03:57:14 -0700431 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, true, false);
stefane74eef12016-01-08 06:47:13 -0800432 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800433}
henrik.lundin@webrtc.org998cb8f2014-03-06 09:12:00 +0000434
Shao Changbine62202f2015-04-21 20:24:50 +0800435TEST_F(RampUpTest, UpDownUpThreeStreamsRtx) {
stefan4fbd1452015-09-28 03:57:14 -0700436 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, true, false);
stefane74eef12016-01-08 06:47:13 -0800437 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800438}
439
440TEST_F(RampUpTest, UpDownUpOneStreamByRedRtx) {
stefan4fbd1452015-09-28 03:57:14 -0700441 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, true, true);
stefane74eef12016-01-08 06:47:13 -0800442 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800443}
444
445TEST_F(RampUpTest, UpDownUpThreeStreamsByRedRtx) {
stefan4fbd1452015-09-28 03:57:14 -0700446 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, true, true);
stefane74eef12016-01-08 06:47:13 -0800447 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800448}
kjellanderf1685c72016-01-08 10:43:41 -0800449#endif
henrik.lundin@webrtc.org845862f2014-03-06 07:19:28 +0000450
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000451TEST_F(RampUpTest, AbsSendTimeSingleStream) {
stefanff483612015-12-21 03:14:00 -0800452 RampUpTester test(1, 0, 0, RtpExtension::kAbsSendTime, false, false);
stefane74eef12016-01-08 06:47:13 -0800453 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000454}
455
456TEST_F(RampUpTest, AbsSendTimeSimulcast) {
stefanff483612015-12-21 03:14:00 -0800457 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTime, false, false);
stefane74eef12016-01-08 06:47:13 -0800458 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000459}
460
461TEST_F(RampUpTest, AbsSendTimeSimulcastWithRtx) {
stefanff483612015-12-21 03:14:00 -0800462 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTime, true, false);
stefane74eef12016-01-08 06:47:13 -0800463 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800464}
465
466TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) {
stefanff483612015-12-21 03:14:00 -0800467 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTime, true, true);
stefane74eef12016-01-08 06:47:13 -0800468 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000469}
470
471TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) {
stefanff483612015-12-21 03:14:00 -0800472 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps,
473 RtpExtension::kAbsSendTime, false, false);
stefane74eef12016-01-08 06:47:13 -0800474 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000475}
Erik Språng6b8d3552015-09-24 15:06:57 +0200476
477TEST_F(RampUpTest, TransportSequenceNumberSingleStream) {
stefanff483612015-12-21 03:14:00 -0800478 RampUpTester test(1, 0, 0, RtpExtension::kTransportSequenceNumber, false,
479 false);
stefane74eef12016-01-08 06:47:13 -0800480 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200481}
482
483TEST_F(RampUpTest, TransportSequenceNumberSimulcast) {
stefanff483612015-12-21 03:14:00 -0800484 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumber, false,
485 false);
stefane74eef12016-01-08 06:47:13 -0800486 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200487}
488
489TEST_F(RampUpTest, TransportSequenceNumberSimulcastWithRtx) {
stefanff483612015-12-21 03:14:00 -0800490 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumber, true,
491 false);
stefane74eef12016-01-08 06:47:13 -0800492 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200493}
494
495TEST_F(RampUpTest, TransportSequenceNumberSimulcastByRedWithRtx) {
stefanff483612015-12-21 03:14:00 -0800496 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumber, true,
497 true);
stefane74eef12016-01-08 06:47:13 -0800498 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200499}
500
501TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) {
stefanff483612015-12-21 03:14:00 -0800502 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps,
stefan4fbd1452015-09-28 03:57:14 -0700503 RtpExtension::kTransportSequenceNumber, false, false);
stefane74eef12016-01-08 06:47:13 -0800504 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200505}
pbos@webrtc.org744fbc72013-09-10 09:26:25 +0000506} // namespace webrtc