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

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: Fix win compile issue... 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
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 test_start_ms_(-1), 48 test_start_ms_(-1),
49 ramp_up_finished_ms_(-1), 49 ramp_up_finished_ms_(-1),
50 extension_type_(extension_type), 50 extension_type_(extension_type),
51 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)), 51 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)),
52 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)), 52 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)),
53 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)), 53 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)),
54 poller_thread_(&BitrateStatsPollingThread, 54 poller_thread_(&BitrateStatsPollingThread,
55 this, 55 this,
56 "BitrateStatsPollingThread"), 56 "BitrateStatsPollingThread"),
57 sender_call_(nullptr) { 57 sender_call_(nullptr) {
58 EXPECT_LE(num_audio_streams_, 1u);
58 if (rtx_) { 59 if (rtx_) {
59 for (size_t i = 0; i < video_ssrcs_.size(); ++i) 60 for (size_t i = 0; i < video_ssrcs_.size(); ++i)
60 rtx_ssrc_map_[video_rtx_ssrcs_[i]] = video_ssrcs_[i]; 61 rtx_ssrc_map_[video_rtx_ssrcs_[i]] = video_ssrcs_[i];
61 } 62 }
62 } 63 }
63 64
64 RampUpTester::~RampUpTester() { 65 RampUpTester::~RampUpTester() {
65 event_.Set(); 66 event_.Set();
66 } 67 }
67 68
(...skipping 16 matching lines...) Expand all
84 send_transport_ = new test::PacketTransport(sender_call, this, 85 send_transport_ = new test::PacketTransport(sender_call, this,
85 test::PacketTransport::kSender, 86 test::PacketTransport::kSender,
86 forward_transport_config_); 87 forward_transport_config_);
87 return send_transport_; 88 return send_transport_;
88 } 89 }
89 90
90 size_t RampUpTester::GetNumVideoStreams() const { 91 size_t RampUpTester::GetNumVideoStreams() const {
91 return num_video_streams_; 92 return num_video_streams_;
92 } 93 }
93 94
95 size_t RampUpTester::GetNumAudioStreams() const {
96 return num_audio_streams_;
97 }
98
94 void RampUpTester::ModifyVideoConfigs( 99 void RampUpTester::ModifyVideoConfigs(
95 VideoSendStream::Config* send_config, 100 VideoSendStream::Config* send_config,
96 std::vector<VideoReceiveStream::Config>* receive_configs, 101 std::vector<VideoReceiveStream::Config>* receive_configs,
97 VideoEncoderConfig* encoder_config) { 102 VideoEncoderConfig* encoder_config) {
98 send_config->suspend_below_min_bitrate = true; 103 send_config->suspend_below_min_bitrate = true;
99 104
100 if (num_video_streams_ == 1) { 105 if (num_video_streams_ == 1) {
101 encoder_config->streams[0].target_bitrate_bps = 106 encoder_config->streams[0].target_bitrate_bps =
102 encoder_config->streams[0].max_bitrate_bps = 2000000; 107 encoder_config->streams[0].max_bitrate_bps = 2000000;
103 // For single stream rampup until 1mbps 108 // For single stream rampup until 1mbps
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (rtx_) { 169 if (rtx_) {
165 recv_config.rtp.rtx[send_config->encoder_settings.payload_type].ssrc = 170 recv_config.rtp.rtx[send_config->encoder_settings.payload_type].ssrc =
166 video_rtx_ssrcs_[i]; 171 video_rtx_ssrcs_[i];
167 recv_config.rtp.rtx[send_config->encoder_settings.payload_type] 172 recv_config.rtp.rtx[send_config->encoder_settings.payload_type]
168 .payload_type = send_config->rtp.rtx.payload_type; 173 .payload_type = send_config->rtp.rtx.payload_type;
169 } 174 }
170 ++i; 175 ++i;
171 } 176 }
172 } 177 }
173 178
179 void RampUpTester::ModifyAudioConfigs(
180 AudioSendStream::Config* send_config,
181 std::vector<AudioReceiveStream::Config>* receive_configs) {
182 if (num_audio_streams_ == 0)
183 return;
184
185 EXPECT_NE(RtpExtension::kTOffset, extension_type_)
186 << "Audio BWE not supported with toffset.";
187
188 send_config->rtp.ssrc = audio_ssrcs_[0];
189 send_config->rtp.extensions.clear();
190
191 bool transport_cc = false;
192 if (extension_type_ == RtpExtension::kAbsSendTime) {
193 transport_cc = false;
194 send_config->rtp.extensions.push_back(
195 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
196 } else if (extension_type_ == RtpExtension::kTransportSequenceNumber) {
197 transport_cc = true;
198 send_config->rtp.extensions.push_back(RtpExtension(
199 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
200 }
201
202 for (AudioReceiveStream::Config& recv_config : *receive_configs) {
203 recv_config.combined_audio_video_bwe = true;
204 recv_config.rtp.transport_cc = transport_cc;
205 recv_config.rtp.extensions = send_config->rtp.extensions;
206 recv_config.rtp.remote_ssrc = send_config->rtp.ssrc;
207 }
208 }
209
174 void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) { 210 void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
175 sender_call_ = sender_call; 211 sender_call_ = sender_call;
176 } 212 }
177 213
178 bool RampUpTester::BitrateStatsPollingThread(void* obj) { 214 bool RampUpTester::BitrateStatsPollingThread(void* obj) {
179 return static_cast<RampUpTester*>(obj)->PollStats(); 215 return static_cast<RampUpTester*>(obj)->PollStats();
180 } 216 }
181 217
182 bool RampUpTester::PollStats() { 218 bool RampUpTester::PollStats() {
183 if (sender_call_) { 219 if (sender_call_) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 stream.rtp_stats.fec.TotalBytes(); 260 stream.rtp_stats.fec.TotalBytes();
225 *padding_sent += stream.rtp_stats.transmitted.padding_bytes + 261 *padding_sent += stream.rtp_stats.transmitted.padding_bytes +
226 stream.rtp_stats.retransmitted.padding_bytes + 262 stream.rtp_stats.retransmitted.padding_bytes +
227 stream.rtp_stats.fec.padding_bytes; 263 stream.rtp_stats.fec.padding_bytes;
228 *media_sent += stream.rtp_stats.MediaPayloadBytes(); 264 *media_sent += stream.rtp_stats.MediaPayloadBytes();
229 } 265 }
230 266
231 void RampUpTester::TriggerTestDone() { 267 void RampUpTester::TriggerTestDone() {
232 RTC_DCHECK_GE(test_start_ms_, 0); 268 RTC_DCHECK_GE(test_start_ms_, 0);
233 269
270 // TODO(holmer): Add audio send stats here too when those APIs are available.
234 VideoSendStream::Stats send_stats = send_stream_->GetStats(); 271 VideoSendStream::Stats send_stats = send_stream_->GetStats();
235 272
236 size_t total_packets_sent = 0; 273 size_t total_packets_sent = 0;
237 size_t total_sent = 0; 274 size_t total_sent = 0;
238 size_t padding_sent = 0; 275 size_t padding_sent = 0;
239 size_t media_sent = 0; 276 size_t media_sent = 0;
240 for (uint32_t ssrc : video_ssrcs_) { 277 for (uint32_t ssrc : video_ssrcs_) {
241 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent, 278 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent,
242 &total_sent, &padding_sent, &media_sent); 279 &total_sent, &padding_sent, &media_sent);
243 } 280 }
(...skipping 13 matching lines...) Expand all
257 ReportResult("ramp-up-padding-sent", padding_sent, "bytes"); 294 ReportResult("ramp-up-padding-sent", padding_sent, "bytes");
258 ReportResult("ramp-up-rtx-total-packets-sent", rtx_total_packets_sent, 295 ReportResult("ramp-up-rtx-total-packets-sent", rtx_total_packets_sent,
259 "packets"); 296 "packets");
260 ReportResult("ramp-up-rtx-total-sent", rtx_total_sent, "bytes"); 297 ReportResult("ramp-up-rtx-total-sent", rtx_total_sent, "bytes");
261 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes"); 298 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes");
262 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes"); 299 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes");
263 if (ramp_up_finished_ms_ >= 0) { 300 if (ramp_up_finished_ms_ >= 0) {
264 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_, 301 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_,
265 "milliseconds"); 302 "milliseconds");
266 } 303 }
304 ReportResult("ramp-up-average-network-latency",
305 send_transport_->GetAverageDelayMs(), "milliseconds");
267 } 306 }
268 307
269 void RampUpTester::PerformTest() { 308 void RampUpTester::PerformTest() {
270 test_start_ms_ = clock_->TimeInMilliseconds(); 309 test_start_ms_ = clock_->TimeInMilliseconds();
271 poller_thread_.Start(); 310 poller_thread_.Start();
272 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete."; 311 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete.";
273 TriggerTestDone(); 312 TriggerTestDone();
274 poller_thread_.Stop(); 313 poller_thread_.Stop();
275 } 314 }
276 315
277 RampUpDownUpTester::RampUpDownUpTester(size_t num_streams, 316 RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams,
317 size_t num_audio_streams,
278 unsigned int start_bitrate_bps, 318 unsigned int start_bitrate_bps,
279 const std::string& extension_type, 319 const std::string& extension_type,
280 bool rtx, 320 bool rtx,
281 bool red) 321 bool red)
282 : RampUpTester(num_streams, 0, start_bitrate_bps, extension_type, rtx, red), 322 : RampUpTester(num_video_streams,
323 num_audio_streams,
324 start_bitrate_bps,
325 extension_type,
326 rtx,
327 red),
283 test_state_(kFirstRampup), 328 test_state_(kFirstRampup),
284 state_start_ms_(clock_->TimeInMilliseconds()), 329 state_start_ms_(clock_->TimeInMilliseconds()),
285 interval_start_ms_(clock_->TimeInMilliseconds()), 330 interval_start_ms_(clock_->TimeInMilliseconds()),
286 sent_bytes_(0) { 331 sent_bytes_(0) {
287 forward_transport_config_.link_capacity_kbps = kHighBandwidthLimitBps / 1000; 332 forward_transport_config_.link_capacity_kbps = kHighBandwidthLimitBps / 1000;
288 } 333 }
289 334
290 RampUpDownUpTester::~RampUpDownUpTester() {} 335 RampUpDownUpTester::~RampUpDownUpTester() {}
291 336
292 bool RampUpDownUpTester::PollStats() { 337 bool RampUpDownUpTester::PollStats() {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 interval_start_ms_ = now; 413 interval_start_ms_ = now;
369 sent_bytes_ = 0; 414 sent_bytes_ = 0;
370 } 415 }
371 break; 416 break;
372 } 417 }
373 case kSecondRampup: { 418 case kSecondRampup: {
374 if (bitrate_bps > kExpectedHighBitrateBps && !suspended) { 419 if (bitrate_bps > kExpectedHighBitrateBps && !suspended) {
375 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), 420 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
376 "second_rampup", now - state_start_ms_, "ms", 421 "second_rampup", now - state_start_ms_, "ms",
377 false); 422 false);
423 ReportResult("ramp-up-down-up-average-network-latency",
424 send_transport_->GetAverageDelayMs(), "milliseconds");
378 observation_complete_.Set(); 425 observation_complete_.Set();
379 } 426 }
380 break; 427 break;
381 } 428 }
382 } 429 }
383 } 430 }
384 431
385 class RampUpTest : public test::CallTest { 432 class RampUpTest : public test::CallTest {
386 public: 433 public:
387 RampUpTest() {} 434 RampUpTest() {}
(...skipping 26 matching lines...) Expand all
414 461
415 TEST_F(RampUpTest, SingleStreamWithHighStartBitrate) { 462 TEST_F(RampUpTest, SingleStreamWithHighStartBitrate) {
416 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, RtpExtension::kTOffset, 463 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, RtpExtension::kTOffset,
417 false, false); 464 false, false);
418 RunBaseTest(&test); 465 RunBaseTest(&test);
419 } 466 }
420 467
421 // Disabled on Mac due to flakiness, see 468 // Disabled on Mac due to flakiness, see
422 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5407 469 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5407
423 #ifndef WEBRTC_MAC 470 #ifndef WEBRTC_MAC
471
472 static const uint32_t kStartBitrateBps = 60000;
473
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