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

Side by Side Diff: webrtc/sdk/android/src/jni/peerconnection_jni.cc

Issue 2557803002: Add disabled certificate check support to IceServer PeerConnection API. (Closed)
Patch Set: Get rid of tlsOpts unused warning once and for all by actually using it. Created 4 years 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
« no previous file with comments | « webrtc/sdk/android/src/jni/classreferenceholder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 return PeerConnectionInterface::GATHER_ONCE; 1559 return PeerConnectionInterface::GATHER_ONCE;
1560 1560
1561 if (enum_name == "GATHER_CONTINUALLY") 1561 if (enum_name == "GATHER_CONTINUALLY")
1562 return PeerConnectionInterface::GATHER_CONTINUALLY; 1562 return PeerConnectionInterface::GATHER_CONTINUALLY;
1563 1563
1564 RTC_CHECK(false) << "Unexpected ContinualGatheringPolicy enum name " 1564 RTC_CHECK(false) << "Unexpected ContinualGatheringPolicy enum name "
1565 << enum_name; 1565 << enum_name;
1566 return PeerConnectionInterface::GATHER_ONCE; 1566 return PeerConnectionInterface::GATHER_ONCE;
1567 } 1567 }
1568 1568
1569 static PeerConnectionInterface::TlsCertPolicy JavaTlsCertPolicyTypeToNativeType(
1570 JNIEnv* jni,
1571 jobject j_ice_server_tls_cert_policy) {
1572 std::string enum_name =
1573 GetJavaEnumName(jni, "org/webrtc/PeerConnection$TlsCertPolicy",
1574 j_ice_server_tls_cert_policy);
1575
1576 if (enum_name == "TLS_CERT_POLICY_SECURE")
1577 return PeerConnectionInterface::kTlsCertPolicySecure;
1578
1579 if (enum_name == "TLS_CERT_POLICY_INSECURE_NO_CHECK")
1580 return PeerConnectionInterface::kTlsCertPolicyInsecureNoCheck;
1581
1582 RTC_CHECK(false) << "Unexpected TlsCertPolicy enum_name " << enum_name;
1583 return PeerConnectionInterface::kTlsCertPolicySecure;
1584 }
1585
1569 static void JavaIceServersToJsepIceServers( 1586 static void JavaIceServersToJsepIceServers(
1570 JNIEnv* jni, jobject j_ice_servers, 1587 JNIEnv* jni, jobject j_ice_servers,
1571 PeerConnectionInterface::IceServers* ice_servers) { 1588 PeerConnectionInterface::IceServers* ice_servers) {
1572 for (jobject j_ice_server : Iterable(jni, j_ice_servers)) { 1589 for (jobject j_ice_server : Iterable(jni, j_ice_servers)) {
1573 jclass j_ice_server_class = GetObjectClass(jni, j_ice_server); 1590 jclass j_ice_server_class = GetObjectClass(jni, j_ice_server);
1574 jfieldID j_ice_server_uri_id = 1591 jfieldID j_ice_server_uri_id =
1575 GetFieldID(jni, j_ice_server_class, "uri", "Ljava/lang/String;"); 1592 GetFieldID(jni, j_ice_server_class, "uri", "Ljava/lang/String;");
1576 jfieldID j_ice_server_username_id = 1593 jfieldID j_ice_server_username_id =
1577 GetFieldID(jni, j_ice_server_class, "username", "Ljava/lang/String;"); 1594 GetFieldID(jni, j_ice_server_class, "username", "Ljava/lang/String;");
1578 jfieldID j_ice_server_password_id = 1595 jfieldID j_ice_server_password_id =
1579 GetFieldID(jni, j_ice_server_class, "password", "Ljava/lang/String;"); 1596 GetFieldID(jni, j_ice_server_class, "password", "Ljava/lang/String;");
1597 jfieldID j_ice_server_tls_cert_policy_id =
1598 GetFieldID(jni, j_ice_server_class, "tlsCertPolicy",
1599 "Lorg/webrtc/PeerConnection$TlsCertPolicy;");
1600 jobject j_ice_server_tls_cert_policy =
1601 GetObjectField(jni, j_ice_server, j_ice_server_tls_cert_policy_id);
1580 jstring uri = reinterpret_cast<jstring>( 1602 jstring uri = reinterpret_cast<jstring>(
1581 GetObjectField(jni, j_ice_server, j_ice_server_uri_id)); 1603 GetObjectField(jni, j_ice_server, j_ice_server_uri_id));
1582 jstring username = reinterpret_cast<jstring>( 1604 jstring username = reinterpret_cast<jstring>(
1583 GetObjectField(jni, j_ice_server, j_ice_server_username_id)); 1605 GetObjectField(jni, j_ice_server, j_ice_server_username_id));
1584 jstring password = reinterpret_cast<jstring>( 1606 jstring password = reinterpret_cast<jstring>(
1585 GetObjectField(jni, j_ice_server, j_ice_server_password_id)); 1607 GetObjectField(jni, j_ice_server, j_ice_server_password_id));
1608 PeerConnectionInterface::TlsCertPolicy tls_cert_policy =
1609 JavaTlsCertPolicyTypeToNativeType(jni, j_ice_server_tls_cert_policy);
1586 PeerConnectionInterface::IceServer server; 1610 PeerConnectionInterface::IceServer server;
1587 server.uri = JavaToStdString(jni, uri); 1611 server.uri = JavaToStdString(jni, uri);
1588 server.username = JavaToStdString(jni, username); 1612 server.username = JavaToStdString(jni, username);
1589 server.password = JavaToStdString(jni, password); 1613 server.password = JavaToStdString(jni, password);
1614 server.tls_cert_policy = tls_cert_policy;
1590 ice_servers->push_back(server); 1615 ice_servers->push_back(server);
1591 } 1616 }
1592 } 1617 }
1593 1618
1594 static void JavaRTCConfigurationToJsepRTCConfiguration( 1619 static void JavaRTCConfigurationToJsepRTCConfiguration(
1595 JNIEnv* jni, 1620 JNIEnv* jni,
1596 jobject j_rtc_config, 1621 jobject j_rtc_config,
1597 PeerConnectionInterface::RTCConfiguration* rtc_config) { 1622 PeerConnectionInterface::RTCConfiguration* rtc_config) {
1598 jclass j_rtc_config_class = GetObjectClass(jni, j_rtc_config); 1623 jclass j_rtc_config_class = GetObjectClass(jni, j_rtc_config);
1599 1624
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer) 2492 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)
2468 ->SetObserver(nullptr); 2493 ->SetObserver(nullptr);
2469 RtpReceiverObserver* observer = 2494 RtpReceiverObserver* observer =
2470 reinterpret_cast<RtpReceiverObserver*>(j_observer_pointer); 2495 reinterpret_cast<RtpReceiverObserver*>(j_observer_pointer);
2471 if (observer) { 2496 if (observer) {
2472 delete observer; 2497 delete observer;
2473 } 2498 }
2474 } 2499 }
2475 2500
2476 } // namespace webrtc_jni 2501 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/sdk/android/src/jni/classreferenceholder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698