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