From 228900f8b1e0f091daa4a2a55301fb4216354781 Mon Sep 17 00:00:00 2001 From: Jonas Oreland Date: Wed, 28 Aug 2019 09:08:58 +0200 Subject: [PATCH] Add TURN_LOGGING_ID to android sdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds support for setting the TURN_LOGGING_ID in RTCConfig using the android SDK. TURN_LOGGING_ID was added to webrtc in https://webrtc-review.googlesource.com/c/src/+/149829 The intended usage of this attribute is to correlate client and backend logs. bug: webrtc:10897 Change-Id: Ifd62e0f1dac396942c76a794bf7a75553d3244b7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150538 Reviewed-by: Sami Kalliomäki Commit-Queue: Jonas Oreland Cr-Commit-Position: refs/heads/master@{#28996} --- sdk/android/api/org/webrtc/PeerConnection.java | 14 ++++++++++++++ sdk/android/src/jni/pc/peer_connection.cc | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/sdk/android/api/org/webrtc/PeerConnection.java b/sdk/android/api/org/webrtc/PeerConnection.java index e1243b93cb..7317573f03 100644 --- a/sdk/android/api/org/webrtc/PeerConnection.java +++ b/sdk/android/api/org/webrtc/PeerConnection.java @@ -558,6 +558,13 @@ public class PeerConnection { */ @Nullable public CryptoOptions cryptoOptions; + /** + * An optional string that if set will be attached to the + * TURN_ALLOCATE_REQUEST which can be used to correlate client + * logs with backend logs + */ + @Nullable public String turnLoggingId; + // TODO(deadbeef): Instead of duplicating the defaults here, we should do // something to pick up the defaults from C++. The Objective-C equivalent // of RTCConfiguration does that. @@ -601,6 +608,7 @@ public class PeerConnection { useMediaTransport = false; useMediaTransportForDataChannels = false; cryptoOptions = null; + turnLoggingId = null; } @CalledByNative("RTCConfiguration") @@ -820,6 +828,12 @@ public class PeerConnection { CryptoOptions getCryptoOptions() { return cryptoOptions; } + + @Nullable + @CalledByNative("RTCConfiguration") + String getTurnLoggingId() { + return turnLoggingId; + } }; private final List localStreams = new ArrayList<>(); diff --git a/sdk/android/src/jni/pc/peer_connection.cc b/sdk/android/src/jni/pc/peer_connection.cc index 45021760cc..c95e576bd8 100644 --- a/sdk/android/src/jni/pc/peer_connection.cc +++ b/sdk/android/src/jni/pc/peer_connection.cc @@ -274,6 +274,12 @@ void JavaToNativeRTCConfiguration( j_rtc_config); rtc_config->crypto_options = JavaToNativeOptionalCryptoOptions(jni, j_crypto_options); + + ScopedJavaLocalRef j_turn_logging_id = + Java_RTCConfiguration_getTurnLoggingId(jni, j_rtc_config); + if (!IsNull(jni, j_turn_logging_id)) { + rtc_config->turn_logging_id = JavaToNativeString(jni, j_turn_logging_id); + } } rtc::KeyType GetRtcConfigKeyType(JNIEnv* env,