Bug 1336507 - Part 4: Stop using a magic constant here. r=drno
authorByron Campen [:bwc] <docfaraday@gmail.com>
Fri, 03 Feb 2017 16:48:30 -0600
changeset 479883 f3da0505833f946d1b1767986ebb8e3d7a63f5c1
parent 479882 31bf2f8302b05449734c5fe6696521db9333c08a
child 479884 330ab4695793c499110152a6582afca8e87ae46c
push id44393
push userVYV03354@nifty.ne.jp
push dateTue, 07 Feb 2017 13:53:48 +0000
reviewersdrno
bugs1336507
milestone54.0a1
Bug 1336507 - Part 4: Stop using a magic constant here. r=drno MozReview-Commit-ID: LgIUrzFFT8I
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -562,33 +562,35 @@ PeerConnectionConfiguration::AddIceServe
         return NS_ERROR_FAILURE;
       path.Mid(host, hostPos, hostLen);
     }
     if (port == -1)
       port = (isStuns || isTurns)? 5349 : 3478;
 
     if (isStuns || isTurns) {
       // Should we barf if transport is set to udp or something?
-      transport = "tls";
+      transport = kNrIceTransportTls;
+    }
+
+    if (transport.IsEmpty()) {
+      transport = kNrIceTransportUdp;
     }
 
     if (isTurn || isTurns) {
       NS_ConvertUTF16toUTF8 credential(aServer.mCredential.Value());
       NS_ConvertUTF16toUTF8 username(aServer.mUsername.Value());
 
       if (!addTurnServer(host.get(), port,
                          username.get(),
                          credential.get(),
-                         (transport.IsEmpty() ?
-                          kNrIceTransportUdp : transport.get()))) {
+                         transport.get())) {
         return NS_ERROR_FAILURE;
       }
     } else {
-      if (!addStunServer(host.get(), port, (transport.IsEmpty() ?
-                         kNrIceTransportUdp : transport.get()))) {
+      if (!addStunServer(host.get(), port, transport.get())) {
         return NS_ERROR_FAILURE;
       }
     }
   }
   return NS_OK;
 }
 #endif