Use int64_t more consistently for times, in particular for RTT values.
Existing code was inconsistent about whether to use uint16_t, int, unsigned int,
or uint32_t, and sometimes silently truncated one to another, or truncated
int64_t. Because most core time-handling functions use int64_t, being
consistent about using int64_t unless otherwise necessary minimizes the number
of explicit or implicit casts.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, holmer@google.com, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/31349004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8045 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc b/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc
index 6344ee8..f89da9f 100644
--- a/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc
+++ b/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc
@@ -45,14 +45,14 @@
virtual void OnNetworkChanged(uint32_t bitrate,
uint8_t fraction_loss,
- uint32_t rtt) {
+ int64_t rtt) {
last_bitrate_ = bitrate;
last_fraction_loss_ = fraction_loss;
last_rtt_ = rtt;
}
uint32_t last_bitrate_;
uint8_t last_fraction_loss_;
- uint32_t last_rtt_;
+ int64_t last_rtt_;
};
class BitrateControllerTest : public ::testing::Test {
@@ -112,7 +112,7 @@
bandwidth_observer_->OnReceivedEstimatedBitrate(200000);
EXPECT_EQ(200000u, bitrate_observer.last_bitrate_);
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(0u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(0, bitrate_observer.last_rtt_);
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
report_blocks.clear();
time_ms += 2000;
@@ -125,7 +125,7 @@
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
EXPECT_EQ(217000u, bitrate_observer.last_bitrate_);
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer.last_rtt_);
time_ms += 1000;
report_blocks.clear();
@@ -133,7 +133,7 @@
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
EXPECT_EQ(235360u, bitrate_observer.last_bitrate_);
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer.last_rtt_);
time_ms += 1000;
report_blocks.clear();
@@ -170,7 +170,7 @@
bandwidth_observer_->OnReceivedEstimatedBitrate(250000);
EXPECT_EQ(250000u, bitrate_observer.last_bitrate_);
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer.last_rtt_);
bandwidth_observer_->OnReceivedEstimatedBitrate(1000);
EXPECT_EQ(100000u, bitrate_observer.last_bitrate_); // Min cap.
@@ -198,7 +198,7 @@
report_blocks, 100, 1);
EXPECT_EQ(217000u, bitrate_observer.last_bitrate_);
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(100u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(100, bitrate_observer.last_rtt_);
time_ms += 500;
// Test bitrate increase 8% per second.
@@ -210,7 +210,7 @@
report_blocks, 100, time_ms);
EXPECT_EQ(235360u, bitrate_observer.last_bitrate_);
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(100u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(100, bitrate_observer.last_rtt_);
time_ms += 500;
// Extra report should not change estimate.
@@ -268,7 +268,7 @@
second_bandwidth_observer->OnReceivedEstimatedBitrate(250000);
EXPECT_EQ(250000u, bitrate_observer.last_bitrate_);
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer.last_rtt_);
// Min cap.
bandwidth_observer_->OnReceivedEstimatedBitrate(1000);
@@ -307,7 +307,7 @@
time_ms);
EXPECT_GT(bitrate_observer.last_bitrate_, last_bitrate);
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer.last_rtt_);
last_bitrate = bitrate_observer.last_bitrate_;
time_ms += 1000;
sequence_number[0] += 20;
@@ -323,7 +323,7 @@
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
EXPECT_LT(bitrate_observer.last_bitrate_, last_bitrate);
EXPECT_EQ(WeightedLoss(20, 50, 1, 0), bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer.last_rtt_);
last_bitrate = bitrate_observer.last_bitrate_;
sequence_number[0] += 20;
sequence_number[1] += 20;
@@ -336,7 +336,7 @@
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
EXPECT_LT(bitrate_observer.last_bitrate_, last_bitrate);
EXPECT_EQ(WeightedLoss(20, 0, 20, 75), bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer.last_rtt_);
last_bitrate = bitrate_observer.last_bitrate_;
sequence_number[0] += 20;
sequence_number[1] += 1;
@@ -349,7 +349,7 @@
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
EXPECT_EQ(bitrate_observer.last_bitrate_, last_bitrate);
EXPECT_EQ(WeightedLoss(20, 1, 1, 255), bitrate_observer.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer.last_rtt_);
last_bitrate = bitrate_observer.last_bitrate_;
sequence_number[0] += 20;
sequence_number[1] += 1;
@@ -369,7 +369,7 @@
bandwidth_observer_->OnReceivedEstimatedBitrate(200000);
EXPECT_EQ(100000u, bitrate_observer_1.last_bitrate_);
EXPECT_EQ(0, bitrate_observer_1.last_fraction_loss_);
- EXPECT_EQ(0u, bitrate_observer_1.last_rtt_);
+ EXPECT_EQ(0, bitrate_observer_1.last_rtt_);
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
report_blocks.clear();
time_ms += 2000;
@@ -383,12 +383,12 @@
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
EXPECT_EQ(112500u, bitrate_observer_1.last_bitrate_);
EXPECT_EQ(0, bitrate_observer_1.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer_1.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer_1.last_rtt_);
time_ms += 1000;
EXPECT_EQ(212500u, bitrate_observer_2.last_bitrate_);
EXPECT_EQ(0, bitrate_observer_2.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer_2.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer_2.last_rtt_);
report_blocks.clear();
report_blocks.push_back(CreateReportBlock(1, 2, 0, 41));
@@ -460,10 +460,10 @@
bandwidth_observer_->OnReceivedEstimatedBitrate(350000);
EXPECT_EQ(125000u, bitrate_observer_1.last_bitrate_);
EXPECT_EQ(0, bitrate_observer_1.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer_1.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer_1.last_rtt_);
EXPECT_EQ(225000u, bitrate_observer_2.last_bitrate_);
EXPECT_EQ(0, bitrate_observer_2.last_fraction_loss_);
- EXPECT_EQ(50u, bitrate_observer_2.last_rtt_);
+ EXPECT_EQ(50, bitrate_observer_2.last_rtt_);
bandwidth_observer_->OnReceivedEstimatedBitrate(1000);
EXPECT_EQ(100000u, bitrate_observer_1.last_bitrate_); // Min cap.