Added allow_codec_switching parameter to RTCConfig.

Bug: webrtc:10795
Change-Id: I5507f1d801e262223bd18198c685b5fffa644b0b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157891
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29612}
diff --git a/sdk/android/api/org/webrtc/PeerConnection.java b/sdk/android/api/org/webrtc/PeerConnection.java
index b981520..e675d13 100644
--- a/sdk/android/api/org/webrtc/PeerConnection.java
+++ b/sdk/android/api/org/webrtc/PeerConnection.java
@@ -548,6 +548,11 @@
     // every offer/answer negotiation.This is only intended to be a workaround for crbug.com/835958
     public boolean activeResetSrtpParams;
 
+    // Whether this client is allowed to switch encoding codec mid-stream. This is a workaround for
+    // a WebRTC bug where the receiver could get confussed if a codec switch happened mid-call.
+    // Null indicates no change to currently configured value.
+    @Nullable public Boolean allowCodecSwitching;
+
     /*
      * Experimental flag that enables a use of media transport. If this is true, the media transport
      * factory MUST be provided to the PeerConnectionFactory.
@@ -619,6 +624,7 @@
       useMediaTransportForDataChannels = false;
       cryptoOptions = null;
       turnLoggingId = null;
+      allowCodecSwitching = null;
     }
 
     @CalledByNative("RTCConfiguration")
@@ -828,6 +834,12 @@
       return activeResetSrtpParams;
     }
 
+    @Nullable
+    @CalledByNative("RTCConfiguration")
+    Boolean getAllowCodecSwitching() {
+      return allowCodecSwitching;
+    }
+
     @CalledByNative("RTCConfiguration")
     boolean getUseMediaTransport() {
       return useMediaTransport;