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

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: Add identity string id 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 using webrtc::VideoSourceInterface; 118 using webrtc::VideoSourceInterface;
119 using webrtc::VideoTrackInterface; 119 using webrtc::VideoTrackInterface;
120 using webrtc::VideoTrackVector; 120 using webrtc::VideoTrackVector;
121 using webrtc::kVideoCodecVP8; 121 using webrtc::kVideoCodecVP8;
122 122
123 namespace webrtc_jni { 123 namespace webrtc_jni {
124 124
125 // Field trials initialization string 125 // Field trials initialization string
126 static char *field_trials_init_string = NULL; 126 static char *field_trials_init_string = NULL;
127 127
128 // Passed to SSLIdentity::Generate, "WebRTC". Used for the certificates'
129 // subject and issuer name.
130 static const char kIdentityName[] = "WebRTC";
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) {
135 jint ret = InitGlobalJniVariables(jvm); 139 jint ret = InitGlobalJniVariables(jvm);
136 if (ret < 0) 140 if (ret < 0)
137 return -1; 141 return -1;
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 rtc_config.rtcp_mux_policy = 1338 rtc_config.rtcp_mux_policy =
1335 JavaRtcpMuxPolicyToNativeType(jni, j_rtcp_mux_policy); 1339 JavaRtcpMuxPolicyToNativeType(jni, j_rtcp_mux_policy);
1336 rtc_config.tcp_candidate_policy = 1340 rtc_config.tcp_candidate_policy =
1337 JavaTcpCandidatePolicyToNativeType(jni, j_tcp_candidate_policy); 1341 JavaTcpCandidatePolicyToNativeType(jni, j_tcp_candidate_policy);
1338 JavaIceServersToJsepIceServers(jni, j_ice_servers, &rtc_config.servers); 1342 JavaIceServersToJsepIceServers(jni, j_ice_servers, &rtc_config.servers);
1339 rtc_config.audio_jitter_buffer_max_packets = 1343 rtc_config.audio_jitter_buffer_max_packets =
1340 GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id); 1344 GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id);
1341 rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField( 1345 rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField(
1342 jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id); 1346 jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id);
1343 1347
1348 // Create ECDSA certificate.
hbos 2015/08/26 09:50:04 This should probably not be placed here without ha
AlexG 2015/08/31 19:07:23 Done. Added Java enum to configure certificate typ
1349 scoped_ptr<rtc::SSLIdentity> ssl_identity(
1350 rtc::SSLIdentity::Generate(kIdentityName, rtc::KT_ECDSA));
1351 if (ssl_identity.get()) {
1352 rtc_config.certificates.push_back(
1353 rtc::RTCCertificate::Create(ssl_identity.Pass()));
1354 LOG(LS_INFO) << "ECDSA certificate created.";
1355 } else {
1356 LOG(LS_WARNING) << "Failed to generate SSLIdentity.";
hbos 2015/08/26 09:50:04 While failing to generate is (exceptionally?) rare
AlexG 2015/08/31 19:07:23 Done. Yes, this is on purpose. I added comment and
1357 }
1358
1344 PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p); 1359 PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p);
1345 observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints)); 1360 observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints));
1346 rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection( 1361 rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection(
1347 rtc_config, observer->constraints(), NULL, NULL, observer)); 1362 rtc_config, observer->constraints(), NULL, NULL, observer));
1348 return (jlong)pc.release(); 1363 return (jlong)pc.release();
1349 } 1364 }
1350 1365
1351 static rtc::scoped_refptr<PeerConnectionInterface> ExtractNativePC( 1366 static rtc::scoped_refptr<PeerConnectionInterface> ExtractNativePC(
1352 JNIEnv* jni, jobject j_pc) { 1367 JNIEnv* jni, jobject j_pc) {
1353 jfieldID native_pc_id = GetFieldID(jni, 1368 jfieldID native_pc_id = GetFieldID(jni,
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 } 1692 }
1678 1693
1679 JOW(void, VideoTrack_nativeRemoveRenderer)( 1694 JOW(void, VideoTrack_nativeRemoveRenderer)(
1680 JNIEnv* jni, jclass, 1695 JNIEnv* jni, jclass,
1681 jlong j_video_track_pointer, jlong j_renderer_pointer) { 1696 jlong j_video_track_pointer, jlong j_renderer_pointer) {
1682 reinterpret_cast<VideoTrackInterface*>(j_video_track_pointer)->RemoveRenderer( 1697 reinterpret_cast<VideoTrackInterface*>(j_video_track_pointer)->RemoveRenderer(
1683 reinterpret_cast<VideoRendererInterface*>(j_renderer_pointer)); 1698 reinterpret_cast<VideoRendererInterface*>(j_renderer_pointer));
1684 } 1699 }
1685 1700
1686 } // namespace webrtc_jni 1701 } // 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