Skip to content

Commit

Permalink
[ADD] FPNR-482 - Remove all local candidates from Chrome sdp to optim…
Browse files Browse the repository at this point in the history
…ize server STUN threads count
  • Loading branch information
flashphoner committed Dec 23, 2013
1 parent 029fba5 commit 760924e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/client/src/js/rtc/WebRtcMediaManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ WebRtcMediaManager.prototype.createPeerConnection = function () {
]};
}
this.peerConnection = new RTCPeerConnection(pc_config, {"optional": [
{"DtlsSrtpKeyAgreement": true}
{"DtlsSrtpKeyAgreement": false}
]});

this.peerConnection.onaddstream = function (event) {
Expand Down
22 changes: 22 additions & 0 deletions client/client/src/js/ws/WebSocketManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ WebSocketManager.prototype = {
sdp = me.stripCodecsSDP(sdp);
console.log("New SDP: " + sdp);
}
sdp = me.removeCandidatesFromSDP(sdp);
callRequest.sdp = sdp;
me.webSocket.send("call", callRequest);
}, false);
Expand Down Expand Up @@ -232,6 +233,7 @@ WebSocketManager.prototype = {
sdp = me.stripCodecsSDP(sdp);
console.log("New SDP: " + sdp);
}
sdp = me.removeCandidatesFromSDP(sdp);
me.webSocket.send("answer", {callId: callId, sdp: sdp});
}, false);
} else{
Expand Down Expand Up @@ -347,6 +349,26 @@ WebSocketManager.prototype = {
this.stripCodecs = array;
},

removeCandidatesFromSDP: function (sdp) {
var sdpArray = sdp.split("\n");

for (i = 0; i < sdpArray.length; i++) {
if (sdpArray[i].search("a=candidate:") != -1) {
sdpArray[i] = "";
}
}

//normalize sdp after modifications
var result = "";
for (i = 0; i < sdpArray.length; i++) {
if (sdpArray[i] != "") {
result += sdpArray[i] + "\n";
}
}

return result;
},

stripCodecsSDP: function (sdp) {
var sdpArray = sdp.split("\n");
console.dir(this.stripCodecs);
Expand Down

0 comments on commit 760924e

Please sign in to comment.