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

Unified Diff: webrtc/p2p/base/portallocator.h

Issue 1982513002: Revert of Relanding: Implement RTCConfiguration.iceCandidatePoolSize. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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
« no previous file with comments | « webrtc/p2p/base/port_unittest.cc ('k') | webrtc/p2p/base/portallocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/portallocator.h
diff --git a/webrtc/p2p/base/portallocator.h b/webrtc/p2p/base/portallocator.h
index 879657081a5372f1248178964523c0d5ed2d1539..6fb79b065e62f1ee1f8f33d5023569bca5e93108 100644
--- a/webrtc/p2p/base/portallocator.h
+++ b/webrtc/p2p/base/portallocator.h
@@ -11,8 +11,6 @@
#ifndef WEBRTC_P2P_BASE_PORTALLOCATOR_H_
#define WEBRTC_P2P_BASE_PORTALLOCATOR_H_
-#include <deque>
-#include <memory>
#include <string>
#include <vector>
@@ -21,7 +19,6 @@
#include "webrtc/base/helpers.h"
#include "webrtc/base/proxyinfo.h"
#include "webrtc/base/sigslot.h"
-#include "webrtc/base/thread.h"
namespace cricket {
@@ -85,11 +82,6 @@
RelayCredentials(const std::string& username, const std::string& password)
: username(username), password(password) {}
- bool operator==(const RelayCredentials& o) const {
- return username == o.username && password == o.password;
- }
- bool operator!=(const RelayCredentials& o) const { return !(*this == o); }
-
std::string username;
std::string password;
};
@@ -97,7 +89,7 @@
typedef std::vector<ProtocolAddress> PortList;
// TODO(deadbeef): Rename to TurnServerConfig.
struct RelayServerConfig {
- RelayServerConfig(RelayType type) : type(type) {}
+ RelayServerConfig(RelayType type) : type(type), priority(0) {}
RelayServerConfig(const std::string& address,
int port,
@@ -110,16 +102,10 @@
ProtocolAddress(rtc::SocketAddress(address, port), proto, secure));
}
- bool operator==(const RelayServerConfig& o) const {
- return type == o.type && ports == o.ports && credentials == o.credentials &&
- priority == o.priority;
- }
- bool operator!=(const RelayServerConfig& o) const { return !(*this == o); }
-
RelayType type;
PortList ports;
RelayCredentials credentials;
- int priority = 0;
+ int priority;
};
class PortAllocatorSession : public sigslot::has_slots<> {
@@ -138,9 +124,6 @@
void set_flags(uint32_t flags) { flags_ = flags; }
std::string content_name() const { return content_name_; }
int component() const { return component_; }
- const std::string& ice_ufrag() const { return ice_ufrag_; }
- const std::string& ice_pwd() const { return ice_pwd_; }
- bool pooled() const { return ice_ufrag_.empty(); }
// Starts gathering STUN and Relay configurations.
virtual void StartGettingPorts() = 0;
@@ -150,14 +133,6 @@
// Whether the process of getting ports has been stopped.
virtual bool IsGettingPorts() = 0;
- // Another way of getting the information provided by the signals below.
- //
- // Ports and candidates are not guaranteed to be in the same order as the
- // signals were emitted in.
- virtual std::vector<PortInterface*> ReadyPorts() const = 0;
- virtual std::vector<Candidate> ReadyCandidates() const = 0;
- virtual bool CandidatesAllocationDone() const = 0;
-
sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady;
sigslot::signal2<PortAllocatorSession*,
const std::vector<Candidate>&> SignalCandidatesReady;
@@ -167,46 +142,25 @@
virtual void set_generation(uint32_t generation) { generation_ = generation; }
sigslot::signal1<PortAllocatorSession*> SignalDestroyed;
+ const std::string& ice_ufrag() const { return ice_ufrag_; }
+ const std::string& ice_pwd() const { return ice_pwd_; }
+
protected:
- // This method is called when a pooled session (which doesn't have these
- // properties initially) is returned by PortAllocator::TakePooledSession,
- // and the content name, component, and ICE ufrag/pwd are updated.
- //
- // A subclass may need to override this method to perform additional actions,
- // such as applying the updated information to ports and candidates.
- virtual void UpdateIceParametersInternal() {}
-
// TODO(deadbeef): Get rid of these when everyone switches to ice_ufrag and
// ice_pwd.
const std::string& username() const { return ice_ufrag_; }
const std::string& password() const { return ice_pwd_; }
+ std::string content_name_;
+ int component_;
+
private:
- void SetIceParameters(const std::string& content_name,
- int component,
- const std::string& ice_ufrag,
- const std::string& ice_pwd) {
- content_name_ = content_name;
- component_ = component;
- ice_ufrag_ = ice_ufrag;
- ice_pwd_ = ice_pwd;
- UpdateIceParametersInternal();
- }
-
uint32_t flags_;
uint32_t generation_;
- std::string content_name_;
- int component_;
std::string ice_ufrag_;
std::string ice_pwd_;
-
- // SetIceParameters is an implementation detail which only PortAllocator
- // should be able to call.
- friend class PortAllocator;
-};
-
-// Note that this class should only be used on one thread.
-// This includes calling the destructor.
+};
+
class PortAllocator : public sigslot::has_slots<> {
public:
PortAllocator() :
@@ -220,25 +174,10 @@
}
virtual ~PortAllocator() {}
- // Set STUN and TURN servers to be used in future sessions, and set
- // candidate pool size, as described in JSEP.
- //
- // If the servers are changing and the candidate pool size is nonzero,
- // existing pooled sessions will be destroyed and new ones created.
- //
- // If the servers are not changing but the candidate pool size is,
- // pooled sessions will be either created or destroyed as necessary.
- void SetConfiguration(const ServerAddresses& stun_servers,
- const std::vector<RelayServerConfig>& turn_servers,
- int candidate_pool_size);
-
- const ServerAddresses& stun_servers() const { return stun_servers_; }
-
- const std::vector<RelayServerConfig>& turn_servers() const {
- return turn_servers_;
- }
-
- int candidate_pool_size() const { return target_pooled_session_count_; }
+ // Set STUN and TURN servers to be used in future sessions.
+ virtual void SetIceServers(
+ const ServerAddresses& stun_servers,
+ const std::vector<RelayServerConfig>& turn_servers) = 0;
// Sets the network types to ignore.
// Values are defined by the AdapterType enum.
@@ -247,26 +186,12 @@
// loopback interfaces.
virtual void SetNetworkIgnoreMask(int network_ignore_mask) = 0;
- std::unique_ptr<PortAllocatorSession> CreateSession(
+ PortAllocatorSession* CreateSession(
const std::string& sid,
const std::string& content_name,
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd);
-
- // Get an available pooled session and set the transport information on it.
- //
- // Caller takes ownership of the returned session.
- //
- // If no pooled sessions are available, returns null.
- std::unique_ptr<PortAllocatorSession> TakePooledSession(
- const std::string& content_name,
- int component,
- const std::string& ice_ufrag,
- const std::string& ice_pwd);
-
- // Returns the next session that would be returned by TakePooledSession.
- const PortAllocatorSession* GetPooledSession() const;
uint32_t flags() const { return flags_; }
void set_flags(uint32_t flags) { flags_ = flags; }
@@ -300,9 +225,10 @@
}
uint32_t candidate_filter() { return candidate_filter_; }
- void set_candidate_filter(uint32_t filter) {
+ bool set_candidate_filter(uint32_t filter) {
// TODO(mallinath) - Do transition check?
candidate_filter_ = filter;
+ return true;
}
// Gets/Sets the Origin value used for WebRTC STUN requests.
@@ -325,16 +251,6 @@
bool allow_tcp_listen_;
uint32_t candidate_filter_;
std::string origin_;
-
- private:
- ServerAddresses stun_servers_;
- std::vector<RelayServerConfig> turn_servers_;
- // The last size passed into SetConfiguration.
- int target_pooled_session_count_ = 0;
- // This variable represents the total number of pooled sessions
- // both owned by this class and taken by TakePooledSession.
- int allocated_pooled_session_count_ = 0;
- std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_;
};
} // namespace cricket
« no previous file with comments | « webrtc/p2p/base/port_unittest.cc ('k') | webrtc/p2p/base/portallocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698