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

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

Issue 1705763002: Remove PacketRouter sender distinction. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: revert sending_media_ = false Created 4 years, 10 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
« no previous file with comments | « webrtc/modules/pacing/packet_router.cc ('k') | webrtc/video/vie_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e5e05896c2f22580ee86082f7cad7545a5b1265d..4649358f4cf3ff1c0ae06f87a812dceb3d7de5fe 100644
--- a/webrtc/modules/pacing/packet_router_unittest.cc
+++ b/webrtc/modules/pacing/packet_router_unittest.cc
@@ -36,8 +36,8 @@ class PacketRouterTest : public ::testing::Test {
TEST_F(PacketRouterTest, TimeToSendPacket) {
MockRtpRtcp rtp_1;
MockRtpRtcp rtp_2;
- packet_router_->AddRtpModule(&rtp_1, true);
- packet_router_->AddRtpModule(&rtp_2, true);
+ packet_router_->AddRtpModule(&rtp_1);
+ packet_router_->AddRtpModule(&rtp_2);
const uint16_t kSsrc1 = 1234;
uint16_t sequence_number = 17;
@@ -89,7 +89,7 @@ TEST_F(PacketRouterTest, TimeToSendPacket) {
EXPECT_TRUE(packet_router_->TimeToSendPacket(kSsrc1 + kSsrc2, sequence_number,
timestamp, retransmission));
- packet_router_->RemoveRtpModule(&rtp_1, true);
+ packet_router_->RemoveRtpModule(&rtp_1);
// rtp_1 has been removed, try sending a packet on that ssrc and make sure
// it is dropped as expected by not expecting any calls to rtp_1.
@@ -99,7 +99,7 @@ TEST_F(PacketRouterTest, TimeToSendPacket) {
EXPECT_TRUE(packet_router_->TimeToSendPacket(kSsrc1, sequence_number,
timestamp, retransmission));
- packet_router_->RemoveRtpModule(&rtp_2, true);
+ packet_router_->RemoveRtpModule(&rtp_2);
}
TEST_F(PacketRouterTest, TimeToSendPadding) {
@@ -110,8 +110,8 @@ TEST_F(PacketRouterTest, TimeToSendPadding) {
EXPECT_CALL(rtp_1, SSRC()).WillRepeatedly(Return(kSsrc1));
MockRtpRtcp rtp_2;
EXPECT_CALL(rtp_2, SSRC()).WillRepeatedly(Return(kSsrc2));
- packet_router_->AddRtpModule(&rtp_1, true);
- packet_router_->AddRtpModule(&rtp_2, true);
+ packet_router_->AddRtpModule(&rtp_1);
+ packet_router_->AddRtpModule(&rtp_2);
// Default configuration, sending padding on all modules sending media,
// ordered by SSRC.
@@ -147,7 +147,7 @@ TEST_F(PacketRouterTest, TimeToSendPadding) {
EXPECT_CALL(rtp_2, TimeToSendPadding(_)).Times(0);
EXPECT_EQ(0u, packet_router_->TimeToSendPadding(requested_padding_bytes));
- packet_router_->RemoveRtpModule(&rtp_1, true);
+ 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.
@@ -155,7 +155,24 @@ TEST_F(PacketRouterTest, TimeToSendPadding) {
EXPECT_CALL(rtp_2, TimeToSendPadding(requested_padding_bytes)).Times(1);
EXPECT_EQ(0u, packet_router_->TimeToSendPadding(requested_padding_bytes));
- packet_router_->RemoveRtpModule(&rtp_2, true);
+ packet_router_->RemoveRtpModule(&rtp_2);
+}
+
+TEST_F(PacketRouterTest, SenderOnlyFunctionsRespectSendingMedia) {
+ MockRtpRtcp rtp;
+ packet_router_->AddRtpModule(&rtp);
+ static const uint16_t kSsrc = 1234;
+ EXPECT_CALL(rtp, SSRC()).WillRepeatedly(Return(kSsrc));
+ 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));
+ // Verify that TimeToSendPadding does not end up in a receiver.
+ EXPECT_CALL(rtp, TimeToSendPadding(_)).Times(0);
+ EXPECT_EQ(0u, packet_router_->TimeToSendPadding(200));
+
+ packet_router_->RemoveRtpModule(&rtp);
}
TEST_F(PacketRouterTest, AllocateSequenceNumbers) {
@@ -174,15 +191,15 @@ TEST_F(PacketRouterTest, AllocateSequenceNumbers) {
TEST_F(PacketRouterTest, SendFeedback) {
MockRtpRtcp rtp_1;
MockRtpRtcp rtp_2;
- packet_router_->AddRtpModule(&rtp_1, false);
- packet_router_->AddRtpModule(&rtp_2, true);
+ packet_router_->AddRtpModule(&rtp_1);
+ packet_router_->AddRtpModule(&rtp_2);
rtcp::TransportFeedback feedback;
EXPECT_CALL(rtp_1, SendFeedbackPacket(_)).Times(1);
packet_router_->SendFeedback(&feedback);
- packet_router_->RemoveRtpModule(&rtp_1, false);
+ packet_router_->RemoveRtpModule(&rtp_1);
EXPECT_CALL(rtp_2, SendFeedbackPacket(_)).Times(1);
packet_router_->SendFeedback(&feedback);
- packet_router_->RemoveRtpModule(&rtp_2, true);
+ packet_router_->RemoveRtpModule(&rtp_2);
}
} // namespace webrtc
« no previous file with comments | « webrtc/modules/pacing/packet_router.cc ('k') | webrtc/video/vie_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698