Change summary
src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java | 1
src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java | 21
2 files changed, 16 insertions(+), 6 deletions(-)
Detailed changes
@@ -1511,6 +1511,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
}
private void initiateIceRestart() {
+ //TODO discover new TURN/STUN credentials
this.stateHistory.clear();
this.webRTCWrapper.setIsReadyToReceiveIceCandidates(false);
final SessionDescription sessionDescription;
@@ -267,12 +267,7 @@ public class WebRTCWrapper {
.createPeerConnectionFactory();
- final PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(iceServers);
- rtcConfig.tcpCandidatePolicy = PeerConnection.TcpCandidatePolicy.DISABLED; //XEP-0176 doesn't support tcp
- rtcConfig.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY;
- rtcConfig.sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN;
- rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.NEGOTIATE;
- rtcConfig.enableImplicitRollback = true;
+ final PeerConnection.RTCConfiguration rtcConfig = buildConfiguration(iceServers);
final PeerConnection peerConnection = peerConnectionFactory.createPeerConnection(rtcConfig, peerConnectionObserver);
if (peerConnection == null) {
throw new InitializationException("Unable to create PeerConnection");
@@ -306,6 +301,20 @@ public class WebRTCWrapper {
this.peerConnection = peerConnection;
}
+ private static PeerConnection.RTCConfiguration buildConfiguration(final List<PeerConnection.IceServer> iceServers) {
+ final PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(iceServers);
+ rtcConfig.tcpCandidatePolicy = PeerConnection.TcpCandidatePolicy.DISABLED; //XEP-0176 doesn't support tcp
+ rtcConfig.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY;
+ rtcConfig.sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN;
+ rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.NEGOTIATE;
+ rtcConfig.enableImplicitRollback = true;
+ return rtcConfig;
+ }
+
+ void reconfigurePeerConnection(final List<PeerConnection.IceServer> iceServers) {
+ requirePeerConnection().setConfiguration(buildConfiguration(iceServers));
+ }
+
void restartIce() {
executorService.execute(() -> requirePeerConnection().restartIce());
}