Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: webrtc/call/rampup_tests.cc

Issue 1582833002: Add ramp-up tests for transport sequence number with and w/o audio. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/call/rampup_tests.h ('k') | webrtc/test/direct_transport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/call/rampup_tests.h" 11 #include "webrtc/call/rampup_tests.h"
12 12
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "webrtc/base/checks.h" 14 #include "webrtc/base/checks.h"
15 #include "webrtc/base/platform_thread.h" 15 #include "webrtc/base/platform_thread.h"
16 #include "webrtc/test/testsupport/perf_test.h" 16 #include "webrtc/test/testsupport/perf_test.h"
17 17
18 namespace webrtc { 18 namespace webrtc {
19 namespace { 19 namespace {
20 20
21 static const uint32_t kStartBitrateBps = 60000;
21 static const int64_t kPollIntervalMs = 20; 22 static const int64_t kPollIntervalMs = 20;
22 23
23 std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) { 24 std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) {
24 std::vector<uint32_t> ssrcs; 25 std::vector<uint32_t> ssrcs;
25 for (size_t i = 0; i != num_streams; ++i) 26 for (size_t i = 0; i != num_streams; ++i)
26 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i)); 27 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i));
27 return ssrcs; 28 return ssrcs;
28 } 29 }
29 } // namespace 30 } // namespace
30 31
(...skipping 17 matching lines...) Expand all
48 test_start_ms_(-1), 49 test_start_ms_(-1),
49 ramp_up_finished_ms_(-1), 50 ramp_up_finished_ms_(-1),
50 extension_type_(extension_type), 51 extension_type_(extension_type),
51 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)), 52 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)),
52 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)), 53 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)),
53 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)), 54 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)),
54 poller_thread_(&BitrateStatsPollingThread, 55 poller_thread_(&BitrateStatsPollingThread,
55 this, 56 this,
56 "BitrateStatsPollingThread"), 57 "BitrateStatsPollingThread"),
57 sender_call_(nullptr) { 58 sender_call_(nullptr) {
59 EXPECT_LE(num_audio_streams_, 1u);
58 if (rtx_) { 60 if (rtx_) {
59 for (size_t i = 0; i < video_ssrcs_.size(); ++i) 61 for (size_t i = 0; i < video_ssrcs_.size(); ++i)
60 rtx_ssrc_map_[video_rtx_ssrcs_[i]] = video_ssrcs_[i]; 62 rtx_ssrc_map_[video_rtx_ssrcs_[i]] = video_ssrcs_[i];
61 } 63 }
62 } 64 }
63 65
64 RampUpTester::~RampUpTester() { 66 RampUpTester::~RampUpTester() {
65 event_.Set(); 67 event_.Set();
66 } 68 }
67 69
(...skipping 16 matching lines...) Expand all
84 send_transport_ = new test::PacketTransport(sender_call, this, 86 send_transport_ = new test::PacketTransport(sender_call, this,
85 test::PacketTransport::kSender, 87 test::PacketTransport::kSender,
86 forward_transport_config_); 88 forward_transport_config_);
87 return send_transport_; 89 return send_transport_;
88 } 90 }
89 91
90 size_t RampUpTester::GetNumVideoStreams() const { 92 size_t RampUpTester::GetNumVideoStreams() const {
91 return num_video_streams_; 93 return num_video_streams_;
92 } 94 }
93 95
96 size_t RampUpTester::GetNumAudioStreams() const {
97 return num_audio_streams_;
98 }
99
94 void RampUpTester::ModifyVideoConfigs( 100 void RampUpTester::ModifyVideoConfigs(
95 VideoSendStream::Config* send_config, 101 VideoSendStream::Config* send_config,
96 std::vector<VideoReceiveStream::Config>* receive_configs, 102 std::vector<VideoReceiveStream::Config>* receive_configs,
97 VideoEncoderConfig* encoder_config) { 103 VideoEncoderConfig* encoder_config) {
98 send_config->suspend_below_min_bitrate = true; 104 send_config->suspend_below_min_bitrate = true;
99 105
100 if (num_video_streams_ == 1) { 106 if (num_video_streams_ == 1) {
101 encoder_config->streams[0].target_bitrate_bps = 107 encoder_config->streams[0].target_bitrate_bps =
102 encoder_config->streams[0].max_bitrate_bps = 2000000; 108 encoder_config->streams[0].max_bitrate_bps = 2000000;
103 // For single stream rampup until 1mbps 109 // For single stream rampup until 1mbps
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (rtx_) { 170 if (rtx_) {
165 recv_config.rtp.rtx[send_config->encoder_settings.payload_type].ssrc = 171 recv_config.rtp.rtx[send_config->encoder_settings.payload_type].ssrc =
166 video_rtx_ssrcs_[i]; 172 video_rtx_ssrcs_[i];
167 recv_config.rtp.rtx[send_config->encoder_settings.payload_type] 173 recv_config.rtp.rtx[send_config->encoder_settings.payload_type]
168 .payload_type = send_config->rtp.rtx.payload_type; 174 .payload_type = send_config->rtp.rtx.payload_type;
169 } 175 }
170 ++i; 176 ++i;
171 } 177 }
172 } 178 }
173 179
180 void RampUpTester::ModifyAudioConfigs(
181 AudioSendStream::Config* send_config,
182 std::vector<AudioReceiveStream::Config>* receive_configs) {
183 if (num_audio_streams_ == 0)
184 return;
185
186 EXPECT_NE(RtpExtension::kTOffset, extension_type_)
187 << "Audio BWE not supported with toffset.";
188
189 send_config->rtp.ssrc = audio_ssrcs_[0];
190 send_config->rtp.extensions.clear();
191
192 bool transport_cc;
193 if (extension_type_ == RtpExtension::kAbsSendTime) {
194 transport_cc = false;
195 send_config->rtp.extensions.push_back(
196 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
197 } else if (extension_type_ == RtpExtension::kTransportSequenceNumber) {
198 transport_cc = true;
199 send_config->rtp.extensions.push_back(RtpExtension(
200 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
201 }
202
203 size_t i = 0;
mflodman 2016/01/13 15:12:45 Not used for real.
stefan-webrtc 2016/01/13 16:23:25 Done.
204 for (AudioReceiveStream::Config& recv_config : *receive_configs) {
205 recv_config.combined_audio_video_bwe = true;
206 recv_config.rtp.transport_cc = transport_cc;
207 recv_config.rtp.extensions = send_config->rtp.extensions;
208 recv_config.rtp.remote_ssrc = send_config->rtp.ssrc;
209 ++i;
210 }
211 }
212
174 void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) { 213 void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
175 sender_call_ = sender_call; 214 sender_call_ = sender_call;
176 } 215 }
177 216
178 bool RampUpTester::BitrateStatsPollingThread(void* obj) { 217 bool RampUpTester::BitrateStatsPollingThread(void* obj) {
179 return static_cast<RampUpTester*>(obj)->PollStats(); 218 return static_cast<RampUpTester*>(obj)->PollStats();
180 } 219 }
181 220
182 bool RampUpTester::PollStats() { 221 bool RampUpTester::PollStats() {
183 if (sender_call_) { 222 if (sender_call_) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 stream.rtp_stats.fec.TotalBytes(); 263 stream.rtp_stats.fec.TotalBytes();
225 *padding_sent += stream.rtp_stats.transmitted.padding_bytes + 264 *padding_sent += stream.rtp_stats.transmitted.padding_bytes +
226 stream.rtp_stats.retransmitted.padding_bytes + 265 stream.rtp_stats.retransmitted.padding_bytes +
227 stream.rtp_stats.fec.padding_bytes; 266 stream.rtp_stats.fec.padding_bytes;
228 *media_sent += stream.rtp_stats.MediaPayloadBytes(); 267 *media_sent += stream.rtp_stats.MediaPayloadBytes();
229 } 268 }
230 269
231 void RampUpTester::TriggerTestDone() { 270 void RampUpTester::TriggerTestDone() {
232 RTC_DCHECK_GE(test_start_ms_, 0); 271 RTC_DCHECK_GE(test_start_ms_, 0);
233 272
273 // TODO(holmer): Add audio send stats here too when those APIs are available.
234 VideoSendStream::Stats send_stats = send_stream_->GetStats(); 274 VideoSendStream::Stats send_stats = send_stream_->GetStats();
235 275
236 size_t total_packets_sent = 0; 276 size_t total_packets_sent = 0;
237 size_t total_sent = 0; 277 size_t total_sent = 0;
238 size_t padding_sent = 0; 278 size_t padding_sent = 0;
239 size_t media_sent = 0; 279 size_t media_sent = 0;
240 for (uint32_t ssrc : video_ssrcs_) { 280 for (uint32_t ssrc : video_ssrcs_) {
241 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent, 281 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent,
242 &total_sent, &padding_sent, &media_sent); 282 &total_sent, &padding_sent, &media_sent);
243 } 283 }
(...skipping 13 matching lines...) Expand all
257 ReportResult("ramp-up-padding-sent", padding_sent, "bytes"); 297 ReportResult("ramp-up-padding-sent", padding_sent, "bytes");
258 ReportResult("ramp-up-rtx-total-packets-sent", rtx_total_packets_sent, 298 ReportResult("ramp-up-rtx-total-packets-sent", rtx_total_packets_sent,
259 "packets"); 299 "packets");
260 ReportResult("ramp-up-rtx-total-sent", rtx_total_sent, "bytes"); 300 ReportResult("ramp-up-rtx-total-sent", rtx_total_sent, "bytes");
261 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes"); 301 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes");
262 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes"); 302 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes");
263 if (ramp_up_finished_ms_ >= 0) { 303 if (ramp_up_finished_ms_ >= 0) {
264 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_, 304 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_,
265 "milliseconds"); 305 "milliseconds");
266 } 306 }
307 ReportResult("ramp-up-average-network-latency",
308 send_transport_->GetAverageDelayMs(), "milliseconds");
267 } 309 }
268 310
269 void RampUpTester::PerformTest() { 311 void RampUpTester::PerformTest() {
270 test_start_ms_ = clock_->TimeInMilliseconds(); 312 test_start_ms_ = clock_->TimeInMilliseconds();
271 poller_thread_.Start(); 313 poller_thread_.Start();
272 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete."; 314 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete.";
273 TriggerTestDone(); 315 TriggerTestDone();
274 poller_thread_.Stop(); 316 poller_thread_.Stop();
275 } 317 }
276 318
277 RampUpDownUpTester::RampUpDownUpTester(size_t num_streams, 319 RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams,
320 size_t num_audio_streams,
278 unsigned int start_bitrate_bps, 321 unsigned int start_bitrate_bps,
279 const std::string& extension_type, 322 const std::string& extension_type,
280 bool rtx, 323 bool rtx,
281 bool red) 324 bool red)
282 : RampUpTester(num_streams, 0, start_bitrate_bps, extension_type, rtx, red), 325 : RampUpTester(num_video_streams,
326 num_audio_streams,
327 start_bitrate_bps,
328 extension_type,
329 rtx,
330 red),
283 test_state_(kFirstRampup), 331 test_state_(kFirstRampup),
284 state_start_ms_(clock_->TimeInMilliseconds()), 332 state_start_ms_(clock_->TimeInMilliseconds()),
285 interval_start_ms_(clock_->TimeInMilliseconds()), 333 interval_start_ms_(clock_->TimeInMilliseconds()),
286 sent_bytes_(0) { 334 sent_bytes_(0) {
287 forward_transport_config_.link_capacity_kbps = kHighBandwidthLimitBps / 1000; 335 forward_transport_config_.link_capacity_kbps = kHighBandwidthLimitBps / 1000;
288 } 336 }
289 337
290 RampUpDownUpTester::~RampUpDownUpTester() {} 338 RampUpDownUpTester::~RampUpDownUpTester() {}
291 339
292 bool RampUpDownUpTester::PollStats() { 340 bool RampUpDownUpTester::PollStats() {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 interval_start_ms_ = now; 416 interval_start_ms_ = now;
369 sent_bytes_ = 0; 417 sent_bytes_ = 0;
370 } 418 }
371 break; 419 break;
372 } 420 }
373 case kSecondRampup: { 421 case kSecondRampup: {
374 if (bitrate_bps > kExpectedHighBitrateBps && !suspended) { 422 if (bitrate_bps > kExpectedHighBitrateBps && !suspended) {
375 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), 423 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
376 "second_rampup", now - state_start_ms_, "ms", 424 "second_rampup", now - state_start_ms_, "ms",
377 false); 425 false);
426 ReportResult("ramp-up-down-up-average-network-latency",
427 send_transport_->GetAverageDelayMs(), "milliseconds");
378 observation_complete_.Set(); 428 observation_complete_.Set();
379 } 429 }
380 break; 430 break;
381 } 431 }
382 } 432 }
383 } 433 }
384 434
385 class RampUpTest : public test::CallTest { 435 class RampUpTest : public test::CallTest {
386 public: 436 public:
387 RampUpTest() {} 437 RampUpTest() {}
(...skipping 27 matching lines...) Expand all
415 TEST_F(RampUpTest, SingleStreamWithHighStartBitrate) { 465 TEST_F(RampUpTest, SingleStreamWithHighStartBitrate) {
416 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, RtpExtension::kTOffset, 466 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, RtpExtension::kTOffset,
417 false, false); 467 false, false);
418 RunBaseTest(&test); 468 RunBaseTest(&test);
419 } 469 }
420 470
421 // Disabled on Mac due to flakiness, see 471 // Disabled on Mac due to flakiness, see
422 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5407 472 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5407
423 #ifndef WEBRTC_MAC 473 #ifndef WEBRTC_MAC
424 TEST_F(RampUpTest, UpDownUpOneStream) { 474 TEST_F(RampUpTest, UpDownUpOneStream) {
425 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, false, false); 475 RampUpDownUpTester test(1, 0, kStartBitrateBps, RtpExtension::kAbsSendTime,
476 false, false);
426 RunBaseTest(&test); 477 RunBaseTest(&test);
427 } 478 }
428 479
429 TEST_F(RampUpTest, UpDownUpThreeStreams) { 480 TEST_F(RampUpTest, UpDownUpThreeStreams) {
430 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, false, false); 481 RampUpDownUpTester test(3, 0, kStartBitrateBps, RtpExtension::kAbsSendTime,
482 false, false);
431 RunBaseTest(&test); 483 RunBaseTest(&test);
432 } 484 }
433 485
434 TEST_F(RampUpTest, UpDownUpOneStreamRtx) { 486 TEST_F(RampUpTest, UpDownUpOneStreamRtx) {
435 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, true, false); 487 RampUpDownUpTester test(1, 0, kStartBitrateBps, RtpExtension::kAbsSendTime,
488 true, false);
436 RunBaseTest(&test); 489 RunBaseTest(&test);
437 } 490 }
438 491
439 TEST_F(RampUpTest, UpDownUpThreeStreamsRtx) { 492 TEST_F(RampUpTest, UpDownUpThreeStreamsRtx) {
440 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, true, false); 493 RampUpDownUpTester test(3, 0, kStartBitrateBps, RtpExtension::kAbsSendTime,
494 true, false);
441 RunBaseTest(&test); 495 RunBaseTest(&test);
442 } 496 }
443 497
444 TEST_F(RampUpTest, UpDownUpOneStreamByRedRtx) { 498 TEST_F(RampUpTest, UpDownUpOneStreamByRedRtx) {
445 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, true, true); 499 RampUpDownUpTester test(1, 0, kStartBitrateBps, RtpExtension::kAbsSendTime,
500 true, true);
446 RunBaseTest(&test); 501 RunBaseTest(&test);
447 } 502 }
448 503
449 TEST_F(RampUpTest, UpDownUpThreeStreamsByRedRtx) { 504 TEST_F(RampUpTest, UpDownUpThreeStreamsByRedRtx) {
450 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, true, true); 505 RampUpDownUpTester test(3, 0, kStartBitrateBps, RtpExtension::kAbsSendTime,
506 true, true);
451 RunBaseTest(&test); 507 RunBaseTest(&test);
452 } 508 }
509
510 TEST_F(RampUpTest, SendSideVideoUpDownUpRtx) {
511 RampUpDownUpTester test(3, 0, kStartBitrateBps,
512 RtpExtension::kTransportSequenceNumber, true, false);
513 RunBaseTest(&test);
514 }
515
516 // TODO(holmer): Enable when audio bitrates are included in the bitrate
517 // allocation.
518 TEST_F(RampUpTest, DISABLED_SendSideAudioVideoUpDownUpRtx) {
519 RampUpDownUpTester test(3, 1, kStartBitrateBps,
520 RtpExtension::kTransportSequenceNumber, true, false);
521 RunBaseTest(&test);
522 }
523
453 #endif 524 #endif
454 525
455 TEST_F(RampUpTest, AbsSendTimeSingleStream) { 526 TEST_F(RampUpTest, AbsSendTimeSingleStream) {
456 RampUpTester test(1, 0, 0, RtpExtension::kAbsSendTime, false, false); 527 RampUpTester test(1, 0, 0, RtpExtension::kAbsSendTime, false, false);
457 RunBaseTest(&test); 528 RunBaseTest(&test);
458 } 529 }
459 530
460 TEST_F(RampUpTest, AbsSendTimeSimulcast) { 531 TEST_F(RampUpTest, AbsSendTimeSimulcast) {
461 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTime, false, false); 532 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTime, false, false);
462 RunBaseTest(&test); 533 RunBaseTest(&test);
(...skipping 26 matching lines...) Expand all
489 false); 560 false);
490 RunBaseTest(&test); 561 RunBaseTest(&test);
491 } 562 }
492 563
493 TEST_F(RampUpTest, TransportSequenceNumberSimulcastWithRtx) { 564 TEST_F(RampUpTest, TransportSequenceNumberSimulcastWithRtx) {
494 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumber, true, 565 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumber, true,
495 false); 566 false);
496 RunBaseTest(&test); 567 RunBaseTest(&test);
497 } 568 }
498 569
570 TEST_F(RampUpTest, AudioVideoTransportSequenceNumberSimulcastWithRtx) {
571 RampUpTester test(3, 1, 0, RtpExtension::kTransportSequenceNumber, true,
572 false);
573 RunBaseTest(&test);
574 }
575
499 TEST_F(RampUpTest, TransportSequenceNumberSimulcastByRedWithRtx) { 576 TEST_F(RampUpTest, TransportSequenceNumberSimulcastByRedWithRtx) {
500 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumber, true, 577 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumber, true,
501 true); 578 true);
502 RunBaseTest(&test); 579 RunBaseTest(&test);
503 } 580 }
504 581
505 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) { 582 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) {
506 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, 583 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps,
507 RtpExtension::kTransportSequenceNumber, false, false); 584 RtpExtension::kTransportSequenceNumber, false, false);
508 RunBaseTest(&test); 585 RunBaseTest(&test);
509 } 586 }
510 } // namespace webrtc 587 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/rampup_tests.h ('k') | webrtc/test/direct_transport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698