Index: webrtc/modules/remote_bitrate_estimator/send_time_history_unittest.cc |
diff --git a/webrtc/modules/remote_bitrate_estimator/send_time_history_unittest.cc b/webrtc/modules/remote_bitrate_estimator/send_time_history_unittest.cc |
index 40a119edd0b517e297238b07d3bfd8791db944cd..96e54203daa19ea29bb0f9f9e536e8b748a7556e 100644 |
--- a/webrtc/modules/remote_bitrate_estimator/send_time_history_unittest.cc |
+++ b/webrtc/modules/remote_bitrate_estimator/send_time_history_unittest.cc |
@@ -48,19 +48,19 @@ TEST_F(SendTimeHistoryTest, AddRemoveOne) { |
const uint16_t kSeqNo = 10; |
// TODO(philipel): Fix PacedPacketInfo constructor? |
const PacedPacketInfo kPacingInfo(0, 5, 1200); |
- const PacketInfo kSentPacket(0, 1, kSeqNo, 1, kPacingInfo); |
+ const PacketFeedback kSentPacket(0, 1, kSeqNo, 1, kPacingInfo); |
AddPacketWithSendTime(kSeqNo, 1, 1, kPacingInfo); |
- PacketInfo received_packet(0, 0, kSeqNo, 0, kPacingInfo); |
- EXPECT_TRUE(history_.GetInfo(&received_packet, false)); |
+ PacketFeedback received_packet(0, 0, kSeqNo, 0, kPacingInfo); |
+ EXPECT_TRUE(history_.GetFeedback(&received_packet, false)); |
EXPECT_EQ(kSentPacket, received_packet); |
- PacketInfo received_packet2(0, 0, kSeqNo, 0, kPacingInfo); |
- EXPECT_TRUE(history_.GetInfo(&received_packet2, true)); |
+ PacketFeedback received_packet2(0, 0, kSeqNo, 0, kPacingInfo); |
+ EXPECT_TRUE(history_.GetFeedback(&received_packet2, true)); |
EXPECT_EQ(kSentPacket, received_packet2); |
- PacketInfo received_packet3(0, 0, kSeqNo, 0, kPacingInfo); |
- EXPECT_FALSE(history_.GetInfo(&received_packet3, true)); |
+ PacketFeedback received_packet3(0, 0, kSeqNo, 0, kPacingInfo); |
+ EXPECT_FALSE(history_.GetFeedback(&received_packet3, true)); |
} |
TEST_F(SendTimeHistoryTest, PopulatesExpectedFields) { |
@@ -72,29 +72,29 @@ TEST_F(SendTimeHistoryTest, PopulatesExpectedFields) { |
AddPacketWithSendTime(kSeqNo, kPayloadSize, kSendTime, kPacingInfo); |
- PacketInfo info(kReceiveTime, kSeqNo); |
- EXPECT_TRUE(history_.GetInfo(&info, true)); |
- EXPECT_EQ(kReceiveTime, info.arrival_time_ms); |
- EXPECT_EQ(kSendTime, info.send_time_ms); |
- EXPECT_EQ(kSeqNo, info.sequence_number); |
- EXPECT_EQ(kPayloadSize, info.payload_size); |
- EXPECT_EQ(kPacingInfo, info.pacing_info); |
+ PacketFeedback packet_feedback(kReceiveTime, kSeqNo); |
+ EXPECT_TRUE(history_.GetFeedback(&packet_feedback, true)); |
+ EXPECT_EQ(kReceiveTime, packet_feedback.arrival_time_ms); |
+ EXPECT_EQ(kSendTime, packet_feedback.send_time_ms); |
+ EXPECT_EQ(kSeqNo, packet_feedback.sequence_number); |
+ EXPECT_EQ(kPayloadSize, packet_feedback.payload_size); |
+ EXPECT_EQ(kPacingInfo, packet_feedback.pacing_info); |
} |
TEST_F(SendTimeHistoryTest, AddThenRemoveOutOfOrder) { |
- std::vector<PacketInfo> sent_packets; |
- std::vector<PacketInfo> received_packets; |
+ std::vector<PacketFeedback> sent_packets; |
+ std::vector<PacketFeedback> received_packets; |
const size_t num_items = 100; |
const size_t kPacketSize = 400; |
const size_t kTransmissionTime = 1234; |
const PacedPacketInfo kPacingInfo(1, 2, 200); |
for (size_t i = 0; i < num_items; ++i) { |
- sent_packets.push_back(PacketInfo(0, static_cast<int64_t>(i), |
- static_cast<uint16_t>(i), kPacketSize, |
- kPacingInfo)); |
- received_packets.push_back( |
- PacketInfo(static_cast<int64_t>(i) + kTransmissionTime, 0, |
- static_cast<uint16_t>(i), kPacketSize, PacedPacketInfo())); |
+ sent_packets.push_back(PacketFeedback(0, static_cast<int64_t>(i), |
+ static_cast<uint16_t>(i), kPacketSize, |
+ kPacingInfo)); |
+ received_packets.push_back(PacketFeedback( |
+ static_cast<int64_t>(i) + kTransmissionTime, 0, |
+ static_cast<uint16_t>(i), kPacketSize, PacedPacketInfo())); |
} |
for (size_t i = 0; i < num_items; ++i) { |
history_.AddAndRemoveOld(sent_packets[i].sequence_number, |
@@ -106,15 +106,15 @@ TEST_F(SendTimeHistoryTest, AddThenRemoveOutOfOrder) { |
sent_packets[i].send_time_ms); |
std::random_shuffle(received_packets.begin(), received_packets.end()); |
for (size_t i = 0; i < num_items; ++i) { |
- PacketInfo packet = received_packets[i]; |
- EXPECT_TRUE(history_.GetInfo(&packet, false)); |
- PacketInfo sent_packet = sent_packets[packet.sequence_number]; |
+ PacketFeedback packet = received_packets[i]; |
+ EXPECT_TRUE(history_.GetFeedback(&packet, false)); |
+ PacketFeedback sent_packet = sent_packets[packet.sequence_number]; |
sent_packet.arrival_time_ms = packet.arrival_time_ms; |
EXPECT_EQ(sent_packet, packet); |
- EXPECT_TRUE(history_.GetInfo(&packet, true)); |
+ EXPECT_TRUE(history_.GetFeedback(&packet, true)); |
} |
- for (PacketInfo packet : sent_packets) |
- EXPECT_FALSE(history_.GetInfo(&packet, false)); |
+ for (PacketFeedback packet : sent_packets) |
+ EXPECT_FALSE(history_.GetFeedback(&packet, false)); |
} |
TEST_F(SendTimeHistoryTest, HistorySize) { |
@@ -124,19 +124,20 @@ TEST_F(SendTimeHistoryTest, HistorySize) { |
AddPacketWithSendTime(i, 0, i * 100, PacedPacketInfo()); |
} |
for (int i = 0; i < kItems; ++i) { |
- PacketInfo info(0, 0, static_cast<uint16_t>(i), 0, PacedPacketInfo()); |
- EXPECT_TRUE(history_.GetInfo(&info, false)); |
- EXPECT_EQ(i * 100, info.send_time_ms); |
+ PacketFeedback packet(0, 0, static_cast<uint16_t>(i), 0, PacedPacketInfo()); |
+ EXPECT_TRUE(history_.GetFeedback(&packet, false)); |
+ EXPECT_EQ(i * 100, packet.send_time_ms); |
} |
clock_.AdvanceTimeMilliseconds(101); |
AddPacketWithSendTime(kItems, 0, kItems * 101, PacedPacketInfo()); |
- PacketInfo info(0, 0, 0, 0, PacedPacketInfo()); |
- EXPECT_FALSE(history_.GetInfo(&info, false)); |
+ PacketFeedback packet(0, 0, 0, 0, PacedPacketInfo()); |
+ EXPECT_FALSE(history_.GetFeedback(&packet, false)); |
for (int i = 1; i < (kItems + 1); ++i) { |
- PacketInfo info2(0, 0, static_cast<uint16_t>(i), 0, PacedPacketInfo()); |
- EXPECT_TRUE(history_.GetInfo(&info2, false)); |
+ PacketFeedback packet2(0, 0, static_cast<uint16_t>(i), 0, |
+ PacedPacketInfo()); |
+ EXPECT_TRUE(history_.GetFeedback(&packet2, false)); |
int64_t expected_time_ms = (i == kItems) ? i * 101 : i * 100; |
- EXPECT_EQ(expected_time_ms, info2.send_time_ms); |
+ EXPECT_EQ(expected_time_ms, packet2.send_time_ms); |
} |
} |
@@ -153,32 +154,32 @@ TEST_F(SendTimeHistoryTest, HistorySizeWithWraparound) { |
clock_.AdvanceTimeMilliseconds(kDefaultHistoryLengthMs - 200 + 1); |
AddPacketWithSendTime(0, 0, kDefaultHistoryLengthMs, PacedPacketInfo()); |
- PacketInfo info(0, static_cast<uint16_t>(kMaxSeqNo - 2)); |
- EXPECT_FALSE(history_.GetInfo(&info, false)); |
- PacketInfo info2(0, static_cast<uint16_t>(kMaxSeqNo - 1)); |
- EXPECT_TRUE(history_.GetInfo(&info2, false)); |
- PacketInfo info3(0, static_cast<uint16_t>(kMaxSeqNo)); |
- EXPECT_TRUE(history_.GetInfo(&info3, false)); |
- PacketInfo info4(0, 0); |
- EXPECT_TRUE(history_.GetInfo(&info4, false)); |
+ PacketFeedback packet(0, static_cast<uint16_t>(kMaxSeqNo - 2)); |
+ EXPECT_FALSE(history_.GetFeedback(&packet, false)); |
+ PacketFeedback packet2(0, static_cast<uint16_t>(kMaxSeqNo - 1)); |
+ EXPECT_TRUE(history_.GetFeedback(&packet2, false)); |
+ PacketFeedback packet3(0, static_cast<uint16_t>(kMaxSeqNo)); |
+ EXPECT_TRUE(history_.GetFeedback(&packet3, false)); |
+ PacketFeedback packet4(0, 0); |
+ EXPECT_TRUE(history_.GetFeedback(&packet4, false)); |
// Create a gap (kMaxSeqNo - 1) -> 0. |
- PacketInfo info5(0, kMaxSeqNo); |
- EXPECT_TRUE(history_.GetInfo(&info5, true)); |
+ PacketFeedback packet5(0, kMaxSeqNo); |
+ EXPECT_TRUE(history_.GetFeedback(&packet5, true)); |
clock_.AdvanceTimeMilliseconds(100); |
AddPacketWithSendTime(1, 0, 1100, PacedPacketInfo()); |
- PacketInfo info6(0, static_cast<uint16_t>(kMaxSeqNo - 2)); |
- EXPECT_FALSE(history_.GetInfo(&info6, false)); |
- PacketInfo info7(0, static_cast<uint16_t>(kMaxSeqNo - 1)); |
- EXPECT_FALSE(history_.GetInfo(&info7, false)); |
- PacketInfo info8(0, kMaxSeqNo); |
- EXPECT_FALSE(history_.GetInfo(&info8, false)); |
- PacketInfo info9(0, 0); |
- EXPECT_TRUE(history_.GetInfo(&info9, false)); |
- PacketInfo info10(0, 1); |
- EXPECT_TRUE(history_.GetInfo(&info10, false)); |
+ PacketFeedback packet6(0, static_cast<uint16_t>(kMaxSeqNo - 2)); |
+ EXPECT_FALSE(history_.GetFeedback(&packet6, false)); |
+ PacketFeedback packet7(0, static_cast<uint16_t>(kMaxSeqNo - 1)); |
+ EXPECT_FALSE(history_.GetFeedback(&packet7, false)); |
+ PacketFeedback packet8(0, kMaxSeqNo); |
+ EXPECT_FALSE(history_.GetFeedback(&packet8, false)); |
+ PacketFeedback packet9(0, 0); |
+ EXPECT_TRUE(history_.GetFeedback(&packet9, false)); |
+ PacketFeedback packet10(0, 1); |
+ EXPECT_TRUE(history_.GetFeedback(&packet10, false)); |
} |
TEST_F(SendTimeHistoryTest, InterlievedGetAndRemove) { |
@@ -187,28 +188,29 @@ TEST_F(SendTimeHistoryTest, InterlievedGetAndRemove) { |
const PacedPacketInfo kPacingInfo1(1, 1, 100); |
const PacedPacketInfo kPacingInfo2(2, 2, 200); |
const PacedPacketInfo kPacingInfo3(3, 3, 300); |
- PacketInfo packets[3] = {{0, kTimestamp, kSeqNo, 0, kPacingInfo1}, |
- {0, kTimestamp + 1, kSeqNo + 1, 0, kPacingInfo2}, |
- {0, kTimestamp + 2, kSeqNo + 2, 0, kPacingInfo3}}; |
+ PacketFeedback packets[3] = { |
+ {0, kTimestamp, kSeqNo, 0, kPacingInfo1}, |
+ {0, kTimestamp + 1, kSeqNo + 1, 0, kPacingInfo2}, |
+ {0, kTimestamp + 2, kSeqNo + 2, 0, kPacingInfo3}}; |
AddPacketWithSendTime(packets[0].sequence_number, packets[0].payload_size, |
packets[0].send_time_ms, packets[0].pacing_info); |
AddPacketWithSendTime(packets[1].sequence_number, packets[1].payload_size, |
packets[1].send_time_ms, packets[1].pacing_info); |
- PacketInfo info(0, 0, packets[0].sequence_number, 0, PacedPacketInfo()); |
- EXPECT_TRUE(history_.GetInfo(&info, true)); |
- EXPECT_EQ(packets[0], info); |
+ PacketFeedback packet(0, 0, packets[0].sequence_number, 0, PacedPacketInfo()); |
+ EXPECT_TRUE(history_.GetFeedback(&packet, true)); |
+ EXPECT_EQ(packets[0], packet); |
AddPacketWithSendTime(packets[2].sequence_number, packets[2].payload_size, |
packets[2].send_time_ms, packets[2].pacing_info); |
- PacketInfo info2(0, 0, packets[1].sequence_number, 0, kPacingInfo1); |
- EXPECT_TRUE(history_.GetInfo(&info2, true)); |
- EXPECT_EQ(packets[1], info2); |
+ PacketFeedback packet2(0, 0, packets[1].sequence_number, 0, kPacingInfo1); |
+ EXPECT_TRUE(history_.GetFeedback(&packet2, true)); |
+ EXPECT_EQ(packets[1], packet2); |
- PacketInfo info3(0, 0, packets[2].sequence_number, 0, kPacingInfo2); |
- EXPECT_TRUE(history_.GetInfo(&info3, true)); |
- EXPECT_EQ(packets[2], info3); |
+ PacketFeedback packet3(0, 0, packets[2].sequence_number, 0, kPacingInfo2); |
+ EXPECT_TRUE(history_.GetFeedback(&packet3, true)); |
+ EXPECT_EQ(packets[2], packet3); |
} |
} // namespace test |