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

Side by Side Diff: talk/app/webrtc/java/jni/peerconnection_jni.cc

Issue 1312293003: Add option to enable ECDSA key for Java API. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | 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 * 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #include "talk/app/webrtc/java/jni/androidvideocapturer_jni.h" 86 #include "talk/app/webrtc/java/jni/androidvideocapturer_jni.h"
87 #include "webrtc/modules/video_render/video_render_internal.h" 87 #include "webrtc/modules/video_render/video_render_internal.h"
88 #include "webrtc/system_wrappers/interface/logcat_trace_context.h" 88 #include "webrtc/system_wrappers/interface/logcat_trace_context.h"
89 using webrtc::LogcatTraceContext; 89 using webrtc::LogcatTraceContext;
90 #endif 90 #endif
91 91
92 using rtc::Bind; 92 using rtc::Bind;
93 using rtc::Thread; 93 using rtc::Thread;
94 using rtc::ThreadManager; 94 using rtc::ThreadManager;
95 using rtc::scoped_ptr; 95 using rtc::scoped_ptr;
96 using rtc::scoped_refptr;
96 using webrtc::AudioSourceInterface; 97 using webrtc::AudioSourceInterface;
97 using webrtc::AudioTrackInterface; 98 using webrtc::AudioTrackInterface;
98 using webrtc::AudioTrackVector; 99 using webrtc::AudioTrackVector;
99 using webrtc::CreateSessionDescriptionObserver; 100 using webrtc::CreateSessionDescriptionObserver;
100 using webrtc::DataBuffer; 101 using webrtc::DataBuffer;
101 using webrtc::DataChannelInit; 102 using webrtc::DataChannelInit;
102 using webrtc::DataChannelInterface; 103 using webrtc::DataChannelInterface;
103 using webrtc::DataChannelObserver; 104 using webrtc::DataChannelObserver;
104 using webrtc::IceCandidateInterface; 105 using webrtc::IceCandidateInterface;
105 using webrtc::MediaConstraintsInterface; 106 using webrtc::MediaConstraintsInterface;
(...skipping 12 matching lines...) Expand all
118 using webrtc::VideoSourceInterface; 119 using webrtc::VideoSourceInterface;
119 using webrtc::VideoTrackInterface; 120 using webrtc::VideoTrackInterface;
120 using webrtc::VideoTrackVector; 121 using webrtc::VideoTrackVector;
121 using webrtc::kVideoCodecVP8; 122 using webrtc::kVideoCodecVP8;
122 123
123 namespace webrtc_jni { 124 namespace webrtc_jni {
124 125
125 // Field trials initialization string 126 // Field trials initialization string
126 static char *field_trials_init_string = NULL; 127 static char *field_trials_init_string = NULL;
127 128
129 // ECSDA certificate
130 static scoped_refptr<rtc::RTCCertificate> g_rtc_certificate;
131
128 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) 132 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
129 // Set in PeerConnectionFactory_initializeAndroidGlobals(). 133 // Set in PeerConnectionFactory_initializeAndroidGlobals().
130 static bool factory_static_initialized = false; 134 static bool factory_static_initialized = false;
131 static bool vp8_hw_acceleration_enabled = true; 135 static bool vp8_hw_acceleration_enabled = true;
132 #endif 136 #endif
133 137
134 extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { 138 extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
139 LOG(LS_INFO) << "JNI_OnLoad";
135 jint ret = InitGlobalJniVariables(jvm); 140 jint ret = InitGlobalJniVariables(jvm);
136 if (ret < 0) 141 if (ret < 0)
137 return -1; 142 return -1;
138 143
139 CHECK(rtc::InitializeSSL()) << "Failed to InitializeSSL()"; 144 CHECK(rtc::InitializeSSL()) << "Failed to InitializeSSL()";
140 LoadGlobalClassReferenceHolder(); 145 LoadGlobalClassReferenceHolder();
141 146
147 scoped_ptr<rtc::SSLIdentity> ssl_identity(
148 rtc::SSLIdentity::Generate(std::string(), rtc::KT_ECDSA));
149 if (ssl_identity.get()) {
150 g_rtc_certificate = rtc::RTCCertificate::Create(ssl_identity.Pass());
jiayl2 2015/08/25 23:06:02 If the app runs for days or months, the certificat
AlexG 2015/08/25 23:15:26 ok. Should I call both rtc::SSLIdentity::Generate(
AlexG 2015/08/25 23:56:02 Done.
151 LOG(LS_INFO) << "ECDSA certificate created.";
152 } else {
153 LOG(LS_WARNING) << "Failed to generate SSLIdentity.";
154 }
155
142 return ret; 156 return ret;
143 } 157 }
144 158
145 extern "C" void JNIEXPORT JNICALL JNI_OnUnLoad(JavaVM *jvm, void *reserved) { 159 extern "C" void JNIEXPORT JNICALL JNI_OnUnLoad(JavaVM *jvm, void *reserved) {
146 FreeGlobalClassReferenceHolder(); 160 FreeGlobalClassReferenceHolder();
147 CHECK(rtc::CleanupSSL()) << "Failed to CleanupSSL()"; 161 CHECK(rtc::CleanupSSL()) << "Failed to CleanupSSL()";
148 } 162 }
149 163
150 // Return the (singleton) Java Enum object corresponding to |index|; 164 // Return the (singleton) Java Enum object corresponding to |index|;
151 // |state_class_fragment| is something like "MediaSource$State". 165 // |state_class_fragment| is something like "MediaSource$State".
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 rtc_config.bundle_policy = JavaBundlePolicyToNativeType(jni, j_bundle_policy); 1347 rtc_config.bundle_policy = JavaBundlePolicyToNativeType(jni, j_bundle_policy);
1334 rtc_config.rtcp_mux_policy = 1348 rtc_config.rtcp_mux_policy =
1335 JavaRtcpMuxPolicyToNativeType(jni, j_rtcp_mux_policy); 1349 JavaRtcpMuxPolicyToNativeType(jni, j_rtcp_mux_policy);
1336 rtc_config.tcp_candidate_policy = 1350 rtc_config.tcp_candidate_policy =
1337 JavaTcpCandidatePolicyToNativeType(jni, j_tcp_candidate_policy); 1351 JavaTcpCandidatePolicyToNativeType(jni, j_tcp_candidate_policy);
1338 JavaIceServersToJsepIceServers(jni, j_ice_servers, &rtc_config.servers); 1352 JavaIceServersToJsepIceServers(jni, j_ice_servers, &rtc_config.servers);
1339 rtc_config.audio_jitter_buffer_max_packets = 1353 rtc_config.audio_jitter_buffer_max_packets =
1340 GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id); 1354 GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id);
1341 rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField( 1355 rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField(
1342 jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id); 1356 jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id);
1357 if (g_rtc_certificate.get() != NULL)
1358 rtc_config.certificates.push_back(g_rtc_certificate);
1343 1359
1344 PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p); 1360 PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p);
1345 observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints)); 1361 observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints));
1346 rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection( 1362 rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection(
1347 rtc_config, observer->constraints(), NULL, NULL, observer)); 1363 rtc_config, observer->constraints(), NULL, NULL, observer));
1348 return (jlong)pc.release(); 1364 return (jlong)pc.release();
1349 } 1365 }
1350 1366
1351 static rtc::scoped_refptr<PeerConnectionInterface> ExtractNativePC( 1367 static rtc::scoped_refptr<PeerConnectionInterface> ExtractNativePC(
1352 JNIEnv* jni, jobject j_pc) { 1368 JNIEnv* jni, jobject j_pc) {
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 } 1693 }
1678 1694
1679 JOW(void, VideoTrack_nativeRemoveRenderer)( 1695 JOW(void, VideoTrack_nativeRemoveRenderer)(
1680 JNIEnv* jni, jclass, 1696 JNIEnv* jni, jclass,
1681 jlong j_video_track_pointer, jlong j_renderer_pointer) { 1697 jlong j_video_track_pointer, jlong j_renderer_pointer) {
1682 reinterpret_cast<VideoTrackInterface*>(j_video_track_pointer)->RemoveRenderer( 1698 reinterpret_cast<VideoTrackInterface*>(j_video_track_pointer)->RemoveRenderer(
1683 reinterpret_cast<VideoRendererInterface*>(j_renderer_pointer)); 1699 reinterpret_cast<VideoRendererInterface*>(j_renderer_pointer));
1684 } 1700 }
1685 1701
1686 } // namespace webrtc_jni 1702 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698