From 15b323ee694e1bd112de88ef8435cbb80e5d487b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 22 Aug 2020 08:11:21 +0200 Subject: [PATCH] fix crash after session-accept failed and session-accept contained candidates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Conversations would attempt to feed any candidates found in the session-accept into WebRTC; even if the session wasn’t setup correctly. this commit processes the candidates only if the session was setup correctly fixes #3867 --- .../conversations/xmpp/jingle/JingleRtpConnection.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 bc3487ad6..eb28444a7 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -371,8 +371,6 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web if (transition(State.SESSION_ACCEPTED)) { respondOk(jinglePacket); receiveSessionAccept(contentMap); - final List identificationTags = contentMap.group == null ? contentMap.getNames() : contentMap.group.getIdentificationTags(); - processCandidates(identificationTags, contentMap.contents.entrySet()); } else { Log.d(Config.LOGTAG, String.format("%s: received session-accept while in state %s", id.account.getJid().asBareJid(), state)); respondOk(jinglePacket); @@ -390,7 +388,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage()); return; } - org.webrtc.SessionDescription answer = new org.webrtc.SessionDescription( + final org.webrtc.SessionDescription answer = new org.webrtc.SessionDescription( org.webrtc.SessionDescription.Type.ANSWER, sessionDescription.toString() ); @@ -400,7 +398,10 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable to set remote description after receiving session-accept", Throwables.getRootCause(e)); webRTCWrapper.close(); sendSessionTerminate(Reason.FAILED_APPLICATION); + return; } + final List identificationTags = contentMap.group == null ? contentMap.getNames() : contentMap.group.getIdentificationTags(); + processCandidates(identificationTags, contentMap.contents.entrySet()); } private void sendSessionAccept() {