summaryrefslogtreecommitdiff
path: root/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp')
-rw-r--r--media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
index 7f3bb90d44..ad87fa1f91 100644
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -335,6 +335,7 @@ PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
, mSTSThread(nullptr)
, mAllowIceLoopback(false)
, mAllowIceLinkLocal(false)
+ , mForceIceTcp(false)
, mMedia(nullptr)
, mUuidGen(MakeUnique<PCUuidGenerator>())
, mNumAudioStreams(0)
@@ -365,6 +366,8 @@ PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
"media.peerconnection.ice.loopback", false);
mAllowIceLinkLocal = Preferences::GetBool(
"media.peerconnection.ice.link_local", false);
+ mForceIceTcp = Preferences::GetBool(
+ "media.peerconnection.ice.force_ice_tcp", false);
#endif
memset(mMaxReceiving, 0, sizeof(mMaxReceiving));
memset(mMaxSending, 0, sizeof(mMaxSending));
@@ -2260,6 +2263,11 @@ NS_IMETHODIMP
PeerConnectionImpl::AddIceCandidate(const char* aCandidate, const char* aMid, unsigned short aLevel) {
PC_AUTO_ENTER_API_CALL(true);
+ if (mForceIceTcp && std::string::npos != std::string(aCandidate).find(" UDP ")) {
+ CSFLogError(logTag, "Blocking remote UDP candidate: %s", aCandidate);
+ return NS_OK;
+ }
+
JSErrorResult rv;
RefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(mPCObserver);
if (!pco) {
@@ -3111,7 +3119,7 @@ PeerConnectionImpl::SetSignalingState_m(PCImplSignalingState aSignalingState,
mNegotiationNeeded = false;
// If we're rolling back a local offer, we might need to remove some
// transports, but nothing further needs to be done.
- mMedia->ActivateOrRemoveTransports(*mJsepSession);
+ mMedia->ActivateOrRemoveTransports(*mJsepSession, mForceIceTcp);
if (!rollback) {
mMedia->UpdateMediaPipelines(*mJsepSession);
InitializeDataChannel();
@@ -3273,6 +3281,11 @@ PeerConnectionImpl::CandidateReady(const std::string& candidate,
uint16_t level) {
PC_AUTO_ENTER_API_CALL_VOID_RETURN(false);
+ if (mForceIceTcp && std::string::npos != candidate.find(" UDP ")) {
+ CSFLogError(logTag, "Blocking local UDP candidate: %s", candidate.c_str());
+ return;
+ }
+
std::string mid;
bool skipped = false;
nsresult res = mJsepSession->AddLocalIceCandidate(candidate,