Remove getting max payload length from default module.

Moving functionality to get max payload length from default RTP module
to the payload router.

I'll make a follow up CL changing asserts to DCHECK in rtp_rtcp_impl.cc.

BUG=769
TEST=New unittest and existing sender mtu test
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/36119004

Cr-Commit-Position: refs/heads/master@{#8345}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8345 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org
2015-02-12 09:54:18 +00:00
parent 006521d5bd
commit a4ef2ce29d
5 changed files with 69 additions and 35 deletions

View File

@ -127,5 +127,38 @@ TEST_F(PayloadRouterTest, SendSimulcast) {
&payload_2, 1, NULL, &rtp_hdr_2));
}
TEST_F(PayloadRouterTest, MaxPayloadLength) {
// Without any limitations from the modules, verify we get the max payload
// length for IP/UDP/SRTP with a MTU of 150 bytes.
const size_t kDefaultMaxLength = 1500 - 20 - 8 - 12 - 4;
EXPECT_EQ(kDefaultMaxLength, payload_router_->DefaultMaxPayloadLength());
EXPECT_EQ(kDefaultMaxLength, payload_router_->MaxPayloadLength());
MockRtpRtcp rtp_1;
MockRtpRtcp rtp_2;
std::list<RtpRtcp*> modules;
modules.push_back(&rtp_1);
modules.push_back(&rtp_2);
payload_router_->SetSendingRtpModules(modules);
// Modules return a higher length than the default value.
EXPECT_CALL(rtp_1, MaxDataPayloadLength())
.Times(1)
.WillOnce(Return(kDefaultMaxLength + 10));
EXPECT_CALL(rtp_2, MaxDataPayloadLength())
.Times(1)
.WillOnce(Return(kDefaultMaxLength + 10));
EXPECT_EQ(kDefaultMaxLength, payload_router_->MaxPayloadLength());
// The modules return a value lower than default.
const size_t kTestMinPayloadLength = 1001;
EXPECT_CALL(rtp_1, MaxDataPayloadLength())
.Times(1)
.WillOnce(Return(kTestMinPayloadLength + 10));
EXPECT_CALL(rtp_2, MaxDataPayloadLength())
.Times(1)
.WillOnce(Return(kTestMinPayloadLength));
EXPECT_EQ(kTestMinPayloadLength, payload_router_->MaxPayloadLength());
}
} // namespace webrtc