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

Side by Side Diff: webrtc/modules/utility/source/jvm_android.cc

Issue 2119633004: Adds support for OpenSL ES based audio capture on Android (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 22 matching lines...) Expand all
33 {"org/webrtc/voiceengine/WebRtcAudioManager", nullptr}, 33 {"org/webrtc/voiceengine/WebRtcAudioManager", nullptr},
34 {"org/webrtc/voiceengine/WebRtcAudioRecord", nullptr}, 34 {"org/webrtc/voiceengine/WebRtcAudioRecord", nullptr},
35 {"org/webrtc/voiceengine/WebRtcAudioTrack", nullptr}, 35 {"org/webrtc/voiceengine/WebRtcAudioTrack", nullptr},
36 }; 36 };
37 37
38 // Android's FindClass() is trickier than usual because the app-specific 38 // Android's FindClass() is trickier than usual because the app-specific
39 // ClassLoader is not consulted when there is no app-specific frame on the 39 // ClassLoader is not consulted when there is no app-specific frame on the
40 // stack. Consequently, we only look up all classes once in native WebRTC. 40 // stack. Consequently, we only look up all classes once in native WebRTC.
41 // http://developer.android.com/training/articles/perf-jni.html#faq_FindClass 41 // http://developer.android.com/training/articles/perf-jni.html#faq_FindClass
42 void LoadClasses(JNIEnv* jni) { 42 void LoadClasses(JNIEnv* jni) {
43 ALOGD("LoadClasses");
43 for (auto& c : loaded_classes) { 44 for (auto& c : loaded_classes) {
44 jclass localRef = FindClass(jni, c.name); 45 jclass localRef = FindClass(jni, c.name);
46 ALOGD("name: %s", c.name);
45 CHECK_EXCEPTION(jni) << "Error during FindClass: " << c.name; 47 CHECK_EXCEPTION(jni) << "Error during FindClass: " << c.name;
46 RTC_CHECK(localRef) << c.name; 48 RTC_CHECK(localRef) << c.name;
47 jclass globalRef = reinterpret_cast<jclass>(jni->NewGlobalRef(localRef)); 49 jclass globalRef = reinterpret_cast<jclass>(jni->NewGlobalRef(localRef));
48 CHECK_EXCEPTION(jni) << "Error during NewGlobalRef: " << c.name; 50 CHECK_EXCEPTION(jni) << "Error during NewGlobalRef: " << c.name;
49 RTC_CHECK(globalRef) << c.name; 51 RTC_CHECK(globalRef) << c.name;
50 c.clazz = globalRef; 52 c.clazz = globalRef;
51 } 53 }
52 } 54 }
53 55
54 void FreeClassReferences(JNIEnv* jni) { 56 void FreeClassReferences(JNIEnv* jni) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 168 }
167 169
168 jobject JavaClass::CallStaticObjectMethod(jmethodID methodID, ...) { 170 jobject JavaClass::CallStaticObjectMethod(jmethodID methodID, ...) {
169 va_list args; 171 va_list args;
170 va_start(args, methodID); 172 va_start(args, methodID);
171 jobject res = jni_->CallStaticObjectMethod(j_class_, methodID, args); 173 jobject res = jni_->CallStaticObjectMethod(j_class_, methodID, args);
172 CHECK_EXCEPTION(jni_) << "Error during CallStaticObjectMethod"; 174 CHECK_EXCEPTION(jni_) << "Error during CallStaticObjectMethod";
173 return res; 175 return res;
174 } 176 }
175 177
178 jint JavaClass::CallStaticIntMethod(jmethodID methodID, ...) {
179 va_list args;
180 va_start(args, methodID);
181 jint res = jni_->CallStaticIntMethod(j_class_, methodID, args);
182 CHECK_EXCEPTION(jni_) << "Error during CallStaticIntMethod";
183 return res;
184 }
185
176 // JNIEnvironment implementation. 186 // JNIEnvironment implementation.
177 JNIEnvironment::JNIEnvironment(JNIEnv* jni) : jni_(jni) { 187 JNIEnvironment::JNIEnvironment(JNIEnv* jni) : jni_(jni) {
178 ALOGD("JNIEnvironment::ctor%s", GetThreadInfo().c_str()); 188 ALOGD("JNIEnvironment::ctor%s", GetThreadInfo().c_str());
179 } 189 }
180 190
181 JNIEnvironment::~JNIEnvironment() { 191 JNIEnvironment::~JNIEnvironment() {
182 ALOGD("JNIEnvironment::dtor%s", GetThreadInfo().c_str()); 192 ALOGD("JNIEnvironment::dtor%s", GetThreadInfo().c_str());
183 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 193 RTC_DCHECK(thread_checker_.CalledOnValidThread());
184 } 194 }
185 195
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 return std::unique_ptr<JNIEnvironment>(new JNIEnvironment(jni)); 267 return std::unique_ptr<JNIEnvironment>(new JNIEnvironment(jni));
258 } 268 }
259 269
260 JavaClass JVM::GetClass(const char* name) { 270 JavaClass JVM::GetClass(const char* name) {
261 ALOGD("JVM::GetClass(%s)%s", name, GetThreadInfo().c_str()); 271 ALOGD("JVM::GetClass(%s)%s", name, GetThreadInfo().c_str());
262 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 272 RTC_DCHECK(thread_checker_.CalledOnValidThread());
263 return JavaClass(jni(), LookUpClass(name)); 273 return JavaClass(jni(), LookUpClass(name));
264 } 274 }
265 275
266 } // namespace webrtc 276 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698