diff --git a/build.gradle b/build.gradle index 42dd80af2..7d4b42dfe 100644 --- a/build.gradle +++ b/build.gradle @@ -80,7 +80,7 @@ dependencies { implementation 'com.google.guava:guava:31.1-android' quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.12.49' - implementation 'im.conversations.webrtc:webrtc-android:104.0.0' + implementation 'im.conversations.webrtc:webrtc-android:117.1.0' } ext { 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 5530a8c78..750d89369 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -2624,6 +2624,10 @@ public class JingleRtpConnection extends AbstractJingleConnection if (port < 0 || port > 65535) { continue; } + + + + if (Arrays.asList("stun", "stuns", "turn", "turns") .contains(type) && Arrays.asList("udp", "tcp").contains(transport)) { @@ -2635,20 +2639,22 @@ public class JingleRtpConnection extends AbstractJingleConnection + ": skipping invalid combination of udp/tls in external services"); continue; } - // TODO Starting on milestone 110, Chromium will perform - // stricter validation of TURN and STUN URLs passed to the - // constructor of an RTCPeerConnection. More specifically, - // STUN URLs will not support a query section, and TURN URLs - // will support only a transport parameter in their query - // section. + + // STUN URLs do not support a query section since M110 + final String uri; + if (Arrays.asList("stun","stuns").contains(type)) { + uri = String.format("%s:%s%s", type, IP.wrapIPv6(host),port); + } else { + uri = String.format( + "%s:%s:%s?transport=%s", + type, + IP.wrapIPv6(host), + port, + transport); + } + final PeerConnection.IceServer.Builder iceServerBuilder = - PeerConnection.IceServer.builder( - String.format( - "%s:%s:%s?transport=%s", - type, - IP.wrapIPv6(host), - port, - transport)); + PeerConnection.IceServer.builder(uri); iceServerBuilder.setTlsCertPolicy( PeerConnection.TlsCertPolicy .TLS_CERT_POLICY_INSECURE_NO_CHECK); 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 08154260a..3c32f44a2 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java @@ -33,12 +33,12 @@ import org.webrtc.SdpObserver; import org.webrtc.SessionDescription; import org.webrtc.VideoTrack; import org.webrtc.audio.JavaAudioDeviceModule; -import org.webrtc.voiceengine.WebRtcAudioEffects; import java.util.LinkedList; import java.util.List; import java.util.Queue; import java.util.Set; +import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicBoolean; @@ -260,9 +260,7 @@ public class WebRTCWrapper { Preconditions.checkNotNull(media); Preconditions.checkArgument( media.size() > 0, "media can not be empty when initializing peer connection"); - final boolean setUseHardwareAcousticEchoCanceler = - WebRtcAudioEffects.canUseAcousticEchoCanceler() - && !HARDWARE_AEC_BLACKLIST.contains(Build.MODEL); + final boolean setUseHardwareAcousticEchoCanceler = !HARDWARE_AEC_BLACKLIST.contains(Build.MODEL); Log.d( Config.LOGTAG, String.format( @@ -574,11 +572,7 @@ public class WebRTCWrapper { new SetSdpObserver() { @Override public void onSetSuccess() { - final SessionDescription description = - peerConnection.getLocalDescription(); - Log.d(EXTENDED_LOGGING_TAG, "set local description:"); - logDescription(description); - future.set(description); + future.setFuture(getLocalDescriptionFuture()); } @Override @@ -592,6 +586,15 @@ public class WebRTCWrapper { MoreExecutors.directExecutor()); } + private ListenableFuture getLocalDescriptionFuture() { + return Futures.submit(() -> { + final SessionDescription description = requirePeerConnection().getLocalDescription(); + Log.d(EXTENDED_LOGGING_TAG, "local description:"); + logDescription(description); + return description; + },executorService); + } + public static void logDescription(final SessionDescription sessionDescription) { for (final String line : sessionDescription.description.split(