From f4247379bd6c30ea6ee610b2d9f3f8afa68140cc Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 9 May 2020 19:48:54 +0200 Subject: [PATCH] catch UnsatisfiedLinkError when trying to init libwebrtc. fixes #3707 --- .../conversations/ui/RtpSessionActivity.java | 2 -- .../xmpp/jingle/JingleConnectionManager.java | 1 + .../xmpp/jingle/JingleRtpConnection.java | 1 + .../xmpp/jingle/WebRTCWrapper.java | 19 ++++++++++++++----- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index 2a1730c94..b4ee00ca7 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -705,10 +705,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe } private void updateCallDuration() { - Log.d(Config.LOGTAG,"updateCallDuration()"); final JingleRtpConnection connection = this.rtpConnectionReference != null ? this.rtpConnectionReference.get() : null; if (connection == null || connection.getMedia().contains(Media.VIDEO)) { - Log.d(Config.LOGTAG,"rtpConnection was null or contained video"); this.binding.duration.setVisibility(View.GONE); return; } diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java index 1139e992c..e4abcd27e 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -262,6 +262,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { rtpConnection.deliveryMessage(from, message, serverMsgId, timestamp); } else { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": no rtp session proposal found for " + from + " to deliver proceed"); + //TODO return error message "item-not-found" } } } else if ("reject".equals(message.getName())) { 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 af94cbd0b..3e66a219f 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -486,6 +486,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web } void deliverFailedProceed() { + //TODO do we want a special State.ITEM_NOT_FOUND to track retracted calls during network outages Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": receive message error for proceed message"); if (transition(State.TERMINATED_CONNECTIVITY_ERROR)) { webRTCWrapper.close(); 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 99edf2853..96c98181a 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java @@ -8,6 +8,7 @@ import android.util.Log; import com.google.common.base.Optional; import com.google.common.base.Preconditions; +import com.google.common.base.Throwables; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.util.concurrent.Futures; @@ -164,10 +165,14 @@ public class WebRTCWrapper { this.eventCallback = eventCallback; } - public void setup(final Context context, final AppRTCAudioManager.SpeakerPhonePreference speakerPhonePreference) { - PeerConnectionFactory.initialize( - PeerConnectionFactory.InitializationOptions.builder(context).createInitializationOptions() - ); + public void setup(final Context context, final AppRTCAudioManager.SpeakerPhonePreference speakerPhonePreference) throws InitializationException { + try { + PeerConnectionFactory.initialize( + PeerConnectionFactory.InitializationOptions.builder(context).createInitializationOptions() + ); + } catch (final UnsatisfiedLinkError e) { + throw new InitializationException(e); + } this.eglBase = EglBase.create(); this.context = context; mainHandler.post(() -> { @@ -555,7 +560,11 @@ public class WebRTCWrapper { static class InitializationException extends Exception { - private InitializationException(String message) { + private InitializationException(final Throwable throwable) { + super(throwable); + } + + private InitializationException(final String message) { super(message); } }