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

Side by Side Diff: webrtc/api/java/jni/peerconnection_jni.cc

Issue 1987833002: Add a flag to filter out high-cost networks. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: merge with head Created 4 years, 6 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 * Copyright 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 if (enum_name == "ENABLED") 1437 if (enum_name == "ENABLED")
1438 return PeerConnectionInterface::kTcpCandidatePolicyEnabled; 1438 return PeerConnectionInterface::kTcpCandidatePolicyEnabled;
1439 1439
1440 if (enum_name == "DISABLED") 1440 if (enum_name == "DISABLED")
1441 return PeerConnectionInterface::kTcpCandidatePolicyDisabled; 1441 return PeerConnectionInterface::kTcpCandidatePolicyDisabled;
1442 1442
1443 RTC_CHECK(false) << "Unexpected TcpCandidatePolicy enum_name " << enum_name; 1443 RTC_CHECK(false) << "Unexpected TcpCandidatePolicy enum_name " << enum_name;
1444 return PeerConnectionInterface::kTcpCandidatePolicyEnabled; 1444 return PeerConnectionInterface::kTcpCandidatePolicyEnabled;
1445 } 1445 }
1446 1446
1447 static PeerConnectionInterface::CandidateNetworkPolicy
1448 JavaCandidateNetworkPolicyToNativeType(JNIEnv* jni,
1449 jobject j_candidate_network_policy) {
1450 std::string enum_name =
1451 GetJavaEnumName(jni, "org/webrtc/PeerConnection$CandidateNetworkPolicy",
1452 j_candidate_network_policy);
1453
1454 if (enum_name == "ALL")
1455 return PeerConnectionInterface::kCandidateNetworkPolicyAll;
1456
1457 if (enum_name == "LOW_COST")
1458 return PeerConnectionInterface::kCandidateNetworkPolicyLowCost;
1459
1460 RTC_CHECK(false) << "Unexpected CandidateNetworkPolicy enum_name "
1461 << enum_name;
1462 return PeerConnectionInterface::kCandidateNetworkPolicyAll;
1463 }
1464
1447 static rtc::KeyType JavaKeyTypeToNativeType(JNIEnv* jni, jobject j_key_type) { 1465 static rtc::KeyType JavaKeyTypeToNativeType(JNIEnv* jni, jobject j_key_type) {
1448 std::string enum_name = GetJavaEnumName( 1466 std::string enum_name = GetJavaEnumName(
1449 jni, "org/webrtc/PeerConnection$KeyType", j_key_type); 1467 jni, "org/webrtc/PeerConnection$KeyType", j_key_type);
1450 1468
1451 if (enum_name == "RSA") 1469 if (enum_name == "RSA")
1452 return rtc::KT_RSA; 1470 return rtc::KT_RSA;
1453 if (enum_name == "ECDSA") 1471 if (enum_name == "ECDSA")
1454 return rtc::KT_ECDSA; 1472 return rtc::KT_ECDSA;
1455 1473
1456 RTC_CHECK(false) << "Unexpected KeyType enum_name " << enum_name; 1474 RTC_CHECK(false) << "Unexpected KeyType enum_name " << enum_name;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 "Lorg/webrtc/PeerConnection$RtcpMuxPolicy;"); 1540 "Lorg/webrtc/PeerConnection$RtcpMuxPolicy;");
1523 jobject j_rtcp_mux_policy = GetObjectField( 1541 jobject j_rtcp_mux_policy = GetObjectField(
1524 jni, j_rtc_config, j_rtcp_mux_policy_id); 1542 jni, j_rtc_config, j_rtcp_mux_policy_id);
1525 1543
1526 jfieldID j_tcp_candidate_policy_id = GetFieldID( 1544 jfieldID j_tcp_candidate_policy_id = GetFieldID(
1527 jni, j_rtc_config_class, "tcpCandidatePolicy", 1545 jni, j_rtc_config_class, "tcpCandidatePolicy",
1528 "Lorg/webrtc/PeerConnection$TcpCandidatePolicy;"); 1546 "Lorg/webrtc/PeerConnection$TcpCandidatePolicy;");
1529 jobject j_tcp_candidate_policy = GetObjectField( 1547 jobject j_tcp_candidate_policy = GetObjectField(
1530 jni, j_rtc_config, j_tcp_candidate_policy_id); 1548 jni, j_rtc_config, j_tcp_candidate_policy_id);
1531 1549
1550 jfieldID j_candidate_network_policy_id = GetFieldID(
1551 jni, j_rtc_config_class, "candidateNetworkPolicy",
1552 "Lorg/webrtc/PeerConnection$CandidateNetworkPolicy;");
1553 jobject j_candidate_network_policy = GetObjectField(
1554 jni, j_rtc_config, j_candidate_network_policy_id);
1555
1532 jfieldID j_ice_servers_id = GetFieldID( 1556 jfieldID j_ice_servers_id = GetFieldID(
1533 jni, j_rtc_config_class, "iceServers", "Ljava/util/List;"); 1557 jni, j_rtc_config_class, "iceServers", "Ljava/util/List;");
1534 jobject j_ice_servers = GetObjectField(jni, j_rtc_config, j_ice_servers_id); 1558 jobject j_ice_servers = GetObjectField(jni, j_rtc_config, j_ice_servers_id);
1535 1559
1536 jfieldID j_audio_jitter_buffer_max_packets_id = 1560 jfieldID j_audio_jitter_buffer_max_packets_id =
1537 GetFieldID(jni, j_rtc_config_class, "audioJitterBufferMaxPackets", "I"); 1561 GetFieldID(jni, j_rtc_config_class, "audioJitterBufferMaxPackets", "I");
1538 jfieldID j_audio_jitter_buffer_fast_accelerate_id = GetFieldID( 1562 jfieldID j_audio_jitter_buffer_fast_accelerate_id = GetFieldID(
1539 jni, j_rtc_config_class, "audioJitterBufferFastAccelerate", "Z"); 1563 jni, j_rtc_config_class, "audioJitterBufferFastAccelerate", "Z");
1540 1564
1541 jfieldID j_ice_connection_receiving_timeout_id = 1565 jfieldID j_ice_connection_receiving_timeout_id =
(...skipping 12 matching lines...) Expand all
1554 GetFieldID(jni, j_rtc_config_class, "iceCandidatePoolSize", "I"); 1578 GetFieldID(jni, j_rtc_config_class, "iceCandidatePoolSize", "I");
1555 1579
1556 rtc_config->type = 1580 rtc_config->type =
1557 JavaIceTransportsTypeToNativeType(jni, j_ice_transports_type); 1581 JavaIceTransportsTypeToNativeType(jni, j_ice_transports_type);
1558 rtc_config->bundle_policy = 1582 rtc_config->bundle_policy =
1559 JavaBundlePolicyToNativeType(jni, j_bundle_policy); 1583 JavaBundlePolicyToNativeType(jni, j_bundle_policy);
1560 rtc_config->rtcp_mux_policy = 1584 rtc_config->rtcp_mux_policy =
1561 JavaRtcpMuxPolicyToNativeType(jni, j_rtcp_mux_policy); 1585 JavaRtcpMuxPolicyToNativeType(jni, j_rtcp_mux_policy);
1562 rtc_config->tcp_candidate_policy = 1586 rtc_config->tcp_candidate_policy =
1563 JavaTcpCandidatePolicyToNativeType(jni, j_tcp_candidate_policy); 1587 JavaTcpCandidatePolicyToNativeType(jni, j_tcp_candidate_policy);
1588 rtc_config->candidate_network_policy =
1589 JavaCandidateNetworkPolicyToNativeType(jni, j_candidate_network_policy);
1564 JavaIceServersToJsepIceServers(jni, j_ice_servers, &rtc_config->servers); 1590 JavaIceServersToJsepIceServers(jni, j_ice_servers, &rtc_config->servers);
1565 rtc_config->audio_jitter_buffer_max_packets = 1591 rtc_config->audio_jitter_buffer_max_packets =
1566 GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id); 1592 GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id);
1567 rtc_config->audio_jitter_buffer_fast_accelerate = GetBooleanField( 1593 rtc_config->audio_jitter_buffer_fast_accelerate = GetBooleanField(
1568 jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id); 1594 jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id);
1569 rtc_config->ice_connection_receiving_timeout = 1595 rtc_config->ice_connection_receiving_timeout =
1570 GetIntField(jni, j_rtc_config, j_ice_connection_receiving_timeout_id); 1596 GetIntField(jni, j_rtc_config, j_ice_connection_receiving_timeout_id);
1571 rtc_config->ice_backup_candidate_pair_ping_interval = GetIntField( 1597 rtc_config->ice_backup_candidate_pair_ping_interval = GetIntField(
1572 jni, j_rtc_config, j_ice_backup_candidate_pair_ping_interval_id); 1598 jni, j_rtc_config, j_ice_backup_candidate_pair_ping_interval_id);
1573 rtc_config->continual_gathering_policy = 1599 rtc_config->continual_gathering_policy =
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
2252 return JavaStringFromStdString( 2278 return JavaStringFromStdString(
2253 jni, 2279 jni,
2254 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); 2280 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id());
2255 } 2281 }
2256 2282
2257 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { 2283 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) {
2258 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); 2284 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release();
2259 } 2285 }
2260 2286
2261 } // namespace webrtc_jni 2287 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/api/java/jni/classreferenceholder.cc ('k') | webrtc/api/java/src/org/webrtc/PeerConnection.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698