Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side 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: Rebase to master Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 1315
1316 if (enum_name == "RSA") 1316 if (enum_name == "RSA")
1317 return rtc::KT_RSA; 1317 return rtc::KT_RSA;
1318 if (enum_name == "ECDSA") 1318 if (enum_name == "ECDSA")
1319 return rtc::KT_ECDSA; 1319 return rtc::KT_ECDSA;
1320 1320
1321 RTC_CHECK(false) << "Unexpected KeyType enum_name " << enum_name; 1321 RTC_CHECK(false) << "Unexpected KeyType enum_name " << enum_name;
1322 return rtc::KT_ECDSA; 1322 return rtc::KT_ECDSA;
1323 } 1323 }
1324 1324
1325 static PeerConnectionInterface::ContinualGatheringPolicy
1326 JavaContinualGatheringPolicyToNativeType(
1327 JNIEnv* jni, jobject j_gathering_policy) {
1328 std::string enum_name = GetJavaEnumName(
1329 jni, "org/webrtc/PeerConnection$ContinualGatheringPolicy",
1330 j_gathering_policy);
1331 if (enum_name == "GATHER_ONCE")
1332 return PeerConnectionInterface::GATHER_ONCE;
1333
1334 if (enum_name == "GATHER_CONTINUALLY")
1335 return PeerConnectionInterface::GATHER_CONTINUALLY;
1336
1337 RTC_CHECK(false) << "Unexpected ContinualGatheringPolicy enum name "
1338 << enum_name;
1339 return PeerConnectionInterface::GATHER_ONCE;
1340 }
1341
1325 static void JavaIceServersToJsepIceServers( 1342 static void JavaIceServersToJsepIceServers(
1326 JNIEnv* jni, jobject j_ice_servers, 1343 JNIEnv* jni, jobject j_ice_servers,
1327 PeerConnectionInterface::IceServers* ice_servers) { 1344 PeerConnectionInterface::IceServers* ice_servers) {
1328 jclass list_class = GetObjectClass(jni, j_ice_servers); 1345 jclass list_class = GetObjectClass(jni, j_ice_servers);
1329 jmethodID iterator_id = GetMethodID( 1346 jmethodID iterator_id = GetMethodID(
1330 jni, list_class, "iterator", "()Ljava/util/Iterator;"); 1347 jni, list_class, "iterator", "()Ljava/util/Iterator;");
1331 jobject iterator = jni->CallObjectMethod(j_ice_servers, iterator_id); 1348 jobject iterator = jni->CallObjectMethod(j_ice_servers, iterator_id);
1332 CHECK_EXCEPTION(jni) << "error during CallObjectMethod"; 1349 CHECK_EXCEPTION(jni) << "error during CallObjectMethod";
1333 jmethodID iterator_has_next = GetMethodID( 1350 jmethodID iterator_has_next = GetMethodID(
1334 jni, GetObjectClass(jni, iterator), "hasNext", "()Z"); 1351 jni, GetObjectClass(jni, iterator), "hasNext", "()Z");
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 jfieldID j_audio_jitter_buffer_fast_accelerate_id = GetFieldID( 1419 jfieldID j_audio_jitter_buffer_fast_accelerate_id = GetFieldID(
1403 jni, j_rtc_config_class, "audioJitterBufferFastAccelerate", "Z"); 1420 jni, j_rtc_config_class, "audioJitterBufferFastAccelerate", "Z");
1404 1421
1405 jfieldID j_ice_connection_receiving_timeout_id = 1422 jfieldID j_ice_connection_receiving_timeout_id =
1406 GetFieldID(jni, j_rtc_config_class, "iceConnectionReceivingTimeout", "I"); 1423 GetFieldID(jni, j_rtc_config_class, "iceConnectionReceivingTimeout", "I");
1407 1424
1408 jfieldID j_key_type_id = GetFieldID(jni, j_rtc_config_class, "keyType", 1425 jfieldID j_key_type_id = GetFieldID(jni, j_rtc_config_class, "keyType",
1409 "Lorg/webrtc/PeerConnection$KeyType;"); 1426 "Lorg/webrtc/PeerConnection$KeyType;");
1410 jobject j_key_type = GetObjectField(jni, j_rtc_config, j_key_type_id); 1427 jobject j_key_type = GetObjectField(jni, j_rtc_config, j_key_type_id);
1411 1428
1429 jfieldID j_continual_gathering_policy_id =
1430 GetFieldID(jni, j_rtc_config_class, "continualGatheringPolicy",
1431 "Lorg/webrtc/PeerConnection$ContinualGatheringPolicy;");
1432 jobject j_continual_gathering_policy =
1433 GetObjectField(jni, j_rtc_config, j_continual_gathering_policy_id);
1434
1412 PeerConnectionInterface::RTCConfiguration rtc_config; 1435 PeerConnectionInterface::RTCConfiguration rtc_config;
1413 rtc_config.type = 1436 rtc_config.type =
1414 JavaIceTransportsTypeToNativeType(jni, j_ice_transports_type); 1437 JavaIceTransportsTypeToNativeType(jni, j_ice_transports_type);
1415 rtc_config.bundle_policy = JavaBundlePolicyToNativeType(jni, j_bundle_policy); 1438 rtc_config.bundle_policy = JavaBundlePolicyToNativeType(jni, j_bundle_policy);
1416 rtc_config.rtcp_mux_policy = 1439 rtc_config.rtcp_mux_policy =
1417 JavaRtcpMuxPolicyToNativeType(jni, j_rtcp_mux_policy); 1440 JavaRtcpMuxPolicyToNativeType(jni, j_rtcp_mux_policy);
1418 rtc_config.tcp_candidate_policy = 1441 rtc_config.tcp_candidate_policy =
1419 JavaTcpCandidatePolicyToNativeType(jni, j_tcp_candidate_policy); 1442 JavaTcpCandidatePolicyToNativeType(jni, j_tcp_candidate_policy);
1420 JavaIceServersToJsepIceServers(jni, j_ice_servers, &rtc_config.servers); 1443 JavaIceServersToJsepIceServers(jni, j_ice_servers, &rtc_config.servers);
1421 rtc_config.audio_jitter_buffer_max_packets = 1444 rtc_config.audio_jitter_buffer_max_packets =
1422 GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id); 1445 GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id);
1423 rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField( 1446 rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField(
1424 jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id); 1447 jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id);
1425 rtc_config.ice_connection_receiving_timeout = 1448 rtc_config.ice_connection_receiving_timeout =
1426 GetIntField(jni, j_rtc_config, j_ice_connection_receiving_timeout_id); 1449 GetIntField(jni, j_rtc_config, j_ice_connection_receiving_timeout_id);
1450 rtc_config.continual_gathering_policy =
1451 JavaContinualGatheringPolicyToNativeType(
1452 jni, j_continual_gathering_policy);
1427 1453
1428 // Create ECDSA certificate. 1454 // Create ECDSA certificate.
1429 if (JavaKeyTypeToNativeType(jni, j_key_type) == rtc::KT_ECDSA) { 1455 if (JavaKeyTypeToNativeType(jni, j_key_type) == rtc::KT_ECDSA) {
1430 scoped_ptr<rtc::SSLIdentity> ssl_identity( 1456 scoped_ptr<rtc::SSLIdentity> ssl_identity(
1431 rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA)); 1457 rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA));
1432 if (ssl_identity.get()) { 1458 if (ssl_identity.get()) {
1433 rtc_config.certificates.push_back( 1459 rtc_config.certificates.push_back(
1434 rtc::RTCCertificate::Create(ssl_identity.Pass())); 1460 rtc::RTCCertificate::Create(ssl_identity.Pass()));
1435 LOG(LS_INFO) << "ECDSA certificate created."; 1461 LOG(LS_INFO) << "ECDSA certificate created.";
1436 } else { 1462 } else {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 rtc::scoped_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size))); 1848 rtc::scoped_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size)));
1823 stream->ReadAll(buffer.get(), log_size, &read, nullptr); 1849 stream->ReadAll(buffer.get(), log_size, &read, nullptr);
1824 1850
1825 jbyteArray result = jni->NewByteArray(read); 1851 jbyteArray result = jni->NewByteArray(read);
1826 jni->SetByteArrayRegion(result, 0, read, buffer.get()); 1852 jni->SetByteArrayRegion(result, 0, read, buffer.get());
1827 1853
1828 return result; 1854 return result;
1829 } 1855 }
1830 1856
1831 } // namespace webrtc_jni 1857 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/jni/classreferenceholder.cc ('k') | talk/app/webrtc/java/src/org/webrtc/PeerConnection.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698