Add android bindings for PeerConnectionState.

This change makes it possible for android apps to use the new standards-compliant PeerConnectionState.

Bug: webrtc:9977
Change-Id: Iad19c38e664a59e86879715ec7a04a59a9894bee
Reviewed-on: https://webrtc-review.googlesource.com/c/109883
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25652}
This commit is contained in:
Jonas Olsson
2018-11-08 15:19:04 +01:00
committed by Commit Bot
parent 586725dc9a
commit f01d8c8d92
7 changed files with 149 additions and 10 deletions

View File

@ -50,6 +50,21 @@ public class PeerConnection {
}
}
/** Tracks PeerConnectionInterface::PeerConnectionState */
public enum PeerConnectionState {
NEW,
CONNECTING,
CONNECTED,
DISCONNECTED,
FAILED,
CLOSED;
@CalledByNative("PeerConnectionState")
static PeerConnectionState fromNativeIndex(int nativeIndex) {
return values()[nativeIndex];
}
}
/** Tracks PeerConnectionInterface::TlsCertPolicy */
public enum TlsCertPolicy {
TLS_CERT_POLICY_SECURE,
@ -79,6 +94,10 @@ public class PeerConnection {
/** Triggered when the IceConnectionState changes. */
@CalledByNative("Observer") void onIceConnectionChange(IceConnectionState newState);
/** Triggered when the PeerConnectionState changes. */
@CalledByNative("Observer")
default void onConnectionChange(PeerConnectionState newState) {}
/** Triggered when the ICE connection receiving status changes. */
@CalledByNative("Observer") void onIceConnectionReceivingChange(boolean receiving);
@ -1093,6 +1112,10 @@ public class PeerConnection {
return nativeIceConnectionState();
}
public PeerConnectionState connectionState() {
return nativeConnectionState();
}
public IceGatheringState iceGatheringState() {
return nativeIceGatheringState();
}
@ -1167,6 +1190,7 @@ public class PeerConnection {
private native boolean nativeSetBitrate(Integer min, Integer current, Integer max);
private native SignalingState nativeSignalingState();
private native IceConnectionState nativeIceConnectionState();
private native PeerConnectionState nativeConnectionState();
private native IceGatheringState nativeIceGatheringState();
private native void nativeClose();
private static native long nativeCreatePeerConnectionObserver(Observer observer);