From 92d12707e00837a978485f731d72ef30cf19d2a2 Mon Sep 17 00:00:00 2001 From: Yura Yaroshevich Date: Sat, 6 Mar 2021 23:55:17 +0300 Subject: [PATCH] Expose PeerConnection.restartIce in iOS SDK. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: None Change-Id: I76b95b3182e6b384fd68aecf4210c23459f76d2b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/209709 Reviewed-by: Kári Helgason Commit-Queue: Yura Yaroshevich Cr-Commit-Position: refs/heads/master@{#33402} --- sdk/objc/api/peerconnection/RTCPeerConnection.h | 6 ++++++ sdk/objc/api/peerconnection/RTCPeerConnection.mm | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/sdk/objc/api/peerconnection/RTCPeerConnection.h b/sdk/objc/api/peerconnection/RTCPeerConnection.h index b33cef04bf..77a8dccac1 100644 --- a/sdk/objc/api/peerconnection/RTCPeerConnection.h +++ b/sdk/objc/api/peerconnection/RTCPeerConnection.h @@ -285,6 +285,12 @@ RTC_OBJC_EXPORT addTransceiverOfType:(RTCRtpMediaType)mediaType init:(RTC_OBJC_TYPE(RTCRtpTransceiverInit) *)init; +/** Tells the PeerConnection that ICE should be restarted. This triggers a need + * for negotiation and subsequent offerForConstraints:completionHandler call will act as if + * RTCOfferAnswerOptions::ice_restart is true. + */ +- (void)restartIce; + /** Generate an SDP offer. */ - (void)offerForConstraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints completionHandler:(nullable void (^)(RTC_OBJC_TYPE(RTCSessionDescription) * _Nullable sdp, diff --git a/sdk/objc/api/peerconnection/RTCPeerConnection.mm b/sdk/objc/api/peerconnection/RTCPeerConnection.mm index 59fcd0ca93..e3ab65ae30 100644 --- a/sdk/objc/api/peerconnection/RTCPeerConnection.mm +++ b/sdk/objc/api/peerconnection/RTCPeerConnection.mm @@ -537,6 +537,10 @@ void PeerConnectionDelegateAdapter::OnRemoveTrack( nativeRtpTransceiver:nativeTransceiverOrError.MoveValue()]; } +- (void)restartIce { + _peerConnection->RestartIce(); +} + - (void)offerForConstraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints completionHandler:(void (^)(RTC_OBJC_TYPE(RTCSessionDescription) * sessionDescription, NSError *error))completionHandler {