From 297a843b9c6b245f4e3bb07a23e487a4f6d5d9f8 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 16 Nov 2021 13:17:10 +0100 Subject: [PATCH] use implicit rollback (needed to be enabled on libwebrtc) --- .../xmpp/jingle/JingleRtpConnection.java | 2 -- .../xmpp/jingle/WebRTCWrapper.java | 26 +------------------ 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java index ce726a2f0..5c474a754 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -356,8 +356,6 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web //We ignore the offer and respond with tie-break. This will clause the responder not to apply the content map return false; } - //rollback our own local description. should happen automatically but doesn't - webRTCWrapper.rollbackLocalDescription().get(); } webRTCWrapper.setRemoteDescription(sdp).get(); setRemoteContentMap(restartContentMap); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java index 401121b86..13b695b0e 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java @@ -86,7 +86,6 @@ public class WebRTCWrapper { private final EventCallback eventCallback; private final AtomicBoolean readyToReceivedIceCandidates = new AtomicBoolean(false); - private final AtomicBoolean ignoreOnRenegotiationNeeded = new AtomicBoolean(false); private final Queue iceCandidates = new LinkedList<>(); private final AppRTCAudioManager.AudioManagerEvents audioManagerEvents = new AppRTCAudioManager.AudioManagerEvents() { @Override @@ -163,10 +162,6 @@ public class WebRTCWrapper { @Override public void onRenegotiationNeeded() { - if (ignoreOnRenegotiationNeeded.get()) { - Log.d(EXTENDED_LOGGING_TAG, "ignoring onRenegotiationNeeded()"); - return; - } Log.d(EXTENDED_LOGGING_TAG, "onRenegotiationNeeded()"); final PeerConnection.PeerConnectionState currentState = peerConnection == null ? null : peerConnection.connectionState(); if (currentState != null && currentState != PeerConnection.PeerConnectionState.NEW) { @@ -277,6 +272,7 @@ public class WebRTCWrapper { rtcConfig.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY; rtcConfig.sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN; rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.NEGOTIATE; + rtcConfig.enableImplicitRollback = true; final PeerConnection peerConnection = peerConnectionFactory.createPeerConnection(rtcConfig, peerConnectionObserver); if (peerConnection == null) { throw new InitializationException("Unable to create PeerConnection"); @@ -456,26 +452,6 @@ public class WebRTCWrapper { }, MoreExecutors.directExecutor()); } - public ListenableFuture rollbackLocalDescription() { - final SettableFuture future = SettableFuture.create(); - final SessionDescription rollback = new SessionDescription(SessionDescription.Type.ROLLBACK, ""); - ignoreOnRenegotiationNeeded.set(true); - requirePeerConnection().setLocalDescription(new SetSdpObserver() { - @Override - public void onSetSuccess() { - future.set(null); - ignoreOnRenegotiationNeeded.set(false); - } - - @Override - public void onSetFailure(final String message) { - future.setException(new FailureToSetDescriptionException(message)); - } - }, rollback); - return future; - } - - private static void logDescription(final SessionDescription sessionDescription) { for (final String line : sessionDescription.description.split(eu.siacs.conversations.xmpp.jingle.SessionDescription.LINE_DIVIDER)) { Log.d(EXTENDED_LOGGING_TAG, line);