Chromium Code Reviews

Unified Diff: talk/app/webrtc/java/jni/peerconnection_jni.cc

Issue 1369773003: Add a continual_gathering_policy in PeerConnection RTCConfiguration (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Addressed comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: talk/app/webrtc/java/jni/peerconnection_jni.cc
diff --git a/talk/app/webrtc/java/jni/peerconnection_jni.cc b/talk/app/webrtc/java/jni/peerconnection_jni.cc
index 8e274a4721e10b41d4cb44052160a467775da99e..916b3961e119cf3196305e8dcc190855ed0503b9 100644
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc
@@ -1322,6 +1322,23 @@ static rtc::KeyType JavaKeyTypeToNativeType(JNIEnv* jni, jobject j_key_type) {
return rtc::KT_ECDSA;
}
+static PeerConnectionInterface::ContinuousGatheringPolicy
+ JavaContinuousGatheringPolicyToNativeType(
+ JNIEnv* jni, jobject j_gathering_policy) {
+ std::string enum_name = GetJavaEnumName(
+ jni, "org/webrtc/PeerConnection$ContinuousGatheringPolicy",
+ j_gathering_policy);
+ if (enum_name == "GATHERING_ONCE")
+ return PeerConnectionInterface::kGatheringOnce;
+
+ if (enum_name == "GATHERING_CONTINUOUSLY")
+ return PeerConnectionInterface::kGatheringContinuously;
+
+ RTC_CHECK(false) << "Unexpected ContinuousGatheringPolicy enum name "
+ << enum_name;
+ return PeerConnectionInterface::kGatheringOnce;
+}
+
static void JavaIceServersToJsepIceServers(
JNIEnv* jni, jobject j_ice_servers,
PeerConnectionInterface::IceServers* ice_servers) {
@@ -1409,6 +1426,12 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)(
"Lorg/webrtc/PeerConnection$KeyType;");
jobject j_key_type = GetObjectField(jni, j_rtc_config, j_key_type_id);
+ jfieldID j_continuous_gathering_policy_id =
+ GetFieldID(jni, j_rtc_config_class, "continuousGatheringPolicy",
+ "Lorg/webrtc/PeerConnection$ContinuousGatheringPolicy;");
+ jobject j_continuous_gathering_policy =
+ GetObjectField(jni, j_rtc_config, j_continuous_gathering_policy_id);
+
PeerConnectionInterface::RTCConfiguration rtc_config;
rtc_config.type =
JavaIceTransportsTypeToNativeType(jni, j_ice_transports_type);
@@ -1424,6 +1447,9 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)(
jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id);
rtc_config.ice_connection_receiving_timeout =
GetIntField(jni, j_rtc_config, j_ice_connection_receiving_timeout_id);
+ rtc_config.continuous_gathering_policy =
+ JavaContinuousGatheringPolicyToNativeType(
+ jni, j_continuous_gathering_policy);
// Create ECDSA certificate.
if (JavaKeyTypeToNativeType(jni, j_key_type) == rtc::KT_ECDSA) {

Powered by Google App Engine