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

Unified Diff: remoting/protocol/transport_context.h

Issue 1800893002: Enable TURN on the host when using WebRTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
Index: remoting/protocol/transport_context.h
diff --git a/remoting/protocol/transport_context.h b/remoting/protocol/transport_context.h
index 0cc624117912dba50e0b9956b4aa485d9bd1f369..118f2c938fddc0f702fcdf3ef3bb3aa1d9f440c3 100644
--- a/remoting/protocol/transport_context.h
+++ b/remoting/protocol/transport_context.h
@@ -5,6 +5,7 @@
#ifndef REMOTING_PROTOCOL_TRANSPORT_CONTEXT_H_
#define REMOTING_PROTOCOL_TRANSPORT_CONTEXT_H_
+#include <array>
#include <list>
#include <string>
#include <vector>
@@ -31,6 +32,12 @@ class IceConfigRequest;
// TURN configuration.
class TransportContext : public base::RefCountedThreadSafe<TransportContext> {
public:
+ enum RelayMode {
+ GTURN,
+ TURN
+ };
+ static const int kNumRelayModes = RelayMode::TURN + 1;
garykac 2016/03/15 20:38:59 The enum should end with MAX_RELAYMODE (or somethi
Sergey Ulanov 2016/03/15 21:54:53 That would make the compiler complain that MAX_REL
garykac 2016/03/16 00:58:21 enum RelayMode { GTURN, TURN, LAST_RELAYMODE
Sergey Ulanov 2016/03/16 18:34:13 Done.
+
typedef base::Callback<void(const IceConfig& ice_config)>
GetIceConfigCallback;
@@ -42,11 +49,14 @@ class TransportContext : public base::RefCountedThreadSafe<TransportContext> {
const NetworkSettings& network_settings,
TransportRole role);
- // Enables standard TURN servers.
- void UseTurn(const std::string& ice_config_url) {
+ void set_ice_config_url(const std::string& ice_config_url) {
ice_config_url_ = ice_config_url;
}
+ // Sets relay mode for all future calls of GetIceConfig(). Doesn't affect
+ // previous GetIceConfig() requests.
+ void set_relay_mode(RelayMode relay_mode) { relay_mode_ = relay_mode; }
+
// Prepares fresh JingleInfo. It may be called while connection is being
// negotiated to minimize the chance that the following GetIceConfig() will
// be blocking.
@@ -69,8 +79,8 @@ class TransportContext : public base::RefCountedThreadSafe<TransportContext> {
~TransportContext();
- void EnsureFreshJingleInfo();
- void OnIceConfig(const IceConfig& ice_config);
+ void EnsureFreshIceConfig();
+ void OnIceConfig(RelayMode relay_mode, const IceConfig& ice_config);
SignalStrategy* signal_strategy_;
scoped_ptr<PortAllocatorFactory> port_allocator_factory_;
@@ -79,14 +89,15 @@ class TransportContext : public base::RefCountedThreadSafe<TransportContext> {
TransportRole role_;
std::string ice_config_url_;
+ RelayMode relay_mode_ = RelayMode::GTURN;
- scoped_ptr<IceConfigRequest> ice_config_request_;
-
- IceConfig ice_config_;
+ std::array<scoped_ptr<IceConfigRequest>, kNumRelayModes> ice_config_request_;
+ std::array<IceConfig, kNumRelayModes> ice_config_;
- // When there is an active |jingle_info_request_| stores list of callbacks to
+ // When there is an active |ice_config_request_| stores list of callbacks to
// be called once the request is finished.
- std::list<GetIceConfigCallback> pending_ice_config_callbacks_;
+ std::array<std::list<GetIceConfigCallback>, kNumRelayModes>
+ pending_ice_config_callbacks_;
DISALLOW_COPY_AND_ASSIGN(TransportContext);
};

Powered by Google App Engine
This is Rietveld 408576698