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

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

Issue 2165743003: Variable audio bitrate. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 4 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/media/engine/webrtcvoiceengine.cc » ('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 23 matching lines...) Expand all
34 const std::string& extension_type, 34 const std::string& extension_type,
35 bool rtx, 35 bool rtx,
36 bool red) 36 bool red)
37 : EndToEndTest(test::CallTest::kLongTimeoutMs), 37 : EndToEndTest(test::CallTest::kLongTimeoutMs),
38 event_(false, false), 38 event_(false, false),
39 clock_(Clock::GetRealTimeClock()), 39 clock_(Clock::GetRealTimeClock()),
40 num_video_streams_(num_video_streams), 40 num_video_streams_(num_video_streams),
41 num_audio_streams_(num_audio_streams), 41 num_audio_streams_(num_audio_streams),
42 rtx_(rtx), 42 rtx_(rtx),
43 red_(red), 43 red_(red),
44 sender_call_(nullptr),
44 send_stream_(nullptr), 45 send_stream_(nullptr),
45 start_bitrate_bps_(start_bitrate_bps), 46 start_bitrate_bps_(start_bitrate_bps),
46 start_bitrate_verified_(false), 47 start_bitrate_verified_(false),
47 expected_bitrate_bps_(0), 48 expected_bitrate_bps_(0),
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 EXPECT_LE(num_audio_streams_, 1u); 58 EXPECT_LE(num_audio_streams_, 1u);
59 if (rtx_) { 59 if (rtx_) {
60 for (size_t i = 0; i < video_ssrcs_.size(); ++i) 60 for (size_t i = 0; i < video_ssrcs_.size(); ++i)
61 rtx_ssrc_map_[video_rtx_ssrcs_[i]] = video_ssrcs_[i]; 61 rtx_ssrc_map_[video_rtx_ssrcs_[i]] = video_ssrcs_[i];
62 } 62 }
63 } 63 }
64 64
65 RampUpTester::~RampUpTester() { 65 RampUpTester::~RampUpTester() {
66 event_.Set(); 66 event_.Set();
67 } 67 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 std::vector<AudioReceiveStream::Config>* receive_configs) { 181 std::vector<AudioReceiveStream::Config>* receive_configs) {
182 if (num_audio_streams_ == 0) 182 if (num_audio_streams_ == 0)
183 return; 183 return;
184 184
185 EXPECT_NE(RtpExtension::kTimestampOffsetUri, extension_type_) 185 EXPECT_NE(RtpExtension::kTimestampOffsetUri, extension_type_)
186 << "Audio BWE not supported with toffset."; 186 << "Audio BWE not supported with toffset.";
187 187
188 send_config->rtp.ssrc = audio_ssrcs_[0]; 188 send_config->rtp.ssrc = audio_ssrcs_[0];
189 send_config->rtp.extensions.clear(); 189 send_config->rtp.extensions.clear();
190 190
191 send_config->min_bitrate_kbps = 6;
192 send_config->max_bitrate_kbps = 60;
193
191 bool transport_cc = false; 194 bool transport_cc = false;
192 if (extension_type_ == RtpExtension::kAbsSendTimeUri) { 195 if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
193 transport_cc = false; 196 transport_cc = false;
194 send_config->rtp.extensions.push_back( 197 send_config->rtp.extensions.push_back(
195 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId)); 198 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
196 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) { 199 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
197 transport_cc = true; 200 transport_cc = true;
198 send_config->rtp.extensions.push_back(RtpExtension( 201 send_config->rtp.extensions.push_back(RtpExtension(
199 extension_type_.c_str(), kTransportSequenceNumberExtensionId)); 202 extension_type_.c_str(), kTransportSequenceNumberExtensionId));
200 } 203 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 *padding_sent += stream.rtp_stats.transmitted.padding_bytes + 263 *padding_sent += stream.rtp_stats.transmitted.padding_bytes +
261 stream.rtp_stats.retransmitted.padding_bytes + 264 stream.rtp_stats.retransmitted.padding_bytes +
262 stream.rtp_stats.fec.padding_bytes; 265 stream.rtp_stats.fec.padding_bytes;
263 *media_sent += stream.rtp_stats.MediaPayloadBytes(); 266 *media_sent += stream.rtp_stats.MediaPayloadBytes();
264 } 267 }
265 268
266 void RampUpTester::TriggerTestDone() { 269 void RampUpTester::TriggerTestDone() {
267 RTC_DCHECK_GE(test_start_ms_, 0); 270 RTC_DCHECK_GE(test_start_ms_, 0);
268 271
269 // TODO(holmer): Add audio send stats here too when those APIs are available. 272 // TODO(holmer): Add audio send stats here too when those APIs are available.
273 if (!send_stream_)
274 return;
275
270 VideoSendStream::Stats send_stats = send_stream_->GetStats(); 276 VideoSendStream::Stats send_stats = send_stream_->GetStats();
271 277
272 size_t total_packets_sent = 0; 278 size_t total_packets_sent = 0;
273 size_t total_sent = 0; 279 size_t total_sent = 0;
274 size_t padding_sent = 0; 280 size_t padding_sent = 0;
275 size_t media_sent = 0; 281 size_t media_sent = 0;
276 for (uint32_t ssrc : video_ssrcs_) { 282 for (uint32_t ssrc : video_ssrcs_) {
277 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent, 283 AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent,
278 &total_sent, &padding_sent, &media_sent); 284 &total_sent, &padding_sent, &media_sent);
279 } 285 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 RampUpDownUpTester::~RampUpDownUpTester() {} 340 RampUpDownUpTester::~RampUpDownUpTester() {}
335 341
336 bool RampUpDownUpTester::PollStats() { 342 bool RampUpDownUpTester::PollStats() {
337 if (send_stream_) { 343 if (send_stream_) {
338 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); 344 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
339 int transmit_bitrate_bps = 0; 345 int transmit_bitrate_bps = 0;
340 for (auto it : stats.substreams) { 346 for (auto it : stats.substreams) {
341 transmit_bitrate_bps += it.second.total_bitrate_bps; 347 transmit_bitrate_bps += it.second.total_bitrate_bps;
342 } 348 }
343 EvolveTestState(transmit_bitrate_bps, stats.suspended); 349 EvolveTestState(transmit_bitrate_bps, stats.suspended);
350 } else if (num_audio_streams_ > 0 && sender_call_ != nullptr) {
351 // An audio send stream doesn't have bitrate stats, so the call send BW is
352 // currently used instead.
353 int transmit_bitrate_bps = sender_call_->GetStats().send_bandwidth_bps;
354 EvolveTestState(transmit_bitrate_bps, false);
344 } 355 }
345 356
346 return !event_.Wait(kPollIntervalMs); 357 return !event_.Wait(kPollIntervalMs);
347 } 358 }
348 359
349 Call::Config RampUpDownUpTester::GetReceiverCallConfig() { 360 Call::Config RampUpDownUpTester::GetReceiverCallConfig() {
350 Call::Config config; 361 Call::Config config;
351 config.bitrate_config.min_bitrate_bps = 10000; 362 config.bitrate_config.min_bitrate_bps = 10000;
352 return config; 363 return config;
353 } 364 }
(...skipping 19 matching lines...) Expand all
373 str += (rtx_ ? "" : "no"); 384 str += (rtx_ ? "" : "no");
374 str += "rtx"; 385 str += "rtx";
375 return str; 386 return str;
376 } 387 }
377 388
378 void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) { 389 void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
379 int64_t now = clock_->TimeInMilliseconds(); 390 int64_t now = clock_->TimeInMilliseconds();
380 switch (test_state_) { 391 switch (test_state_) {
381 case kFirstRampup: { 392 case kFirstRampup: {
382 EXPECT_FALSE(suspended); 393 EXPECT_FALSE(suspended);
383 if (bitrate_bps > kExpectedHighBitrateBps) { 394 if (bitrate_bps >= kExpectedHighBitrateBps) {
384 // The first ramp-up has reached the target bitrate. Change the 395 // The first ramp-up has reached the target bitrate. Change the
385 // channel limit, and move to the next test state. 396 // channel limit, and move to the next test state.
386 forward_transport_config_.link_capacity_kbps = 397 forward_transport_config_.link_capacity_kbps =
387 kLowBandwidthLimitBps / 1000; 398 kLowBandwidthLimitBps / 1000;
388 send_transport_->SetConfig(forward_transport_config_); 399 send_transport_->SetConfig(forward_transport_config_);
389 test_state_ = kLowRate; 400 test_state_ = kLowRate;
390 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), 401 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
391 "first_rampup", now - state_start_ms_, "ms", 402 "first_rampup", now - state_start_ms_, "ms",
392 false); 403 false);
393 state_start_ms_ = now; 404 state_start_ms_ = now;
394 interval_start_ms_ = now; 405 interval_start_ms_ = now;
395 sent_bytes_ = 0; 406 sent_bytes_ = 0;
396 } 407 }
397 break; 408 break;
398 } 409 }
399 case kLowRate: { 410 case kLowRate: {
400 if (bitrate_bps < kExpectedLowBitrateBps && suspended) { 411 // Audio streams are never suspended.
412 bool check_suspend_state = num_video_streams_ > 0;
413 if (bitrate_bps < kExpectedLowBitrateBps &&
414 suspended == check_suspend_state) {
401 // The ramp-down was successful. Change the channel limit back to a 415 // The ramp-down was successful. Change the channel limit back to a
402 // high value, and move to the next test state. 416 // high value, and move to the next test state.
403 forward_transport_config_.link_capacity_kbps = 417 forward_transport_config_.link_capacity_kbps =
404 kHighBandwidthLimitBps / 1000; 418 kHighBandwidthLimitBps / 1000;
405 send_transport_->SetConfig(forward_transport_config_); 419 send_transport_->SetConfig(forward_transport_config_);
406 test_state_ = kSecondRampup; 420 test_state_ = kSecondRampup;
407 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), 421 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
408 "rampdown", now - state_start_ms_, "ms", 422 "rampdown", now - state_start_ms_, "ms",
409 false); 423 false);
410 state_start_ms_ = now; 424 state_start_ms_ = now;
411 interval_start_ms_ = now; 425 interval_start_ms_ = now;
412 sent_bytes_ = 0; 426 sent_bytes_ = 0;
413 } 427 }
414 break; 428 break;
415 } 429 }
416 case kSecondRampup: { 430 case kSecondRampup: {
417 if (bitrate_bps > kExpectedHighBitrateBps && !suspended) { 431 if (bitrate_bps >= kExpectedHighBitrateBps && !suspended) {
418 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), 432 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
419 "second_rampup", now - state_start_ms_, "ms", 433 "second_rampup", now - state_start_ms_, "ms",
420 false); 434 false);
421 ReportResult("ramp-up-down-up-average-network-latency", 435 ReportResult("ramp-up-down-up-average-network-latency",
422 send_transport_->GetAverageDelayMs(), "milliseconds"); 436 send_transport_->GetAverageDelayMs(), "milliseconds");
423 observation_complete_.Set(); 437 observation_complete_.Set();
424 } 438 }
425 break; 439 break;
426 } 440 }
427 } 441 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 527
514 // TODO(holmer): Enable when audio bitrates are included in the bitrate 528 // TODO(holmer): Enable when audio bitrates are included in the bitrate
515 // allocation. 529 // allocation.
516 TEST_F(RampUpTest, DISABLED_SendSideAudioVideoUpDownUpRtx) { 530 TEST_F(RampUpTest, DISABLED_SendSideAudioVideoUpDownUpRtx) {
517 RampUpDownUpTester test(3, 1, kStartBitrateBps, 531 RampUpDownUpTester test(3, 1, kStartBitrateBps,
518 RtpExtension::kTransportSequenceNumberUri, true, 532 RtpExtension::kTransportSequenceNumberUri, true,
519 false); 533 false);
520 RunBaseTest(&test); 534 RunBaseTest(&test);
521 } 535 }
522 536
537 TEST_F(RampUpTest, SendSideAudioOnlyUpDownUpRtx) {
538 RampUpDownUpTester test(0, 1, kStartBitrateBps,
539 RtpExtension::kTransportSequenceNumberUri, true,
540 false);
541 RunBaseTest(&test);
542 }
543
523 TEST_F(RampUpTest, AbsSendTimeSingleStream) { 544 TEST_F(RampUpTest, AbsSendTimeSingleStream) {
524 RampUpTester test(1, 0, 0, RtpExtension::kAbsSendTimeUri, false, false); 545 RampUpTester test(1, 0, 0, RtpExtension::kAbsSendTimeUri, false, false);
525 RunBaseTest(&test); 546 RunBaseTest(&test);
526 } 547 }
527 548
528 TEST_F(RampUpTest, AbsSendTimeSimulcast) { 549 TEST_F(RampUpTest, AbsSendTimeSimulcast) {
529 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTimeUri, false, false); 550 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTimeUri, false, false);
530 RunBaseTest(&test); 551 RunBaseTest(&test);
531 } 552 }
532 553
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 true); 596 true);
576 RunBaseTest(&test); 597 RunBaseTest(&test);
577 } 598 }
578 599
579 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) { 600 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) {
580 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps, 601 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps,
581 RtpExtension::kTransportSequenceNumberUri, false, false); 602 RtpExtension::kTransportSequenceNumberUri, false, false);
582 RunBaseTest(&test); 603 RunBaseTest(&test);
583 } 604 }
584 } // namespace webrtc 605 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/rampup_tests.h ('k') | webrtc/media/engine/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698