diff options
author | henrika@webrtc.org <henrika@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-01-13 09:35:02 +0000 |
---|---|---|
committer | henrika@webrtc.org <henrika@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-01-13 09:35:02 +0000 |
commit | 8d131baa4b1d171960b0cec6c200bd99ec9b39d2 (patch) | |
tree | 183c4083159291713be86adb4c638b517298e443 /p2p/client | |
parent | 3e7165a8379ea0fd37ca04af1a95dff0568c8775 (diff) | |
download | talk-8d131baa4b1d171960b0cec6c200bd99ec9b39d2.tar.gz |
Revert 5367 "Update talk to 59410372."
> Update talk to 59410372.
>
> R=jiayl@webrtc.org, wu@webrtc.org
>
> Review URL: https://webrtc-codereview.appspot.com/6929004
TBR=mallinath@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/6999004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@5371 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'p2p/client')
-rw-r--r-- | p2p/client/basicportallocator.cc | 14 | ||||
-rw-r--r-- | p2p/client/portallocator_unittest.cc | 51 |
2 files changed, 64 insertions, 1 deletions
diff --git a/p2p/client/basicportallocator.cc b/p2p/client/basicportallocator.cc index 9e2ce07..e568e75 100644 --- a/p2p/client/basicportallocator.cc +++ b/p2p/client/basicportallocator.cc @@ -65,6 +65,10 @@ const int PHASE_SSLTCP = 3; const int kNumPhases = 4; +// Both these values are in bytes. +const int kLargeSocketSendBufferSize = 128 * 1024; +const int kNormalSocketSendBufferSize = 64 * 1024; + const int SHAKE_MIN_DELAY = 45 * 1000; // 45 seconds const int SHAKE_MAX_DELAY = 90 * 1000; // 90 seconds @@ -486,6 +490,16 @@ void BasicPortAllocatorSession::AddAllocatedPort(Port* port, port->set_send_retransmit_count_attribute((allocator_->flags() & PORTALLOCATOR_ENABLE_STUN_RETRANSMIT_ATTRIBUTE) != 0); + if (content_name().compare(CN_VIDEO) == 0 && + component_ == cricket::ICE_CANDIDATE_COMPONENT_RTP) { + // For video RTP alone, we set send-buffer sizes. This used to be set in the + // engines/channels. + int sendBufSize = (flags() & PORTALLOCATOR_USE_LARGE_SOCKET_SEND_BUFFERS) + ? kLargeSocketSendBufferSize + : kNormalSocketSendBufferSize; + port->SetOption(talk_base::Socket::OPT_SNDBUF, sendBufSize); + } + PortData data(port, seq); ports_.push_back(data); diff --git a/p2p/client/portallocator_unittest.cc b/p2p/client/portallocator_unittest.cc index f3400f1..6966e44 100644 --- a/p2p/client/portallocator_unittest.cc +++ b/p2p/client/portallocator_unittest.cc @@ -331,7 +331,56 @@ TEST_F(PortAllocatorTest, TestSetupVideoRtpPortsWithNormalSendBuffers) { // If we Stop gathering now, we shouldn't get a second "done" callback. session_->StopGettingPorts(); - // All ports should have unset send-buffer sizes. + // All ports should have normal send-buffer sizes (64KB). + CheckSendBufferSizesOfAllPorts(64 * 1024); +} + +TEST_F(PortAllocatorTest, TestSetupVideoRtpPortsWithLargeSendBuffers) { + AddInterface(kClientAddr); + allocator_->set_flags(allocator_->flags() | + cricket::PORTALLOCATOR_USE_LARGE_SOCKET_SEND_BUFFERS); + EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP, + cricket::CN_VIDEO)); + session_->StartGettingPorts(); + ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout); + EXPECT_TRUE(candidate_allocation_done_); + // If we Stop gathering now, we shouldn't get a second "done" callback. + session_->StopGettingPorts(); + + // All ports should have large send-buffer sizes (128KB). + CheckSendBufferSizesOfAllPorts(128 * 1024); +} + +TEST_F(PortAllocatorTest, TestSetupVideoRtcpPortsAndCheckSendBuffers) { + AddInterface(kClientAddr); + allocator_->set_flags(allocator_->flags() | + cricket::PORTALLOCATOR_USE_LARGE_SOCKET_SEND_BUFFERS); + EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTCP, + cricket::CN_DATA)); + session_->StartGettingPorts(); + ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout); + EXPECT_TRUE(candidate_allocation_done_); + // If we Stop gathering now, we shouldn't get a second "done" callback. + session_->StopGettingPorts(); + + // No ports should have send-buffer size set. + CheckSendBufferSizesOfAllPorts(-1); +} + + +TEST_F(PortAllocatorTest, TestSetupNonVideoPortsAndCheckSendBuffers) { + AddInterface(kClientAddr); + allocator_->set_flags(allocator_->flags() | + cricket::PORTALLOCATOR_USE_LARGE_SOCKET_SEND_BUFFERS); + EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP, + cricket::CN_DATA)); + session_->StartGettingPorts(); + ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout); + EXPECT_TRUE(candidate_allocation_done_); + // If we Stop gathering now, we shouldn't get a second "done" callback. + session_->StopGettingPorts(); + + // No ports should have send-buffer size set. CheckSendBufferSizesOfAllPorts(-1); } |