OLD | NEW |
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 // Field trials initialization string | 136 // Field trials initialization string |
137 static char *field_trials_init_string = NULL; | 137 static char *field_trials_init_string = NULL; |
138 | 138 |
139 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) | 139 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) |
140 // Set in PeerConnectionFactory_initializeAndroidGlobals(). | 140 // Set in PeerConnectionFactory_initializeAndroidGlobals(). |
141 static bool factory_static_initialized = false; | 141 static bool factory_static_initialized = false; |
142 static bool video_hw_acceleration_enabled = true; | 142 static bool video_hw_acceleration_enabled = true; |
143 #endif | 143 #endif |
144 | 144 |
| 145 extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { |
| 146 jint ret = InitGlobalJniVariables(jvm); |
| 147 if (ret < 0) |
| 148 return -1; |
| 149 |
| 150 RTC_CHECK(rtc::InitializeSSL()) << "Failed to InitializeSSL()"; |
| 151 LoadGlobalClassReferenceHolder(); |
| 152 |
| 153 return ret; |
| 154 } |
| 155 |
| 156 extern "C" void JNIEXPORT JNICALL JNI_OnUnLoad(JavaVM *jvm, void *reserved) { |
| 157 FreeGlobalClassReferenceHolder(); |
| 158 RTC_CHECK(rtc::CleanupSSL()) << "Failed to CleanupSSL()"; |
| 159 } |
| 160 |
145 // Return the (singleton) Java Enum object corresponding to |index|; | 161 // Return the (singleton) Java Enum object corresponding to |index|; |
146 // |state_class_fragment| is something like "MediaSource$State". | 162 // |state_class_fragment| is something like "MediaSource$State". |
147 static jobject JavaEnumFromIndex( | 163 static jobject JavaEnumFromIndex( |
148 JNIEnv* jni, const std::string& state_class_fragment, int index) { | 164 JNIEnv* jni, const std::string& state_class_fragment, int index) { |
149 const std::string state_class = "org/webrtc/" + state_class_fragment; | 165 const std::string state_class = "org/webrtc/" + state_class_fragment; |
150 return JavaEnumFromIndex(jni, FindClass(jni, state_class.c_str()), | 166 return JavaEnumFromIndex(jni, FindClass(jni, state_class.c_str()), |
151 state_class, index); | 167 state_class, index); |
152 } | 168 } |
153 | 169 |
154 static DataChannelInit JavaDataChannelInitToNative( | 170 static DataChannelInit JavaDataChannelInitToNative( |
(...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 return JavaStringFromStdString( | 2184 return JavaStringFromStdString( |
2169 jni, | 2185 jni, |
2170 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2186 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2171 } | 2187 } |
2172 | 2188 |
2173 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2189 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2174 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2190 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2175 } | 2191 } |
2176 | 2192 |
2177 } // namespace webrtc_jni | 2193 } // namespace webrtc_jni |
OLD | NEW |