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

Unified Diff: webrtc/modules/pacing/packet_router_unittest.cc

Issue 2005313003: Propagate probing cluster id to SendTimeHistory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Test probe_cluster_id in PacketRouterTest. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/pacing/packet_router_unittest.cc
diff --git a/webrtc/modules/pacing/packet_router_unittest.cc b/webrtc/modules/pacing/packet_router_unittest.cc
index 006b9f2bf48c2ed803e41a5e0e6ee615975dbd5b..5c1654e6d03a0207d04d35a8825380bcbde04a82 100644
--- a/webrtc/modules/pacing/packet_router_unittest.cc
+++ b/webrtc/modules/pacing/packet_router_unittest.cc
@@ -48,12 +48,12 @@ TEST_F(PacketRouterTest, TimeToSendPacket) {
EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true));
EXPECT_CALL(rtp_1, SSRC()).Times(1).WillOnce(Return(kSsrc1));
EXPECT_CALL(rtp_1, TimeToSendPacket(kSsrc1, sequence_number, timestamp,
- retransmission))
+ retransmission, 1))
.Times(1)
.WillOnce(Return(true));
- EXPECT_CALL(rtp_2, TimeToSendPacket(_, _, _, _)).Times(0);
+ EXPECT_CALL(rtp_2, TimeToSendPacket(_, _, _, _, _)).Times(0);
EXPECT_TRUE(packet_router_->TimeToSendPacket(kSsrc1, sequence_number,
- timestamp, retransmission, -1));
+ timestamp, retransmission, 1));
// Send on the second module by letting rtp_2 be sending, but not rtp_1.
++sequence_number;
@@ -63,31 +63,31 @@ TEST_F(PacketRouterTest, TimeToSendPacket) {
EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(false));
EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true));
EXPECT_CALL(rtp_2, SSRC()).Times(1).WillOnce(Return(kSsrc2));
- EXPECT_CALL(rtp_1, TimeToSendPacket(_, _, _, _)).Times(0);
+ EXPECT_CALL(rtp_1, TimeToSendPacket(_, _, _, _, _)).Times(0);
EXPECT_CALL(rtp_2, TimeToSendPacket(kSsrc2, sequence_number, timestamp,
- retransmission))
+ retransmission, 2))
.Times(1)
.WillOnce(Return(true));
EXPECT_TRUE(packet_router_->TimeToSendPacket(kSsrc2, sequence_number,
- timestamp, retransmission, -1));
+ timestamp, retransmission, 2));
// No module is sending, hence no packet should be sent.
EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(false));
- EXPECT_CALL(rtp_1, TimeToSendPacket(_, _, _, _)).Times(0);
+ EXPECT_CALL(rtp_1, TimeToSendPacket(_, _, _, _, _)).Times(0);
EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(false));
- EXPECT_CALL(rtp_2, TimeToSendPacket(_, _, _, _)).Times(0);
+ EXPECT_CALL(rtp_2, TimeToSendPacket(_, _, _, _, _)).Times(0);
EXPECT_TRUE(packet_router_->TimeToSendPacket(kSsrc1, sequence_number,
- timestamp, retransmission, -1));
+ timestamp, retransmission, 1));
// Add a packet with incorrect ssrc and test it's dropped in the router.
EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true));
EXPECT_CALL(rtp_1, SSRC()).Times(1).WillOnce(Return(kSsrc1));
EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true));
EXPECT_CALL(rtp_2, SSRC()).Times(1).WillOnce(Return(kSsrc2));
- EXPECT_CALL(rtp_1, TimeToSendPacket(_, _, _, _)).Times(0);
- EXPECT_CALL(rtp_2, TimeToSendPacket(_, _, _, _)).Times(0);
+ EXPECT_CALL(rtp_1, TimeToSendPacket(_, _, _, _, _)).Times(0);
+ EXPECT_CALL(rtp_2, TimeToSendPacket(_, _, _, _, _)).Times(0);
EXPECT_TRUE(packet_router_->TimeToSendPacket(kSsrc1 + kSsrc2, sequence_number,
- timestamp, retransmission, -1));
+ timestamp, retransmission, 1));
packet_router_->RemoveRtpModule(&rtp_1);
@@ -95,9 +95,10 @@ TEST_F(PacketRouterTest, TimeToSendPacket) {
// it is dropped as expected by not expecting any calls to rtp_1.
EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true));
EXPECT_CALL(rtp_2, SSRC()).Times(1).WillOnce(Return(kSsrc2));
- EXPECT_CALL(rtp_2, TimeToSendPacket(_, _, _, _)).Times(0);
+ EXPECT_CALL(rtp_2, TimeToSendPacket(_, _, _, _, _)).Times(0);
EXPECT_TRUE(packet_router_->TimeToSendPacket(kSsrc1, sequence_number,
- timestamp, retransmission, -1));
+ timestamp, retransmission,
+ PacketInfo::kNotAProbe));
packet_router_->RemoveRtpModule(&rtp_2);
}
@@ -118,42 +119,45 @@ TEST_F(PacketRouterTest, TimeToSendPadding) {
const size_t requested_padding_bytes = 1000;
const size_t sent_padding_bytes = 890;
EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(true));
- EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes))
+ EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes, 111))
.Times(1)
.WillOnce(Return(sent_padding_bytes));
EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true));
- EXPECT_CALL(rtp_2,
- TimeToSendPadding(requested_padding_bytes - sent_padding_bytes))
+ EXPECT_CALL(rtp_2, TimeToSendPadding(
+ requested_padding_bytes - sent_padding_bytes, 111))
.Times(1)
.WillOnce(Return(requested_padding_bytes - sent_padding_bytes));
EXPECT_EQ(requested_padding_bytes,
- packet_router_->TimeToSendPadding(requested_padding_bytes));
+ packet_router_->TimeToSendPadding(requested_padding_bytes, 111));
// Let only the second module be sending and verify the padding request is
// routed there.
EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(false));
- EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes)).Times(0);
+ EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes, _)).Times(0);
EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true));
- EXPECT_CALL(rtp_2, TimeToSendPadding(_))
+ EXPECT_CALL(rtp_2, TimeToSendPadding(_, _))
.Times(1)
.WillOnce(Return(sent_padding_bytes));
EXPECT_EQ(sent_padding_bytes,
- packet_router_->TimeToSendPadding(requested_padding_bytes));
+ packet_router_->TimeToSendPadding(requested_padding_bytes,
+ PacketInfo::kNotAProbe));
// No sending module at all.
EXPECT_CALL(rtp_1, SendingMedia()).Times(1).WillOnce(Return(false));
- EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes)).Times(0);
+ EXPECT_CALL(rtp_1, TimeToSendPadding(requested_padding_bytes, _)).Times(0);
EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(false));
- EXPECT_CALL(rtp_2, TimeToSendPadding(_)).Times(0);
- EXPECT_EQ(0u, packet_router_->TimeToSendPadding(requested_padding_bytes));
+ EXPECT_CALL(rtp_2, TimeToSendPadding(_, _)).Times(0);
+ EXPECT_EQ(0u, packet_router_->TimeToSendPadding(requested_padding_bytes,
+ PacketInfo::kNotAProbe));
packet_router_->RemoveRtpModule(&rtp_1);
// rtp_1 has been removed, try sending padding and make sure rtp_1 isn't asked
// to send by not expecting any calls. Instead verify rtp_2 is called.
EXPECT_CALL(rtp_2, SendingMedia()).Times(1).WillOnce(Return(true));
- EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes)).Times(1);
- EXPECT_EQ(0u, packet_router_->TimeToSendPadding(requested_padding_bytes));
+ EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes, _)).Times(1);
+ EXPECT_EQ(0u, packet_router_->TimeToSendPadding(requested_padding_bytes,
+ PacketInfo::kNotAProbe));
packet_router_->RemoveRtpModule(&rtp_2);
}
@@ -166,11 +170,12 @@ TEST_F(PacketRouterTest, SenderOnlyFunctionsRespectSendingMedia) {
EXPECT_CALL(rtp, SendingMedia()).WillRepeatedly(Return(false));
// Verify that TimeToSendPacket does not end up in a receiver.
- EXPECT_CALL(rtp, TimeToSendPacket(_, _, _, _)).Times(0);
- EXPECT_TRUE(packet_router_->TimeToSendPacket(kSsrc, 1, 1, false, -1));
+ EXPECT_CALL(rtp, TimeToSendPacket(_, _, _, _, _)).Times(0);
+ EXPECT_TRUE(packet_router_->TimeToSendPacket(kSsrc, 1, 1, false,
+ PacketInfo::kNotAProbe));
// Verify that TimeToSendPadding does not end up in a receiver.
- EXPECT_CALL(rtp, TimeToSendPadding(_)).Times(0);
- EXPECT_EQ(0u, packet_router_->TimeToSendPadding(200));
+ EXPECT_CALL(rtp, TimeToSendPadding(_, _)).Times(0);
+ EXPECT_EQ(0u, packet_router_->TimeToSendPadding(200, PacketInfo::kNotAProbe));
packet_router_->RemoveRtpModule(&rtp);
}
« no previous file with comments | « webrtc/modules/pacing/packet_router.cc ('k') | webrtc/modules/remote_bitrate_estimator/include/send_time_history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698