From a12760300c2c48bb0a51acf05e05edbd191671e2 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 18 Apr 2020 21:27:50 +0200 Subject: [PATCH] ensure that rtp connection is registered with connection manager --- .../conversations/xmpp/jingle/JingleConnectionManager.java | 7 +++++++ .../conversations/xmpp/jingle/JingleRtpConnection.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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 4ec48b35b..2846fbfaf 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -513,6 +513,13 @@ public class JingleConnectionManager extends AbstractConnectionManager { } } + void ensureConnectionIsRegistered(final AbstractJingleConnection connection) { + if (connections.containsValue(connection)) { + return; + } + throw new IllegalStateException("JingleConnection has not been registered with connection manager"); + } + public enum DeviceDiscoveryState { SEARCHING, DISCOVERED, FAILED; 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 1c30ee9a5..121f894f2 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -846,7 +846,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web } private void setupWebRTC(final Set media, final List iceServers) throws WebRTCWrapper.InitializationException { - //TODO ensure registered with connection manager + this.jingleConnectionManager.ensureConnectionIsRegistered(this); final AppRTCAudioManager.SpeakerPhonePreference speakerPhonePreference; if (media.contains(Media.VIDEO)) { speakerPhonePreference = AppRTCAudioManager.SpeakerPhonePreference.SPEAKER;