Add allowCodecSwitching flag to RTCConfiguration.mm

Bug: webrtc:10795
Change-Id: I4d645b077bc459b05ef16641defdbd240dbd1550
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159481
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29753}
diff --git a/sdk/objc/api/peerconnection/RTCConfiguration.h b/sdk/objc/api/peerconnection/RTCConfiguration.h
index 2c32311..13a51b9 100644
--- a/sdk/objc/api/peerconnection/RTCConfiguration.h
+++ b/sdk/objc/api/peerconnection/RTCConfiguration.h
@@ -194,6 +194,12 @@
  */
 @property(nonatomic, assign) BOOL activeResetSrtpParams;
 
+/** If the remote side support mid-stream codec switches then allow encoder
+ *  switching to be performed.
+ */
+
+@property(nonatomic, assign) BOOL allowCodecSwitching;
+
 /**
  * If MediaTransportFactory is provided in PeerConnectionFactory, this flag informs PeerConnection
  * that it should use the MediaTransportInterface.
diff --git a/sdk/objc/api/peerconnection/RTCConfiguration.mm b/sdk/objc/api/peerconnection/RTCConfiguration.mm
index c2ff8bf..7503a0a 100644
--- a/sdk/objc/api/peerconnection/RTCConfiguration.mm
+++ b/sdk/objc/api/peerconnection/RTCConfiguration.mm
@@ -52,6 +52,7 @@
 @synthesize sdpSemantics = _sdpSemantics;
 @synthesize turnCustomizer = _turnCustomizer;
 @synthesize activeResetSrtpParams = _activeResetSrtpParams;
+@synthesize allowCodecSwitching = _allowCodecSwitching;
 @synthesize useMediaTransport = _useMediaTransport;
 @synthesize useMediaTransportForDataChannels = _useMediaTransportForDataChannels;
 @synthesize cryptoOptions = _cryptoOptions;
@@ -138,6 +139,7 @@
     }
     _rtcpAudioReportIntervalMs = config.audio_rtcp_report_interval_ms();
     _rtcpVideoReportIntervalMs = config.video_rtcp_report_interval_ms();
+    _allowCodecSwitching = config.allow_codec_switching.value_or(false);
   }
   return self;
 }
@@ -274,6 +276,7 @@
   }
   nativeConfig->set_audio_rtcp_report_interval_ms(_rtcpAudioReportIntervalMs);
   nativeConfig->set_video_rtcp_report_interval_ms(_rtcpVideoReportIntervalMs);
+  nativeConfig->allow_codec_switching = _allowCodecSwitching;
   return nativeConfig.release();
 }