Index: webrtc/call/rampup_tests.cc |
diff --git a/webrtc/call/rampup_tests.cc b/webrtc/call/rampup_tests.cc |
index 150fc770ff0b75fb215375a11982ff64ad33dd5f..320d22de64daaea18ca0f9b77409f463826eace7 100644 |
--- a/webrtc/call/rampup_tests.cc |
+++ b/webrtc/call/rampup_tests.cc |
@@ -41,6 +41,7 @@ RampUpTester::RampUpTester(size_t num_video_streams, |
num_audio_streams_(num_audio_streams), |
rtx_(rtx), |
red_(red), |
+ sender_call_(nullptr), |
send_stream_(nullptr), |
start_bitrate_bps_(start_bitrate_bps), |
start_bitrate_verified_(false), |
@@ -53,8 +54,7 @@ RampUpTester::RampUpTester(size_t num_video_streams, |
audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)), |
poller_thread_(&BitrateStatsPollingThread, |
this, |
- "BitrateStatsPollingThread"), |
- sender_call_(nullptr) { |
+ "BitrateStatsPollingThread") { |
EXPECT_LE(num_audio_streams_, 1u); |
if (rtx_) { |
for (size_t i = 0; i < video_ssrcs_.size(); ++i) |
@@ -188,6 +188,9 @@ void RampUpTester::ModifyAudioConfigs( |
send_config->rtp.ssrc = audio_ssrcs_[0]; |
send_config->rtp.extensions.clear(); |
+ send_config->min_bitrate_kbps = 6; |
+ send_config->max_bitrate_kbps = 60; |
+ |
bool transport_cc = false; |
if (extension_type_ == RtpExtension::kAbsSendTimeUri) { |
transport_cc = false; |
@@ -267,6 +270,9 @@ void RampUpTester::TriggerTestDone() { |
RTC_DCHECK_GE(test_start_ms_, 0); |
// TODO(holmer): Add audio send stats here too when those APIs are available. |
+ if (!send_stream_) |
+ return; |
+ |
VideoSendStream::Stats send_stats = send_stream_->GetStats(); |
size_t total_packets_sent = 0; |
@@ -341,6 +347,11 @@ bool RampUpDownUpTester::PollStats() { |
transmit_bitrate_bps += it.second.total_bitrate_bps; |
} |
EvolveTestState(transmit_bitrate_bps, stats.suspended); |
+ } else if (num_audio_streams_ > 0 && sender_call_ != nullptr) { |
+ // An audio send stream doesn't have bitrate stats, so the call send BW is |
+ // currently used instead. |
+ int transmit_bitrate_bps = sender_call_->GetStats().send_bandwidth_bps; |
+ EvolveTestState(transmit_bitrate_bps, false); |
} |
return !event_.Wait(kPollIntervalMs); |
@@ -380,7 +391,7 @@ void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) { |
switch (test_state_) { |
case kFirstRampup: { |
EXPECT_FALSE(suspended); |
- if (bitrate_bps > kExpectedHighBitrateBps) { |
+ if (bitrate_bps >= kExpectedHighBitrateBps) { |
// The first ramp-up has reached the target bitrate. Change the |
// channel limit, and move to the next test state. |
forward_transport_config_.link_capacity_kbps = |
@@ -397,7 +408,10 @@ void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) { |
break; |
} |
case kLowRate: { |
- if (bitrate_bps < kExpectedLowBitrateBps && suspended) { |
+ // Audio streams are never suspended. |
+ bool check_suspend_state = num_video_streams_ > 0; |
+ if (bitrate_bps < kExpectedLowBitrateBps && |
+ suspended == check_suspend_state) { |
// The ramp-down was successful. Change the channel limit back to a |
// high value, and move to the next test state. |
forward_transport_config_.link_capacity_kbps = |
@@ -414,7 +428,7 @@ void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) { |
break; |
} |
case kSecondRampup: { |
- if (bitrate_bps > kExpectedHighBitrateBps && !suspended) { |
+ if (bitrate_bps >= kExpectedHighBitrateBps && !suspended) { |
webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), |
"second_rampup", now - state_start_ms_, "ms", |
false); |
@@ -520,6 +534,13 @@ TEST_F(RampUpTest, DISABLED_SendSideAudioVideoUpDownUpRtx) { |
RunBaseTest(&test); |
} |
+TEST_F(RampUpTest, SendSideAudioOnlyUpDownUpRtx) { |
+ RampUpDownUpTester test(0, 1, kStartBitrateBps, |
+ RtpExtension::kTransportSequenceNumberUri, true, |
+ false); |
+ RunBaseTest(&test); |
+} |
+ |
TEST_F(RampUpTest, AbsSendTimeSingleStream) { |
RampUpTester test(1, 0, 0, RtpExtension::kAbsSendTimeUri, false, false); |
RunBaseTest(&test); |