Index: webrtc/api/webrtcsession.cc |
diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc |
index dabfefa582d439ad70d5b354fe99d00df01893eb..9f84840822fce12c4c9012b568e10c0b3b4e651b 100644 |
--- a/webrtc/api/webrtcsession.cc |
+++ b/webrtc/api/webrtcsession.cc |
@@ -421,6 +421,22 @@ |
return MakeErrorString(kPushDownTDFailed, desc); |
} |
+uint32_t ConvertIceTransportTypeToCandidateFilter( |
+ PeerConnectionInterface::IceTransportsType type) { |
+ switch (type) { |
+ case PeerConnectionInterface::kNone: |
+ return cricket::CF_NONE; |
+ case PeerConnectionInterface::kRelay: |
+ return cricket::CF_RELAY; |
+ case PeerConnectionInterface::kNoHost: |
+ return (cricket::CF_ALL & ~cricket::CF_HOST); |
+ case PeerConnectionInterface::kAll: |
+ return cricket::CF_ALL; |
+ default: ASSERT(false); |
+ } |
+ return cricket::CF_NONE; |
+} |
+ |
// Returns true if |new_desc| requests an ICE restart (i.e., new ufrag/pwd). |
bool CheckForRemoteIceRestart(const SessionDescriptionInterface* old_desc, |
const SessionDescriptionInterface* new_desc, |
@@ -459,6 +475,7 @@ |
cricket::PortAllocator* port_allocator) |
: signaling_thread_(signaling_thread), |
worker_thread_(worker_thread), |
+ port_allocator_(port_allocator), |
// RFC 3264: The numeric value of the session id and version in the |
// o line MUST be representable with a "64 bit signed integer". |
// Due to this constraint session id |sid_| is max limited to LLONG_MAX. |
@@ -587,6 +604,8 @@ |
if (options.disable_encryption) { |
webrtc_session_desc_factory_->SetSdesPolicy(cricket::SEC_DISABLED); |
} |
+ port_allocator()->set_candidate_filter( |
+ ConvertIceTransportTypeToCandidateFilter(rtc_configuration.type)); |
return true; |
} |
@@ -1124,6 +1143,12 @@ |
LOG(LS_ERROR) << "Error when removing remote candidates: " << error; |
} |
return true; |
+} |
+ |
+bool WebRtcSession::SetIceTransports( |
+ PeerConnectionInterface::IceTransportsType type) { |
+ return port_allocator()->set_candidate_filter( |
+ ConvertIceTransportTypeToCandidateFilter(type)); |
} |
cricket::IceConfig WebRtcSession::ParseIceConfig( |