blob: a3fcc302f3bdfb65b9428453e453d2bc2fd7fc00 [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
Stefan Holmerd20e6512016-01-12 15:51:22 +010090size_t RampUpTester::GetNumVideoStreams() const {
91 return num_video_streams_;
92}
93
stefanff483612015-12-21 03:14:00 -080094void RampUpTester::ModifyVideoConfigs(
stefan4fbd1452015-09-28 03:57:14 -070095 VideoSendStream::Config* send_config,
96 std::vector<VideoReceiveStream::Config>* receive_configs,
97 VideoEncoderConfig* encoder_config) {
98 send_config->suspend_below_min_bitrate = true;
99
stefanff483612015-12-21 03:14:00 -0800100 if (num_video_streams_ == 1) {
stefan4fbd1452015-09-28 03:57:14 -0700101 encoder_config->streams[0].target_bitrate_bps =
102 encoder_config->streams[0].max_bitrate_bps = 2000000;
103 // For single stream rampup until 1mbps
104 expected_bitrate_bps_ = kSingleStreamTargetBps;
105 } else {
106 // For multi stream rampup until all streams are being sent. That means
107 // enough birate to send all the target streams plus the min bitrate of
108 // the last one.
109 expected_bitrate_bps_ = encoder_config->streams.back().min_bitrate_bps;
110 for (size_t i = 0; i < encoder_config->streams.size() - 1; ++i) {
111 expected_bitrate_bps_ += encoder_config->streams[i].target_bitrate_bps;
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000112 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000113 }
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000114
stefan4fbd1452015-09-28 03:57:14 -0700115 send_config->rtp.extensions.clear();
116
117 bool remb;
stefan43edf0f2015-11-20 18:05:48 -0800118 bool transport_cc;
stefan4fbd1452015-09-28 03:57:14 -0700119 if (extension_type_ == RtpExtension::kAbsSendTime) {
120 remb = true;
stefan43edf0f2015-11-20 18:05:48 -0800121 transport_cc = false;
stefan4fbd1452015-09-28 03:57:14 -0700122 send_config->rtp.extensions.push_back(
123 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
124 } else if (extension_type_ == RtpExtension::kTransportSequenceNumber) {
125 remb = false;
stefan43edf0f2015-11-20 18:05:48 -0800126 transport_cc = true;
stefan4fbd1452015-09-28 03:57:14 -0700127 send_config->rtp.extensions.push_back(RtpExtension(
128 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000129 } else {
stefan4fbd1452015-09-28 03:57:14 -0700130 remb = true;
stefan43edf0f2015-11-20 18:05:48 -0800131 transport_cc = false;
stefan4fbd1452015-09-28 03:57:14 -0700132 send_config->rtp.extensions.push_back(RtpExtension(
133 extension_type_.c_str(), kTransmissionTimeOffsetExtensionId));
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000134 }
stefan4fbd1452015-09-28 03:57:14 -0700135
136 send_config->rtp.nack.rtp_history_ms = test::CallTest::kNackRtpHistoryMs;
stefanff483612015-12-21 03:14:00 -0800137 send_config->rtp.ssrcs = video_ssrcs_;
stefan4fbd1452015-09-28 03:57:14 -0700138 if (rtx_) {
139 send_config->rtp.rtx.payload_type = test::CallTest::kSendRtxPayloadType;
stefanff483612015-12-21 03:14:00 -0800140 send_config->rtp.rtx.ssrcs = video_rtx_ssrcs_;
stefan4fbd1452015-09-28 03:57:14 -0700141 }
142 if (red_) {
143 send_config->rtp.fec.ulpfec_payload_type =
144 test::CallTest::kUlpfecPayloadType;
145 send_config->rtp.fec.red_payload_type = test::CallTest::kRedPayloadType;
146 }
147
148 size_t i = 0;
149 for (VideoReceiveStream::Config& recv_config : *receive_configs) {
150 recv_config.rtp.remb = remb;
stefan43edf0f2015-11-20 18:05:48 -0800151 recv_config.rtp.transport_cc = transport_cc;
stefan4fbd1452015-09-28 03:57:14 -0700152 recv_config.rtp.extensions = send_config->rtp.extensions;
153
stefanff483612015-12-21 03:14:00 -0800154 recv_config.rtp.remote_ssrc = video_ssrcs_[i];
stefan4fbd1452015-09-28 03:57:14 -0700155 recv_config.rtp.nack.rtp_history_ms = send_config->rtp.nack.rtp_history_ms;
156
157 if (red_) {
158 recv_config.rtp.fec.red_payload_type =
159 send_config->rtp.fec.red_payload_type;
160 recv_config.rtp.fec.ulpfec_payload_type =
161 send_config->rtp.fec.ulpfec_payload_type;
162 }
163
164 if (rtx_) {
165 recv_config.rtp.rtx[send_config->encoder_settings.payload_type].ssrc =
stefanff483612015-12-21 03:14:00 -0800166 video_rtx_ssrcs_[i];
stefan4fbd1452015-09-28 03:57:14 -0700167 recv_config.rtp.rtx[send_config->encoder_settings.payload_type]
168 .payload_type = send_config->rtp.rtx.payload_type;
169 }
170 ++i;
171 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000172}
173
stefan4fbd1452015-09-28 03:57:14 -0700174void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
175 sender_call_ = sender_call;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000176}
177
stefan4fbd1452015-09-28 03:57:14 -0700178bool RampUpTester::BitrateStatsPollingThread(void* obj) {
179 return static_cast<RampUpTester*>(obj)->PollStats();
pbos@webrtc.org32452b22014-10-22 12:15:24 +0000180}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000181
stefan4fbd1452015-09-28 03:57:14 -0700182bool RampUpTester::PollStats() {
183 if (sender_call_) {
184 Call::Stats stats = sender_call_->GetStats();
185
186 RTC_DCHECK_GT(expected_bitrate_bps_, 0);
187 if (!start_bitrate_verified_ && start_bitrate_bps_ != 0) {
188 // For tests with an explicitly set start bitrate, verify the first
189 // bitrate estimate is close to the start bitrate and lower than the
190 // test target bitrate. This is to verify a call respects the configured
191 // start bitrate, but due to the BWE implementation we can't guarantee the
192 // first estimate really is as high as the start bitrate.
193 EXPECT_GT(stats.send_bandwidth_bps, 0.9 * start_bitrate_bps_);
194 start_bitrate_verified_ = true;
195 }
196 if (stats.send_bandwidth_bps >= expected_bitrate_bps_) {
197 ramp_up_finished_ms_ = clock_->TimeInMilliseconds();
Peter Boström5811a392015-12-10 13:02:50 +0100198 observation_complete_.Set();
stefan4fbd1452015-09-28 03:57:14 -0700199 }
200 }
201
202 return !event_.Wait(kPollIntervalMs);
Erik Språng468e62a2015-07-06 10:50:47 +0200203}
204
stefan4fbd1452015-09-28 03:57:14 -0700205void RampUpTester::ReportResult(const std::string& measurement,
206 size_t value,
207 const std::string& units) const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000208 webrtc::test::PrintResult(
209 measurement, "",
stefanff483612015-12-21 03:14:00 -0800210 ::testing::UnitTest::GetInstance()->current_test_info()->name(), value,
211 units, false);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000212}
213
stefan092508a2015-09-29 02:26:42 -0700214void RampUpTester::AccumulateStats(const VideoSendStream::StreamStats& stream,
215 size_t* total_packets_sent,
216 size_t* total_sent,
217 size_t* padding_sent,
218 size_t* media_sent) const {
stefan4fbd1452015-09-28 03:57:14 -0700219 *total_packets_sent += stream.rtp_stats.transmitted.packets +
220 stream.rtp_stats.retransmitted.packets +
221 stream.rtp_stats.fec.packets;
222 *total_sent += stream.rtp_stats.transmitted.TotalBytes() +
223 stream.rtp_stats.retransmitted.TotalBytes() +
224 stream.rtp_stats.fec.TotalBytes();
225 *padding_sent += stream.rtp_stats.transmitted.padding_bytes +
226 stream.rtp_stats.retransmitted.padding_bytes +
227 stream.rtp_stats.fec.padding_bytes;
228 *media_sent += stream.rtp_stats.MediaPayloadBytes();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000229}
230
stefan4fbd1452015-09-28 03:57:14 -0700231void RampUpTester::TriggerTestDone() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200232 RTC_DCHECK_GE(test_start_ms_, 0);
233
stefan4fbd1452015-09-28 03:57:14 -0700234 VideoSendStream::Stats send_stats = send_stream_->GetStats();
235
236 size_t total_packets_sent = 0;
237 size_t total_sent = 0;
238 size_t padding_sent = 0;
239 size_t media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800240 for (uint32_t ssrc : video_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700241 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent,
242 &total_sent, &padding_sent, &media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700243 }
244
245 size_t rtx_total_packets_sent = 0;
246 size_t rtx_total_sent = 0;
247 size_t rtx_padding_sent = 0;
248 size_t rtx_media_sent = 0;
stefanff483612015-12-21 03:14:00 -0800249 for (uint32_t rtx_ssrc : video_rtx_ssrcs_) {
stefan092508a2015-09-29 02:26:42 -0700250 AccumulateStats(send_stats.substreams[rtx_ssrc], &rtx_total_packets_sent,
251 &rtx_total_sent, &rtx_padding_sent, &rtx_media_sent);
stefan4fbd1452015-09-28 03:57:14 -0700252 }
253
254 ReportResult("ramp-up-total-packets-sent", total_packets_sent, "packets");
255 ReportResult("ramp-up-total-sent", total_sent, "bytes");
256 ReportResult("ramp-up-media-sent", media_sent, "bytes");
257 ReportResult("ramp-up-padding-sent", padding_sent, "bytes");
258 ReportResult("ramp-up-rtx-total-packets-sent", rtx_total_packets_sent,
259 "packets");
260 ReportResult("ramp-up-rtx-total-sent", rtx_total_sent, "bytes");
261 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes");
262 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes");
263 if (ramp_up_finished_ms_ >= 0) {
264 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_,
265 "milliseconds");
266 }
267}
268
269void RampUpTester::PerformTest() {
Erik Språngf3a7c9d2015-10-05 14:03:22 +0200270 test_start_ms_ = clock_->TimeInMilliseconds();
Peter Boström8c38e8b2015-11-26 17:45:47 +0100271 poller_thread_.Start();
Peter Boström5811a392015-12-10 13:02:50 +0100272 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete.";
stefan4fbd1452015-09-28 03:57:14 -0700273 TriggerTestDone();
Peter Boström8c38e8b2015-11-26 17:45:47 +0100274 poller_thread_.Stop();
stefan4fbd1452015-09-28 03:57:14 -0700275}
276
277RampUpDownUpTester::RampUpDownUpTester(size_t num_streams,
278 unsigned int start_bitrate_bps,
279 const std::string& extension_type,
280 bool rtx,
281 bool red)
stefanff483612015-12-21 03:14:00 -0800282 : RampUpTester(num_streams, 0, start_bitrate_bps, extension_type, rtx, red),
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000283 test_state_(kFirstRampup),
284 state_start_ms_(clock_->TimeInMilliseconds()),
stefan4fbd1452015-09-28 03:57:14 -0700285 interval_start_ms_(clock_->TimeInMilliseconds()),
286 sent_bytes_(0) {
stefanff483612015-12-21 03:14:00 -0800287 forward_transport_config_.link_capacity_kbps = kHighBandwidthLimitBps / 1000;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000288}
289
stefan4fbd1452015-09-28 03:57:14 -0700290RampUpDownUpTester::~RampUpDownUpTester() {}
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000291
stefan4fbd1452015-09-28 03:57:14 -0700292bool RampUpDownUpTester::PollStats() {
293 if (send_stream_) {
294 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
295 int transmit_bitrate_bps = 0;
296 for (auto it : stats.substreams) {
297 transmit_bitrate_bps += it.second.total_bitrate_bps;
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +0000298 }
stefan4fbd1452015-09-28 03:57:14 -0700299
300 EvolveTestState(transmit_bitrate_bps, stats.suspended);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000301 }
stefan4fbd1452015-09-28 03:57:14 -0700302
303 return !event_.Wait(kPollIntervalMs);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000304}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000305
stefan4fbd1452015-09-28 03:57:14 -0700306Call::Config RampUpDownUpTester::GetReceiverCallConfig() {
307 Call::Config config;
308 config.bitrate_config.min_bitrate_bps = 10000;
309 return config;
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000310}
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000311
stefan4fbd1452015-09-28 03:57:14 -0700312std::string RampUpDownUpTester::GetModifierString() const {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000313 std::string str("_");
stefanff483612015-12-21 03:14:00 -0800314 if (num_video_streams_ > 0) {
315 std::ostringstream s;
316 s << num_video_streams_;
317 str += s.str();
318 str += "stream";
319 str += (num_video_streams_ > 1 ? "s" : "");
320 str += "_";
321 }
322 if (num_audio_streams_ > 0) {
323 std::ostringstream s;
324 s << num_audio_streams_;
325 str += s.str();
326 str += "stream";
327 str += (num_audio_streams_ > 1 ? "s" : "");
328 str += "_";
329 }
stefan4fbd1452015-09-28 03:57:14 -0700330 str += (rtx_ ? "" : "no");
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000331 str += "rtx";
332 return str;
333}
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000334
stefan4fbd1452015-09-28 03:57:14 -0700335void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000336 int64_t now = clock_->TimeInMilliseconds();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000337 switch (test_state_) {
338 case kFirstRampup: {
stefan4fbd1452015-09-28 03:57:14 -0700339 EXPECT_FALSE(suspended);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000340 if (bitrate_bps > kExpectedHighBitrateBps) {
341 // The first ramp-up has reached the target bitrate. Change the
342 // channel limit, and move to the next test state.
343 forward_transport_config_.link_capacity_kbps =
344 kLowBandwidthLimitBps / 1000;
stefanf116bd02015-10-27 08:29:42 -0700345 send_transport_->SetConfig(forward_transport_config_);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000346 test_state_ = kLowRate;
stefanff483612015-12-21 03:14:00 -0800347 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
348 "first_rampup", now - state_start_ms_, "ms",
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000349 false);
350 state_start_ms_ = now;
351 interval_start_ms_ = now;
352 sent_bytes_ = 0;
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000353 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000354 break;
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000355 }
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000356 case kLowRate: {
stefan4fbd1452015-09-28 03:57:14 -0700357 if (bitrate_bps < kExpectedLowBitrateBps && suspended) {
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000358 // The ramp-down was successful. Change the channel limit back to a
359 // high value, and move to the next test state.
360 forward_transport_config_.link_capacity_kbps =
361 kHighBandwidthLimitBps / 1000;
stefanf116bd02015-10-27 08:29:42 -0700362 send_transport_->SetConfig(forward_transport_config_);
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000363 test_state_ = kSecondRampup;
stefanff483612015-12-21 03:14:00 -0800364 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
365 "rampdown", now - state_start_ms_, "ms",
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000366 false);
367 state_start_ms_ = now;
368 interval_start_ms_ = now;
369 sent_bytes_ = 0;
370 }
371 break;
372 }
373 case kSecondRampup: {
stefan4fbd1452015-09-28 03:57:14 -0700374 if (bitrate_bps > kExpectedHighBitrateBps && !suspended) {
stefanff483612015-12-21 03:14:00 -0800375 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
376 "second_rampup", now - state_start_ms_, "ms",
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000377 false);
Peter Boström5811a392015-12-10 13:02:50 +0100378 observation_complete_.Set();
stefan@webrtc.org3d7da882014-07-08 13:59:46 +0000379 }
380 break;
381 }
382 }
383}
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000384
stefan4fbd1452015-09-28 03:57:14 -0700385class RampUpTest : public test::CallTest {
Erik Språng6b8d3552015-09-24 15:06:57 +0200386 public:
stefan4fbd1452015-09-28 03:57:14 -0700387 RampUpTest() {}
Erik Språng6b8d3552015-09-24 15:06:57 +0200388
stefan4fbd1452015-09-28 03:57:14 -0700389 virtual ~RampUpTest() {
stefanff483612015-12-21 03:14:00 -0800390 EXPECT_EQ(nullptr, video_send_stream_);
391 EXPECT_TRUE(video_receive_streams_.empty());
Erik Språng6b8d3552015-09-24 15:06:57 +0200392 }
Erik Språng6b8d3552015-09-24 15:06:57 +0200393};
394
stefan@webrtc.orgcb254aa2014-06-12 15:12:25 +0000395TEST_F(RampUpTest, SingleStream) {
stefanff483612015-12-21 03:14:00 -0800396 RampUpTester test(1, 0, 0, RtpExtension::kTOffset, false, false);
stefane74eef12016-01-08 06:47:13 -0800397 RunBaseTest(&test);
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000398}
pbos@webrtc.org744fbc72013-09-10 09:26:25 +0000399
stefan@webrtc.orgcb254aa2014-06-12 15:12:25 +0000400TEST_F(RampUpTest, Simulcast) {
stefanff483612015-12-21 03:14:00 -0800401 RampUpTester test(3, 0, 0, RtpExtension::kTOffset, false, false);
stefane74eef12016-01-08 06:47:13 -0800402 RunBaseTest(&test);
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000403}
404
stefan@webrtc.orgcb254aa2014-06-12 15:12:25 +0000405TEST_F(RampUpTest, SimulcastWithRtx) {
stefanff483612015-12-21 03:14:00 -0800406 RampUpTester test(3, 0, 0, RtpExtension::kTOffset, true, false);
stefane74eef12016-01-08 06:47:13 -0800407 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800408}
409
410TEST_F(RampUpTest, SimulcastByRedWithRtx) {
stefanff483612015-12-21 03:14:00 -0800411 RampUpTester test(3, 0, 0, RtpExtension::kTOffset, true, true);
stefane74eef12016-01-08 06:47:13 -0800412 RunBaseTest(&test);
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +0000413}
414
415TEST_F(RampUpTest, SingleStreamWithHighStartBitrate) {
stefanff483612015-12-21 03:14:00 -0800416 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, RtpExtension::kTOffset,
stefan4fbd1452015-09-28 03:57:14 -0700417 false, false);
stefane74eef12016-01-08 06:47:13 -0800418 RunBaseTest(&test);
andresp@webrtc.orgc1480792014-03-20 03:23:55 +0000419}
pbos@webrtc.org744fbc72013-09-10 09:26:25 +0000420
kjellanderf1685c72016-01-08 10:43:41 -0800421// Disabled on Mac due to flakiness, see
422// https://bugs.chromium.org/p/webrtc/issues/detail?id=5407
423#ifndef WEBRTC_MAC
Shao Changbine62202f2015-04-21 20:24:50 +0800424TEST_F(RampUpTest, UpDownUpOneStream) {
stefan4fbd1452015-09-28 03:57:14 -0700425 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, false, false);
stefane74eef12016-01-08 06:47:13 -0800426 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800427}
henrik.lundin@webrtc.org845862f2014-03-06 07:19:28 +0000428
Shao Changbine62202f2015-04-21 20:24:50 +0800429TEST_F(RampUpTest, UpDownUpThreeStreams) {
stefan4fbd1452015-09-28 03:57:14 -0700430 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, false, false);
stefane74eef12016-01-08 06:47:13 -0800431 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800432}
henrik.lundin@webrtc.org998cb8f2014-03-06 09:12:00 +0000433
Shao Changbine62202f2015-04-21 20:24:50 +0800434TEST_F(RampUpTest, UpDownUpOneStreamRtx) {
stefan4fbd1452015-09-28 03:57:14 -0700435 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, true, false);
stefane74eef12016-01-08 06:47:13 -0800436 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800437}
henrik.lundin@webrtc.org998cb8f2014-03-06 09:12:00 +0000438
Shao Changbine62202f2015-04-21 20:24:50 +0800439TEST_F(RampUpTest, UpDownUpThreeStreamsRtx) {
stefan4fbd1452015-09-28 03:57:14 -0700440 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, true, false);
stefane74eef12016-01-08 06:47:13 -0800441 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800442}
443
444TEST_F(RampUpTest, UpDownUpOneStreamByRedRtx) {
stefan4fbd1452015-09-28 03:57:14 -0700445 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, true, true);
stefane74eef12016-01-08 06:47:13 -0800446 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800447}
448
449TEST_F(RampUpTest, UpDownUpThreeStreamsByRedRtx) {
stefan4fbd1452015-09-28 03:57:14 -0700450 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, true, true);
stefane74eef12016-01-08 06:47:13 -0800451 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800452}
kjellanderf1685c72016-01-08 10:43:41 -0800453#endif
henrik.lundin@webrtc.org845862f2014-03-06 07:19:28 +0000454
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000455TEST_F(RampUpTest, AbsSendTimeSingleStream) {
stefanff483612015-12-21 03:14:00 -0800456 RampUpTester test(1, 0, 0, RtpExtension::kAbsSendTime, false, false);
stefane74eef12016-01-08 06:47:13 -0800457 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000458}
459
460TEST_F(RampUpTest, AbsSendTimeSimulcast) {
stefanff483612015-12-21 03:14:00 -0800461 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTime, false, false);
stefane74eef12016-01-08 06:47:13 -0800462 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000463}
464
465TEST_F(RampUpTest, AbsSendTimeSimulcastWithRtx) {
stefanff483612015-12-21 03:14:00 -0800466 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTime, true, false);
stefane74eef12016-01-08 06:47:13 -0800467 RunBaseTest(&test);
Shao Changbine62202f2015-04-21 20:24:50 +0800468}
469
470TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) {
stefanff483612015-12-21 03:14:00 -0800471 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTime, true, true);
stefane74eef12016-01-08 06:47:13 -0800472 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000473}
474
475TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) {
stefanff483612015-12-21 03:14:00 -0800476 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps,
477 RtpExtension::kAbsSendTime, false, false);
stefane74eef12016-01-08 06:47:13 -0800478 RunBaseTest(&test);
pbos@webrtc.org85bd53e2014-12-10 10:36:20 +0000479}
Erik Språng6b8d3552015-09-24 15:06:57 +0200480
481TEST_F(RampUpTest, TransportSequenceNumberSingleStream) {
stefanff483612015-12-21 03:14:00 -0800482 RampUpTester test(1, 0, 0, RtpExtension::kTransportSequenceNumber, false,
483 false);
stefane74eef12016-01-08 06:47:13 -0800484 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200485}
486
487TEST_F(RampUpTest, TransportSequenceNumberSimulcast) {
stefanff483612015-12-21 03:14:00 -0800488 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumber, false,
489 false);
stefane74eef12016-01-08 06:47:13 -0800490 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200491}
492
493TEST_F(RampUpTest, TransportSequenceNumberSimulcastWithRtx) {
stefanff483612015-12-21 03:14:00 -0800494 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumber, true,
495 false);
stefane74eef12016-01-08 06:47:13 -0800496 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200497}
498
499TEST_F(RampUpTest, TransportSequenceNumberSimulcastByRedWithRtx) {
stefanff483612015-12-21 03:14:00 -0800500 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumber, true,
501 true);
stefane74eef12016-01-08 06:47:13 -0800502 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200503}
504
505TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) {
stefanff483612015-12-21 03:14:00 -0800506 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps,
stefan4fbd1452015-09-28 03:57:14 -0700507 RtpExtension::kTransportSequenceNumber, false, false);
stefane74eef12016-01-08 06:47:13 -0800508 RunBaseTest(&test);
Erik Språng6b8d3552015-09-24 15:06:57 +0200509}
pbos@webrtc.org744fbc72013-09-10 09:26:25 +0000510} // namespace webrtc