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

@ -299,6 +299,14 @@ void PeerConnectionObserverJni::OnIceConnectionChange(
Java_IceConnectionState_fromNativeIndex(env, new_state));
}
void PeerConnectionObserverJni::OnConnectionChange(
PeerConnectionInterface::PeerConnectionState new_state) {
JNIEnv* env = AttachCurrentThreadIfNeeded();
Java_Observer_onConnectionChange(env, j_observer_global_,
Java_PeerConnectionState_fromNativeIndex(
env, static_cast<int>(new_state)));
}
void PeerConnectionObserverJni::OnIceConnectionReceivingChange(bool receiving) {
JNIEnv* env = AttachCurrentThreadIfNeeded();
Java_Observer_onIceConnectionReceivingChange(env, j_observer_global_,
@ -752,6 +760,14 @@ static ScopedJavaLocalRef<jobject> JNI_PeerConnection_IceConnectionState(
env, ExtractNativePC(env, j_pc)->ice_connection_state());
}
static ScopedJavaLocalRef<jobject> JNI_PeerConnection_ConnectionState(
JNIEnv* env,
const JavaParamRef<jobject>& j_pc) {
return Java_PeerConnectionState_fromNativeIndex(
env,
static_cast<int>(ExtractNativePC(env, j_pc)->peer_connection_state()));
}
static ScopedJavaLocalRef<jobject> JNI_PeerConnection_IceGatheringState(
JNIEnv* env,
const JavaParamRef<jobject>& j_pc) {

View File

@ -51,6 +51,8 @@ class PeerConnectionObserverJni : public PeerConnectionObserver {
PeerConnectionInterface::SignalingState new_state) override;
void OnIceConnectionChange(
PeerConnectionInterface::IceConnectionState new_state) override;
void OnConnectionChange(
PeerConnectionInterface::PeerConnectionState new_state) override;
void OnIceConnectionReceivingChange(bool receiving) override;
void OnIceGatheringChange(
PeerConnectionInterface::IceGatheringState new_state) override;