Surface the standardized ICE connection state to mobile clients.

This CL adds the callback on changes of the ICE connection state
following the standardized transitions
(https://www.w3.org/TR/webrtc/#dom-rtciceconnectionstate) to the
Android and the iOS SDKs.

Bug: None
Change-Id: I6133391fa54dd4e09016f29dddb85e4a0e270878
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138181
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Amit Hilbuch <amithi@webrtc.org>
Reviewed-by: Alex Glaznev <glaznev@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28127}
This commit is contained in:
Qingsi Wang
2019-05-29 11:37:26 -07:00
committed by Commit Bot
parent 2dbc627aa0
commit 36e3147b21
8 changed files with 80 additions and 2 deletions

View File

@ -39,6 +39,9 @@ class PeerConnectionDelegateAdapter : public PeerConnectionObserver {
void OnIceConnectionChange(PeerConnectionInterface::IceConnectionState new_state) override;
void OnStandardizedIceConnectionChange(
PeerConnectionInterface::IceConnectionState new_state) override;
void OnConnectionChange(PeerConnectionInterface::PeerConnectionState new_state) override;
void OnIceGatheringChange(PeerConnectionInterface::IceGatheringState new_state) override;

View File

@ -126,6 +126,11 @@ RTC_OBJC_EXPORT
* This is only called with RTCSdpSemanticsUnifiedPlan specified.
*/
@optional
/** Called any time the IceConnectionState changes following standardized
* transition. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didChangeStandardizedIceConnectionState:(RTCIceConnectionState)newState;
/** Called any time the PeerConnectionState changes. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didChangeConnectionState:(RTCPeerConnectionState)newState;

View File

@ -179,6 +179,16 @@ void PeerConnectionDelegateAdapter::OnIceConnectionChange(
[peer_connection_.delegate peerConnection:peer_connection_ didChangeIceConnectionState:state];
}
void PeerConnectionDelegateAdapter::OnStandardizedIceConnectionChange(
PeerConnectionInterface::IceConnectionState new_state) {
if ([peer_connection_.delegate
respondsToSelector:@selector(peerConnection:didChangeStandardizedIceConnectionState:)]) {
RTCIceConnectionState state = [RTCPeerConnection iceConnectionStateForNativeState:new_state];
[peer_connection_.delegate peerConnection:peer_connection_
didChangeStandardizedIceConnectionState:state];
}
}
void PeerConnectionDelegateAdapter::OnConnectionChange(
PeerConnectionInterface::PeerConnectionState new_state) {
if ([peer_connection_.delegate