From d8d9ac3962441ea53492f388ced636e01af5ec4a Mon Sep 17 00:00:00 2001 From: Yura Yaroshevich Date: Mon, 22 Mar 2021 12:46:47 +0300 Subject: [PATCH] Expose restartIce in SDK for Android. PC.restartIce() is part of perfect negotiation algorithm. Bug: webrtc:12609 Change-Id: I21a0f8637e92e13ee2653ef477d0cd22a32bf9c6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212645 Reviewed-by: Tommi Commit-Queue: Tommi Cr-Commit-Position: refs/heads/master@{#33589} --- sdk/android/api/org/webrtc/PeerConnection.java | 8 ++++++++ sdk/android/src/jni/pc/peer_connection.cc | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/sdk/android/api/org/webrtc/PeerConnection.java b/sdk/android/api/org/webrtc/PeerConnection.java index 920e2f12c9..030b3a7f32 100644 --- a/sdk/android/api/org/webrtc/PeerConnection.java +++ b/sdk/android/api/org/webrtc/PeerConnection.java @@ -866,6 +866,13 @@ public class PeerConnection { nativeSetRemoteDescription(observer, sdp); } + /** + * Tells the PeerConnection that ICE should be restarted. + */ + public void restartIce() { + nativeRestartIce(); + } + /** * Enables/disables playout of received audio streams. Enabled by default. * @@ -1242,6 +1249,7 @@ public class PeerConnection { private native void nativeCreateAnswer(SdpObserver observer, MediaConstraints constraints); private native void nativeSetLocalDescription(SdpObserver observer, SessionDescription sdp); private native void nativeSetRemoteDescription(SdpObserver observer, SessionDescription sdp); + private native void nativeRestartIce(); private native void nativeSetAudioPlayout(boolean playout); private native void nativeSetAudioRecording(boolean recording); private native boolean nativeSetBitrate(Integer min, Integer current, Integer max); diff --git a/sdk/android/src/jni/pc/peer_connection.cc b/sdk/android/src/jni/pc/peer_connection.cc index 6706782e34..caa8864f85 100644 --- a/sdk/android/src/jni/pc/peer_connection.cc +++ b/sdk/android/src/jni/pc/peer_connection.cc @@ -588,6 +588,11 @@ static void JNI_PeerConnection_SetRemoteDescription( observer, JavaToNativeSessionDescription(jni, j_sdp).release()); } +static void JNI_PeerConnection_RestartIce(JNIEnv* jni, + const JavaParamRef& j_pc) { + ExtractNativePC(jni, j_pc)->RestartIce(); +} + static void JNI_PeerConnection_SetAudioPlayout( JNIEnv* jni, const JavaParamRef& j_pc,