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 | |
161 // Return the (singleton) Java Enum object corresponding to |index|; | 145 // Return the (singleton) Java Enum object corresponding to |index|; |
162 // |state_class_fragment| is something like "MediaSource$State". | 146 // |state_class_fragment| is something like "MediaSource$State". |
163 static jobject JavaEnumFromIndex( | 147 static jobject JavaEnumFromIndex( |
164 JNIEnv* jni, const std::string& state_class_fragment, int index) { | 148 JNIEnv* jni, const std::string& state_class_fragment, int index) { |
165 const std::string state_class = "org/webrtc/" + state_class_fragment; | 149 const std::string state_class = "org/webrtc/" + state_class_fragment; |
166 return JavaEnumFromIndex(jni, FindClass(jni, state_class.c_str()), | 150 return JavaEnumFromIndex(jni, FindClass(jni, state_class.c_str()), |
167 state_class, index); | 151 state_class, index); |
168 } | 152 } |
169 | 153 |
170 static DataChannelInit JavaDataChannelInitToNative( | 154 static DataChannelInit JavaDataChannelInitToNative( |
(...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 return JavaStringFromStdString( | 2168 return JavaStringFromStdString( |
2185 jni, | 2169 jni, |
2186 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2170 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2187 } | 2171 } |
2188 | 2172 |
2189 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2173 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2190 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2174 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2191 } | 2175 } |
2192 | 2176 |
2193 } // namespace webrtc_jni | 2177 } // namespace webrtc_jni |
OLD | NEW |