properly close WebRTCWrapper even when init failed

This commit is contained in:
Daniel Gultsch 2020-05-01 13:56:24 +02:00
parent f8866d1bef
commit 7ac5e8e828
1 changed files with 7 additions and 2 deletions

View File

@ -415,7 +415,9 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
} }
try { try {
setupWebRTC(media, iceServers); 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); sendSessionTerminate(Reason.FAILED_APPLICATION);
return; return;
} }
@ -636,7 +638,10 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
try { try {
setupWebRTC(media, iceServers); setupWebRTC(media, iceServers);
} catch (WebRTCWrapper.InitializationException e) { } 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 havent actually initiated the session yet; so sending sessionTerminate makes no sense
//todo either we dont ring ever at all or maybe we should send a retract or something
transitionOrThrow(State.TERMINATED_APPLICATION_FAILURE); transitionOrThrow(State.TERMINATED_APPLICATION_FAILURE);
return; return;
} }