Skip to content

Commit

Permalink
Bug 1056934 - Part 4: Handle turns URLs when configuring nICEr. r=drno
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 6izdoAUgwcn

--HG--
extra : rebase_source : 8a45e9cd5b7962b0d674aff8a72283d99655c556
  • Loading branch information
docfaraday committed Jan 3, 2017
1 parent b35cd43 commit 357ff5d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions media/mtransport/nricectx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ MOZ_MTLOG_MODULE("mtransport")

const char kNrIceTransportUdp[] = "udp";
const char kNrIceTransportTcp[] = "tcp";
const char kNrIceTransportTls[] = "tls";

static bool initialized = false;

Expand Down Expand Up @@ -211,6 +212,9 @@ nsresult NrIceStunServer::ToNicerStunStruct(nr_ice_stun_server *server) const {
server->transport = IPPROTO_UDP;
} else if (transport_ == kNrIceTransportTcp) {
server->transport = IPPROTO_TCP;
} else if (transport_ == kNrIceTransportTls) {
server->transport = IPPROTO_TCP;
server->tls = 1;
} else {
MOZ_MTLOG(ML_ERROR, "Unsupported STUN server transport: " << transport_);
return NS_ERROR_FAILURE;
Expand Down
1 change: 1 addition & 0 deletions media/mtransport/nricectx.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class NrIceMediaStream;

extern const char kNrIceTransportUdp[];
extern const char kNrIceTransportTcp[];
extern const char kNrIceTransportTls[];

class NrIceStunServer {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,8 @@ PeerConnectionConfiguration::AddIceServer(const RTCIceServer &aServer)
if (!(isStun || isStuns || isTurn || isTurns)) {
return NS_ERROR_FAILURE;
}
if (isTurns || isStuns) {
continue; // TODO: Support TURNS and STUNS (Bug 1056934)
if (isStuns) {
continue; // TODO: Support STUNS (Bug 1056934)
}
nsAutoCString spec;
rv = url->GetSpec(spec);
Expand Down Expand Up @@ -571,6 +571,11 @@ PeerConnectionConfiguration::AddIceServer(const RTCIceServer &aServer)
if (port == -1)
port = (isStuns || isTurns)? 5349 : 3478;

if (isStuns || isTurns) {
// Should we barf if transport is set to udp or something?
transport = "tls";
}

if (isTurn || isTurns) {
NS_ConvertUTF16toUTF8 credential(aServer.mCredential.Value());
NS_ConvertUTF16toUTF8 username(aServer.mUsername.Value());
Expand Down

0 comments on commit 357ff5d

Please sign in to comment.