From 7ac5e8e8287d3f1f1c7c217d206ce0da6d4b126b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 1 May 2020 13:56:24 +0200 Subject: [PATCH] properly close WebRTCWrapper even when init failed --- .../conversations/xmpp/jingle/JingleRtpConnection.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 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 e46ce78ec..7633ad330 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -415,7 +415,9 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web } try { setupWebRTC(media, iceServers); - } catch (WebRTCWrapper.InitializationException e) { + } catch (final WebRTCWrapper.InitializationException e) { + Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable to initialize WebRTC"); + webRTCWrapper.close(); sendSessionTerminate(Reason.FAILED_APPLICATION); return; } @@ -636,7 +638,10 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web try { setupWebRTC(media, iceServers); } catch (WebRTCWrapper.InitializationException e) { - Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable to initialize webrtc"); + Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable to initialize WebRTC"); + webRTCWrapper.close(); + //todo we haven’t actually initiated the session yet; so sending sessionTerminate makes no sense + //todo either we don’t ring ever at all or maybe we should send a retract or something transitionOrThrow(State.TERMINATED_APPLICATION_FAILURE); return; }