| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #include <jni.h> | |
| 12 | |
| 13 #include <assert.h> | |
| 14 | |
| 15 #include "webrtc/examples/android/media_demo/jni/jni_helpers.h" | |
| 16 #include "webrtc/examples/android/media_demo/jni/voice_engine_jni.h" | |
| 17 #include "webrtc/voice_engine/include/voe_base.h" | |
| 18 | |
| 19 // Macro for native functions that can be found by way of jni-auto discovery. | |
| 20 // Note extern "C" is needed for "discovery" of native methods to work. | |
| 21 #define JOWW(rettype, name) \ | |
| 22 extern "C" rettype JNIEXPORT JNICALL Java_org_webrtc_webrtcdemo_##name | |
| 23 | |
| 24 static JavaVM* g_vm = NULL; | |
| 25 | |
| 26 extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) { | |
| 27 // Only called once. | |
| 28 CHECK(!g_vm, "OnLoad called more than once"); | |
| 29 g_vm = vm; | |
| 30 return JNI_VERSION_1_4; | |
| 31 } | |
| 32 | |
| 33 JOWW(void, NativeWebRtcContextRegistry_register)( | |
| 34 JNIEnv* jni, | |
| 35 jclass, | |
| 36 jobject context) { | |
| 37 webrtc_examples::SetVoeDeviceObjects(g_vm); | |
| 38 CHECK(webrtc::VoiceEngine::SetAndroidObjects(g_vm, context) == 0, | |
| 39 "Failed to register android objects to voice engine"); | |
| 40 } | |
| 41 | |
| 42 JOWW(void, NativeWebRtcContextRegistry_unRegister)( | |
| 43 JNIEnv* jni, | |
| 44 jclass) { | |
| 45 CHECK(webrtc::VoiceEngine::SetAndroidObjects(NULL, NULL) == 0, | |
| 46 "Failed to unregister android objects from voice engine"); | |
| 47 webrtc_examples::ClearVoeDeviceObjects(); | |
| 48 } | |
| OLD | NEW |