diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 4be5671a5f..890c4f97dc 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -392,6 +392,7 @@ if (is_ios || is_mac) { "objc/Framework/Classes/PeerConnection/RTCAudioSource.mm", "objc/Framework/Classes/PeerConnection/RTCAudioTrack+Private.h", "objc/Framework/Classes/PeerConnection/RTCAudioTrack.mm", + "objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h", "objc/Framework/Classes/PeerConnection/RTCConfiguration+Private.h", "objc/Framework/Classes/PeerConnection/RTCConfiguration.mm", "objc/Framework/Classes/PeerConnection/RTCDataChannel+Private.h", diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h b/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h new file mode 100644 index 0000000000..f539d1ced7 --- /dev/null +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h @@ -0,0 +1,27 @@ +/* + * Copyright 2017 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#import "WebRTC/RTCConfiguration.h" + +#include "api/peerconnectioninterface.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface RTCConfiguration () + +/** Optional TurnCustomizer. + * With this class one can modify outgoing TURN messages. + * The object passed in must remain valid until PeerConnection::Close() is called. + */ +@property(nonatomic, nullable) webrtc::TurnCustomizer *turnCustomizer; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration.mm b/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration.mm index 17aed858aa..faf34d63d0 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration.mm +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration.mm @@ -12,6 +12,7 @@ #include +#import "RTCConfiguration+Native.h" #import "RTCIceServer+Private.h" #import "RTCIntervalRange+Private.h" #import "WebRTC/RTCLogging.h" @@ -41,6 +42,7 @@ _shouldPresumeWritableWhenFullyRelayed; @synthesize iceCheckMinInterval = _iceCheckMinInterval; @synthesize iceRegatherIntervalRange = _iceRegatherIntervalRange; +@synthesize turnCustomizer = _turnCustomizer; - (instancetype)init { // Copy defaults. @@ -92,6 +94,7 @@ _iceRegatherIntervalRange = [[RTCIntervalRange alloc] initWithNativeIntervalRange:nativeIntervalRange]; } + _turnCustomizer = config.turn_customizer; } return self; } @@ -178,6 +181,9 @@ nativeConfig->ice_regather_interval_range = rtc::Optional(*nativeIntervalRange); } + if (_turnCustomizer) { + nativeConfig->turn_customizer = _turnCustomizer; + } return nativeConfig.release(); }