call: pick a sample of 2 of the iceservers before creating connection

pull/2165/head
audric 4 years ago
parent b1221c6809
commit 78b84d4ed8

@ -120,10 +120,11 @@ let ignoreOffer = false;
let isSettingRemoteAnswerPending = false; let isSettingRemoteAnswerPending = false;
let lastOutgoingOfferTimestamp = -Infinity; let lastOutgoingOfferTimestamp = -Infinity;
const configuration: RTCConfiguration = { /**
bundlePolicy: 'max-bundle', * This array holds all of the ice servers Session can contact.
rtcpMuxPolicy: 'require', * They are all contacted at the same time, so before triggering the request, we get only a subset of those, randomly
iceServers: [ */
const iceServersFullArray = [
{ {
urls: 'turn:freyr.getsession.org', urls: 'turn:freyr.getsession.org',
username: 'session202111', username: 'session202111',
@ -159,7 +160,11 @@ const configuration: RTCConfiguration = {
username: 'session202111', username: 'session202111',
credential: '053c268164bc7bd7', credential: '053c268164bc7bd7',
}, },
], ];
const configuration: RTCConfiguration = {
bundlePolicy: 'max-bundle',
rtcpMuxPolicy: 'require',
// iceTransportPolicy: 'relay', // for now, this cause the connection to break after 30-40 sec if we enable this // iceTransportPolicy: 'relay', // for now, this cause the connection to break after 30-40 sec if we enable this
}; };
@ -701,7 +706,8 @@ function createOrGetPeerConnection(withPubkey: string) {
return peerConnection; return peerConnection;
} }
remoteStream = new MediaStream(); remoteStream = new MediaStream();
peerConnection = new RTCPeerConnection(configuration); const sampleOfICeServers = _.sampleSize(iceServersFullArray, 2);
peerConnection = new RTCPeerConnection({ ...configuration, iceServers: sampleOfICeServers });
dataChannel = peerConnection.createDataChannel('session-datachannel', { dataChannel = peerConnection.createDataChannel('session-datachannel', {
ordered: true, ordered: true,
negotiated: true, negotiated: true,

Loading…
Cancel
Save