Revert of Implement RTCConfiguration.iceCandidatePoolSize. (patchset #7 id:120001 of https://codereview.webrtc.org/1956453003/ )
Reason for revert:
Breaks remoting_unittests. They defined their own operator== which conflicts with this one.
I'll remove the operator== in a roll CL. But until it's approved, I'm reverting this so the FYI bots will pass.
Original issue's description:
> Implement RTCConfiguration.iceCandidatePoolSize.
>
> It works by creating pooled PortAllocatorSessions which can be picked up
> by a P2PTransportChannel when needed (after a local description is set).
>
> This can optimize candidate gathering time when there is some time between
> creating a PeerConnection and setting a local description.
>
> R=pthatcher@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/48e9d05f510b1616c81303944008f75825971802
TBR=pthatcher@webrtc.org,honghaiz@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review-Url: https://codereview.webrtc.org/1972043004
Cr-Commit-Position: refs/heads/master@{#12709}
diff --git a/webrtc/api/peerconnectioninterface_unittest.cc b/webrtc/api/peerconnectioninterface_unittest.cc
index 68c932b..795a66d 100644
--- a/webrtc/api/peerconnectioninterface_unittest.cc
+++ b/webrtc/api/peerconnectioninterface_unittest.cc
@@ -39,7 +39,7 @@
#include "webrtc/base/thread.h"
#include "webrtc/media/base/fakevideocapturer.h"
#include "webrtc/media/sctp/sctpdataengine.h"
-#include "webrtc/p2p/base/fakeportallocator.h"
+#include "webrtc/p2p/client/fakeportallocator.h"
#include "webrtc/pc/mediasession.h"
static const char kStreamLabel1[] = "local_stream_1";
@@ -551,33 +551,24 @@
}
void CreatePeerConnection() {
- CreatePeerConnection(PeerConnectionInterface::RTCConfiguration(), nullptr);
+ CreatePeerConnection("", "", NULL);
}
void CreatePeerConnection(webrtc::MediaConstraintsInterface* constraints) {
- CreatePeerConnection(PeerConnectionInterface::RTCConfiguration(),
- constraints);
+ CreatePeerConnection("", "", constraints);
}
- void CreatePeerConnectionWithIceTransportsType(
- PeerConnectionInterface::IceTransportsType type) {
- PeerConnectionInterface::RTCConfiguration config;
- config.type = type;
- return CreatePeerConnection(config, nullptr);
- }
-
- void CreatePeerConnectionWithIceServer(const std::string& uri,
- const std::string& password) {
+ void CreatePeerConnection(const std::string& uri,
+ const std::string& password,
+ webrtc::MediaConstraintsInterface* constraints) {
PeerConnectionInterface::RTCConfiguration config;
PeerConnectionInterface::IceServer server;
- server.uri = uri;
- server.password = password;
- config.servers.push_back(server);
- CreatePeerConnection(config, nullptr);
- }
+ if (!uri.empty()) {
+ server.uri = uri;
+ server.password = password;
+ config.servers.push_back(server);
+ }
- void CreatePeerConnection(PeerConnectionInterface::RTCConfiguration config,
- webrtc::MediaConstraintsInterface* constraints) {
std::unique_ptr<cricket::FakePortAllocator> port_allocator(
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
port_allocator_ = port_allocator.get();
@@ -622,7 +613,7 @@
}
void CreatePeerConnectionWithDifferentConfigurations() {
- CreatePeerConnectionWithIceServer(kStunAddressOnly, "");
+ CreatePeerConnection(kStunAddressOnly, "", NULL);
EXPECT_EQ(1u, port_allocator_->stun_servers().size());
EXPECT_EQ(0u, port_allocator_->turn_servers().size());
EXPECT_EQ("address", port_allocator_->stun_servers().begin()->hostname());
@@ -633,7 +624,7 @@
CreatePeerConnectionExpectFail(kStunAddressPortAndMore1);
CreatePeerConnectionExpectFail(kStunAddressPortAndMore2);
- CreatePeerConnectionWithIceServer(kTurnIceServerUri, kTurnPassword);
+ CreatePeerConnection(kTurnIceServerUri, kTurnPassword, NULL);
EXPECT_EQ(0u, port_allocator_->stun_servers().size());
EXPECT_EQ(1u, port_allocator_->turn_servers().size());
EXPECT_EQ(kTurnUsername,
@@ -1023,44 +1014,6 @@
CreatePeerConnectionWithDifferentConfigurations();
}
-TEST_F(PeerConnectionInterfaceTest,
- CreatePeerConnectionWithDifferentIceTransportsTypes) {
- CreatePeerConnectionWithIceTransportsType(PeerConnectionInterface::kNone);
- EXPECT_EQ(cricket::CF_NONE, port_allocator_->candidate_filter());
- CreatePeerConnectionWithIceTransportsType(PeerConnectionInterface::kRelay);
- EXPECT_EQ(cricket::CF_RELAY, port_allocator_->candidate_filter());
- CreatePeerConnectionWithIceTransportsType(PeerConnectionInterface::kNoHost);
- EXPECT_EQ(cricket::CF_ALL & ~cricket::CF_HOST,
- port_allocator_->candidate_filter());
- CreatePeerConnectionWithIceTransportsType(PeerConnectionInterface::kAll);
- EXPECT_EQ(cricket::CF_ALL, port_allocator_->candidate_filter());
-}
-
-// Test that when a PeerConnection is created with a nonzero candidate pool
-// size, the pooled PortAllocatorSession is created with all the attributes
-// in the RTCConfiguration.
-TEST_F(PeerConnectionInterfaceTest, CreatePeerConnectionWithPooledCandidates) {
- PeerConnectionInterface::RTCConfiguration config;
- PeerConnectionInterface::IceServer server;
- server.uri = kStunAddressOnly;
- config.servers.push_back(server);
- config.type = PeerConnectionInterface::kRelay;
- config.disable_ipv6 = true;
- config.tcp_candidate_policy =
- PeerConnectionInterface::kTcpCandidatePolicyDisabled;
- config.ice_candidate_pool_size = 1;
- CreatePeerConnection(config, nullptr);
-
- const cricket::FakePortAllocatorSession* session =
- static_cast<const cricket::FakePortAllocatorSession*>(
- port_allocator_->GetPooledSession());
- ASSERT_NE(nullptr, session);
- EXPECT_EQ(1UL, session->stun_servers().size());
- EXPECT_EQ(0U, session->flags() & cricket::PORTALLOCATOR_ENABLE_IPV6);
- EXPECT_LT(0U, session->flags() & cricket::PORTALLOCATOR_DISABLE_TCP);
- EXPECT_EQ(cricket::CF_RELAY, session->candidate_filter());
-}
-
TEST_F(PeerConnectionInterfaceTest, AddStreams) {
CreatePeerConnection();
AddVideoStream(kStreamLabel1);
@@ -1954,35 +1907,6 @@
port_allocator_->stun_servers().begin()->hostname());
}
-TEST_F(PeerConnectionInterfaceTest, SetConfigurationChangesCandidateFilter) {
- CreatePeerConnection();
- PeerConnectionInterface::RTCConfiguration config;
- config.type = PeerConnectionInterface::kRelay;
- EXPECT_TRUE(pc_->SetConfiguration(config));
- EXPECT_EQ(cricket::CF_RELAY, port_allocator_->candidate_filter());
-}
-
-// Test that when SetConfiguration changes both the pool size and other
-// attributes, the pooled session is created with the updated attributes.
-TEST_F(PeerConnectionInterfaceTest,
- SetConfigurationCreatesPooledSessionCorrectly) {
- CreatePeerConnection();
- PeerConnectionInterface::RTCConfiguration config;
- config.ice_candidate_pool_size = 1;
- PeerConnectionInterface::IceServer server;
- server.uri = kStunAddressOnly;
- config.servers.push_back(server);
- config.type = PeerConnectionInterface::kRelay;
- CreatePeerConnection(config, nullptr);
-
- const cricket::FakePortAllocatorSession* session =
- static_cast<const cricket::FakePortAllocatorSession*>(
- port_allocator_->GetPooledSession());
- ASSERT_NE(nullptr, session);
- EXPECT_EQ(1UL, session->stun_servers().size());
- EXPECT_EQ(cricket::CF_RELAY, session->candidate_filter());
-}
-
// Test that PeerConnection::Close changes the states to closed and all remote
// tracks change state to ended.
TEST_F(PeerConnectionInterfaceTest, CloseAndTestStreamsAndStates) {