OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 // call. In this file this is done in CHECK_EXCEPTION, making for much easier | 33 // call. In this file this is done in CHECK_EXCEPTION, making for much easier |
34 // debugging in case of failure (the alternative is to wait for control to | 34 // debugging in case of failure (the alternative is to wait for control to |
35 // return to the Java frame that called code in this file, at which point it's | 35 // return to the Java frame that called code in this file, at which point it's |
36 // impossible to tell which JNI call broke). | 36 // impossible to tell which JNI call broke). |
37 | 37 |
38 #include <jni.h> | 38 #include <jni.h> |
39 #undef JNIEXPORT | 39 #undef JNIEXPORT |
40 #define JNIEXPORT __attribute__((visibility("default"))) | 40 #define JNIEXPORT __attribute__((visibility("default"))) |
41 | 41 |
42 #include <limits> | 42 #include <limits> |
| 43 #include <memory> |
43 #include <utility> | 44 #include <utility> |
44 | 45 |
45 #include "webrtc/api/androidvideocapturer.h" | 46 #include "webrtc/api/androidvideocapturer.h" |
46 #include "webrtc/api/dtlsidentitystore.h" | 47 #include "webrtc/api/dtlsidentitystore.h" |
47 #include "webrtc/api/java/jni/androidmediadecoder_jni.h" | 48 #include "webrtc/api/java/jni/androidmediadecoder_jni.h" |
48 #include "webrtc/api/java/jni/androidmediaencoder_jni.h" | 49 #include "webrtc/api/java/jni/androidmediaencoder_jni.h" |
49 #include "webrtc/api/java/jni/androidnetworkmonitor_jni.h" | 50 #include "webrtc/api/java/jni/androidnetworkmonitor_jni.h" |
50 #include "webrtc/api/java/jni/androidvideocapturer_jni.h" | 51 #include "webrtc/api/java/jni/androidvideocapturer_jni.h" |
51 #include "webrtc/api/java/jni/classreferenceholder.h" | 52 #include "webrtc/api/java/jni/classreferenceholder.h" |
52 #include "webrtc/api/java/jni/jni_helpers.h" | 53 #include "webrtc/api/java/jni/jni_helpers.h" |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 PeerConnectionInterface::RTCConfiguration rtc_config; | 1559 PeerConnectionInterface::RTCConfiguration rtc_config; |
1559 JavaRTCConfigurationToJsepRTCConfiguration(jni, j_rtc_config, &rtc_config); | 1560 JavaRTCConfigurationToJsepRTCConfiguration(jni, j_rtc_config, &rtc_config); |
1560 | 1561 |
1561 jclass j_rtc_config_class = GetObjectClass(jni, j_rtc_config); | 1562 jclass j_rtc_config_class = GetObjectClass(jni, j_rtc_config); |
1562 jfieldID j_key_type_id = GetFieldID(jni, j_rtc_config_class, "keyType", | 1563 jfieldID j_key_type_id = GetFieldID(jni, j_rtc_config_class, "keyType", |
1563 "Lorg/webrtc/PeerConnection$KeyType;"); | 1564 "Lorg/webrtc/PeerConnection$KeyType;"); |
1564 jobject j_key_type = GetObjectField(jni, j_rtc_config, j_key_type_id); | 1565 jobject j_key_type = GetObjectField(jni, j_rtc_config, j_key_type_id); |
1565 | 1566 |
1566 // Create ECDSA certificate. | 1567 // Create ECDSA certificate. |
1567 if (JavaKeyTypeToNativeType(jni, j_key_type) == rtc::KT_ECDSA) { | 1568 if (JavaKeyTypeToNativeType(jni, j_key_type) == rtc::KT_ECDSA) { |
1568 scoped_ptr<rtc::SSLIdentity> ssl_identity( | 1569 std::unique_ptr<rtc::SSLIdentity> ssl_identity( |
1569 rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA)); | 1570 rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA)); |
1570 if (ssl_identity.get()) { | 1571 if (ssl_identity.get()) { |
1571 rtc_config.certificates.push_back( | 1572 rtc_config.certificates.push_back( |
1572 rtc::RTCCertificate::Create(std::move(ssl_identity))); | 1573 rtc::RTCCertificate::Create(std::move(ssl_identity))); |
1573 LOG(LS_INFO) << "ECDSA certificate created."; | 1574 LOG(LS_INFO) << "ECDSA certificate created."; |
1574 } else { | 1575 } else { |
1575 // Failing to create certificate should not abort peer connection | 1576 // Failing to create certificate should not abort peer connection |
1576 // creation. Instead default encryption (currently RSA) will be used. | 1577 // creation. Instead default encryption (currently RSA) will be used. |
1577 LOG(LS_WARNING) << | 1578 LOG(LS_WARNING) << |
1578 "Failed to generate SSLIdentity. Default encryption will be used."; | 1579 "Failed to generate SSLIdentity. Default encryption will be used."; |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2207 return JavaStringFromStdString( | 2208 return JavaStringFromStdString( |
2208 jni, | 2209 jni, |
2209 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2210 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2210 } | 2211 } |
2211 | 2212 |
2212 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2213 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2213 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2214 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2214 } | 2215 } |
2215 | 2216 |
2216 } // namespace webrtc_jni | 2217 } // namespace webrtc_jni |
OLD | NEW |