From 90fab63b981d9e4ae0499dd8ddd4cf2884160a84 Mon Sep 17 00:00:00 2001 From: Yura Yaroshevich Date: Mon, 22 Mar 2021 17:10:33 +0300 Subject: [PATCH] Extended RTCConfiguration in Android SDK. "enableImplicitRollback" is necessary for perfect negotiation algorithm "offerExtmapAllowMixed" is necessary for backward compatibility with legacy clients. Bug: webrtc:12609 Change-Id: I30a5a01c519ca9080a346e2d36b58f7bab28f15a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212741 Reviewed-by: Tommi Commit-Queue: Tommi Cr-Commit-Position: refs/heads/master@{#33639} --- .../api/org/webrtc/PeerConnection.java | 25 +++++++++++++++++++ sdk/android/src/jni/pc/peer_connection.cc | 5 ++++ 2 files changed, 30 insertions(+) diff --git a/sdk/android/api/org/webrtc/PeerConnection.java b/sdk/android/api/org/webrtc/PeerConnection.java index 030b3a7f32..97c7e77958 100644 --- a/sdk/android/api/org/webrtc/PeerConnection.java +++ b/sdk/android/api/org/webrtc/PeerConnection.java @@ -550,6 +550,19 @@ public class PeerConnection { */ @Nullable public String turnLoggingId; + /** + * Allow implicit rollback of local description when remote description + * conflicts with local description. + * See: https://w3c.github.io/webrtc-pc/#dom-peerconnection-setremotedescription + */ + public boolean enableImplicitRollback; + + /** + * Control if "a=extmap-allow-mixed" is included in the offer. + * See: https://www.chromestatus.com/feature/6269234631933952 + */ + public boolean offerExtmapAllowMixed; + // 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. @@ -593,6 +606,8 @@ public class PeerConnection { cryptoOptions = null; turnLoggingId = null; allowCodecSwitching = null; + enableImplicitRollback = false; + offerExtmapAllowMixed = true; } @CalledByNative("RTCConfiguration") @@ -813,6 +828,16 @@ public class PeerConnection { String getTurnLoggingId() { return turnLoggingId; } + + @CalledByNative("RTCConfiguration") + boolean getEnableImplicitRollback() { + return enableImplicitRollback; + } + + @CalledByNative("RTCConfiguration") + boolean getOfferExtmapAllowMixed() { + return offerExtmapAllowMixed; + } }; 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 caa8864f85..106d6d1f9b 100644 --- a/sdk/android/src/jni/pc/peer_connection.cc +++ b/sdk/android/src/jni/pc/peer_connection.cc @@ -271,6 +271,11 @@ void JavaToNativeRTCConfiguration( rtc_config->allow_codec_switching = JavaToNativeOptionalBool( jni, Java_RTCConfiguration_getAllowCodecSwitching(jni, j_rtc_config)); + rtc_config->offer_extmap_allow_mixed = + Java_RTCConfiguration_getOfferExtmapAllowMixed(jni, j_rtc_config); + rtc_config->enable_implicit_rollback = + Java_RTCConfiguration_getEnableImplicitRollback(jni, j_rtc_config); + ScopedJavaLocalRef j_turn_logging_id = Java_RTCConfiguration_getTurnLoggingId(jni, j_rtc_config); if (!IsNull(jni, j_turn_logging_id)) {