diff --git a/.gitignore b/.gitignore index 0a8ffdadcc..57bd245cf1 100644 --- a/.gitignore +++ b/.gitignore @@ -152,12 +152,6 @@ /tools/win /tools/xdisplaycheck /tools/whitespace.txt -/webrtc/examples/android/media_demo/bin -/webrtc/examples/android/media_demo/gen -/webrtc/examples/android/media_demo/libs -/webrtc/examples/android/media_demo/local.properties -/webrtc/examples/android/media_demo/obj -/webrtc/examples/android/media_demo/proguard-project.txt /webrtc/examples/android/opensl_loopback/bin /webrtc/examples/android/opensl_loopback/gen /webrtc/examples/android/opensl_loopback/libs diff --git a/all.gyp b/all.gyp index 40dbc135a6..0b11c8f7d6 100644 --- a/all.gyp +++ b/all.gyp @@ -24,7 +24,6 @@ 'conditions': [ ['include_examples==1', { 'dependencies': [ - 'webrtc/libjingle_examples.gyp:*', 'webrtc/webrtc_examples.gyp:*', ], }], diff --git a/talk/libjingle_tests.gyp b/talk/libjingle_tests.gyp index 41b38b345d..1af70ca157 100755 --- a/talk/libjingle_tests.gyp +++ b/talk/libjingle_tests.gyp @@ -378,7 +378,7 @@ '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils', '<(webrtc_root)/system_wrappers/system_wrappers.gyp:field_trial_default', '<(DEPTH)/third_party/ocmock/ocmock.gyp:ocmock', - '<(webrtc_root)/libjingle_examples.gyp:apprtc_signaling', + '<(webrtc_root)/webrtc_examples.gyp:apprtc_signaling', ], 'sources': [ 'app/webrtc/objctests/mac/main.mm', diff --git a/webrtc/examples/android/media_demo/AndroidManifest.xml b/webrtc/examples/android/media_demo/AndroidManifest.xml deleted file mode 100644 index 62bf46076f..0000000000 --- a/webrtc/examples/android/media_demo/AndroidManifest.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/webrtc/examples/android/media_demo/README b/webrtc/examples/android/media_demo/README deleted file mode 100644 index af71f38f46..0000000000 --- a/webrtc/examples/android/media_demo/README +++ /dev/null @@ -1,24 +0,0 @@ -This directory contains a sample app for sending and receiving audio -on Android. It further lets you enable and disable some call quality -enhancements such as echo cancellation, noise suppression etc. - -Prerequisites: -- Make sure gclient is checking out tools necessary to target Android: your - .gclient file should contain a line like: - target_os = ['android'] - Make sure to re-run gclient sync after adding this to download the tools. -- Env vars need to be set up to target Android; easiest way to do this is to run - (from the libjingle trunk directory): - . ./build/android/envsetup.sh - Note that this clobbers any previously-set $GYP_DEFINES so it must be done - before the next item. -- Set up webrtc-related GYP variables: - export GYP_DEFINES="$GYP_DEFINES java_home=" -- Finally, run "gclient runhooks" to generate Android-targeting .ninja files. - -Example of building the app: -cd /trunk -ninja -C out/Debug WebRTCDemo - -It can then be installed and run on the device: -adb install -r out/Debug/WebRTCDemo-debug.apk diff --git a/webrtc/examples/android/media_demo/build.xml b/webrtc/examples/android/media_demo/build.xml deleted file mode 100644 index 17734886d9..0000000000 --- a/webrtc/examples/android/media_demo/build.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/webrtc/examples/android/media_demo/jni/jni_helpers.cc b/webrtc/examples/android/media_demo/jni/jni_helpers.cc deleted file mode 100644 index 7a4f5e4f6c..0000000000 --- a/webrtc/examples/android/media_demo/jni/jni_helpers.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "webrtc/examples/android/media_demo/jni/jni_helpers.h" - -#include - -jmethodID GetMethodID(JNIEnv* jni, jclass c, const std::string& name, - const char* signature) { - jmethodID m = jni->GetMethodID(c, name.c_str(), signature); - CHECK_JNI_EXCEPTION(jni, "error during GetMethodID"); - return m; -} - -jlong jlongFromPointer(void* ptr) { - CHECK(sizeof(intptr_t) <= sizeof(jlong), "Time to rethink the use of jlongs"); - // Going through intptr_t to be obvious about the definedness of the - // conversion from pointer to integral type. intptr_t to jlong is a standard - // widening by the COMPILE_ASSERT above. - jlong ret = reinterpret_cast(ptr); - CHECK(reinterpret_cast(ret) == ptr, - "jlong does not convert back to pointer"); - return ret; -} - -// Given a (UTF-16) jstring return a new UTF-8 native string. -std::string JavaToStdString(JNIEnv* jni, const jstring& j_string) { - const char* chars = jni->GetStringUTFChars(j_string, NULL); - CHECK_JNI_EXCEPTION(jni, "Error during GetStringUTFChars"); - std::string str(chars, jni->GetStringUTFLength(j_string)); - CHECK_JNI_EXCEPTION(jni, "Error during GetStringUTFLength"); - jni->ReleaseStringUTFChars(j_string, chars); - CHECK_JNI_EXCEPTION(jni, "Error during ReleaseStringUTFChars"); - return str; -} - -ClassReferenceHolder::ClassReferenceHolder(JNIEnv* jni, const char** classes, - int size) { - for (int i = 0; i < size; ++i) { - LoadClass(jni, classes[i]); - } -} -ClassReferenceHolder::~ClassReferenceHolder() { - CHECK(classes_.empty(), "Must call FreeReferences() before dtor!"); -} - -void ClassReferenceHolder::FreeReferences(JNIEnv* jni) { - for (std::map::const_iterator it = classes_.begin(); - it != classes_.end(); ++it) { - jni->DeleteGlobalRef(it->second); - } - classes_.clear(); -} - -jclass ClassReferenceHolder::GetClass(const std::string& name) { - std::map::iterator it = classes_.find(name); - CHECK(it != classes_.end(), "Could not find class"); - return it->second; -} - -void ClassReferenceHolder::LoadClass(JNIEnv* jni, const std::string& name) { - jclass localRef = jni->FindClass(name.c_str()); - CHECK_JNI_EXCEPTION(jni, "Could not load class"); - CHECK(localRef, name.c_str()); - jclass globalRef = reinterpret_cast(jni->NewGlobalRef(localRef)); - CHECK_JNI_EXCEPTION(jni, "error during NewGlobalRef"); - CHECK(globalRef, name.c_str()); - bool inserted = classes_.insert(std::make_pair(name, globalRef)).second; - CHECK(inserted, "Duplicate class name"); -} diff --git a/webrtc/examples/android/media_demo/jni/jni_helpers.h b/webrtc/examples/android/media_demo/jni/jni_helpers.h deleted file mode 100644 index 3d8ff48111..0000000000 --- a/webrtc/examples/android/media_demo/jni/jni_helpers.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_EXAMPLES_ANDROID_MEDIA_DEMO_JNI_JNI_HELPERS_H_ -#define WEBRTC_EXAMPLES_ANDROID_MEDIA_DEMO_JNI_JNI_HELPERS_H_ - -// TODO(henrike): this file contains duplication with regards to -// talk/app/webrtc/java/jni/peerconnection_jni.cc. When/if code can be shared -// between trunk/talk and trunk/webrtc remove the duplication. - -#include -#include - -#include -#include -#include - -#define TAG "WEBRTC-NATIVE" - -// Abort the process if |x| is false, emitting |msg| to logcat. -#define CHECK(x, msg) \ - if (x) { \ - } else { \ - __android_log_print(ANDROID_LOG_ERROR, TAG, "%s:%d: %s", __FILE__, \ - __LINE__, msg); \ - assert(false); \ - } - -// Abort the process if |jni| has a Java exception pending, emitting |msg| to -// logcat. -#define CHECK_JNI_EXCEPTION(jni, msg) \ - if (0) { \ - } else { \ - if (jni->ExceptionCheck()) { \ - jni->ExceptionDescribe(); \ - jni->ExceptionClear(); \ - CHECK(0, msg); \ - } \ - } - -// JNIEnv-helper methods that CHECK success: no Java exception thrown and found -// object/class/method/field is non-null. -jmethodID GetMethodID(JNIEnv* jni, jclass c, const std::string& name, - const char* signature); - -// Return a |jlong| that will automatically convert back to |ptr| when assigned -// to a |uint64_t| -jlong jlongFromPointer(void* ptr); - -// Given a (UTF-16) jstring return a new UTF-8 native string. -std::string JavaToStdString(JNIEnv* jni, const jstring& j_string); - -// Android's FindClass() is trickier than usual because the app-specific -// ClassLoader is not consulted when there is no app-specific frame on the -// stack. Consequently, we only look up classes once in JNI_OnLoad. -// http://developer.android.com/training/articles/perf-jni.html#faq_FindClass -class ClassReferenceHolder { - public: - ClassReferenceHolder(JNIEnv* jni, const char** classes, int size); - ~ClassReferenceHolder(); - - void FreeReferences(JNIEnv* jni); - - jclass GetClass(const std::string& name); - - private: - void LoadClass(JNIEnv* jni, const std::string& name); - - std::map classes_; -}; - -#endif // WEBRTC_EXAMPLES_ANDROID_MEDIA_DEMO_JNI_JNI_HELPERS_H_ diff --git a/webrtc/examples/android/media_demo/jni/on_load.cc b/webrtc/examples/android/media_demo/jni/on_load.cc deleted file mode 100644 index 5827ee8a30..0000000000 --- a/webrtc/examples/android/media_demo/jni/on_load.cc +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include - -#include - -#include "webrtc/examples/android/media_demo/jni/jni_helpers.h" -#include "webrtc/examples/android/media_demo/jni/voice_engine_jni.h" -#include "webrtc/voice_engine/include/voe_base.h" - -// Macro for native functions that can be found by way of jni-auto discovery. -// Note extern "C" is needed for "discovery" of native methods to work. -#define JOWW(rettype, name) \ - extern "C" rettype JNIEXPORT JNICALL Java_org_webrtc_webrtcdemo_##name - -static JavaVM* g_vm = NULL; - -extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) { - // Only called once. - CHECK(!g_vm, "OnLoad called more than once"); - g_vm = vm; - return JNI_VERSION_1_4; -} - -JOWW(void, NativeWebRtcContextRegistry_register)( - JNIEnv* jni, - jclass, - jobject context) { - webrtc_examples::SetVoeDeviceObjects(g_vm); - CHECK(webrtc::VoiceEngine::SetAndroidObjects(g_vm, context) == 0, - "Failed to register android objects to voice engine"); -} - -JOWW(void, NativeWebRtcContextRegistry_unRegister)( - JNIEnv* jni, - jclass) { - CHECK(webrtc::VoiceEngine::SetAndroidObjects(NULL, NULL) == 0, - "Failed to unregister android objects from voice engine"); - webrtc_examples::ClearVoeDeviceObjects(); -} diff --git a/webrtc/examples/android/media_demo/jni/voice_engine_jni.cc b/webrtc/examples/android/media_demo/jni/voice_engine_jni.cc deleted file mode 100644 index 23d9b6e51e..0000000000 --- a/webrtc/examples/android/media_demo/jni/voice_engine_jni.cc +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// This file contains JNI for the voice engine interfaces. -// The native functions are found using jni's auto discovery. - -#include "webrtc/examples/android/media_demo/jni/voice_engine_jni.h" - -#include -#include - -#include "webrtc/base/arraysize.h" -#include "webrtc/examples/android/media_demo/jni/jni_helpers.h" -#include "webrtc/modules/utility/include/helpers_android.h" -#include "webrtc/test/channel_transport/channel_transport.h" -#include "webrtc/voice_engine/include/voe_audio_processing.h" -#include "webrtc/voice_engine/include/voe_base.h" -#include "webrtc/voice_engine/include/voe_codec.h" -#include "webrtc/voice_engine/include/voe_file.h" -#include "webrtc/voice_engine/include/voe_hardware.h" -#include "webrtc/voice_engine/include/voe_network.h" -#include "webrtc/voice_engine/include/voe_rtp_rtcp.h" -#include "webrtc/voice_engine/include/voe_volume_control.h" - -// Macro for native functions that can be found by way of jni-auto discovery. -// Note extern "C" is needed for "discovery" of native methods to work. -#define JOWW(rettype, name) \ - extern "C" rettype JNIEXPORT JNICALL Java_org_webrtc_webrtcdemo_##name - -namespace { - -static JavaVM* g_vm = NULL; -static ClassReferenceHolder* g_class_reference_holder = NULL; - -jclass GetClass(JNIEnv* jni, const char* name) { - CHECK(g_class_reference_holder, "Class reference holder NULL"); - return g_class_reference_holder->GetClass(name); -} - -static const char* g_classes[] = {"org/webrtc/webrtcdemo/CodecInst"}; - -template -void ReleaseSubApi(T instance) { - CHECK(instance->Release() >= 0, "failed to release instance") -} - -class VoiceEngineData { - public: - VoiceEngineData() - : ve(webrtc::VoiceEngine::Create()), - base(webrtc::VoEBase::GetInterface(ve)), - codec(webrtc::VoECodec::GetInterface(ve)), - file(webrtc::VoEFile::GetInterface(ve)), - netw(webrtc::VoENetwork::GetInterface(ve)), - apm(webrtc::VoEAudioProcessing::GetInterface(ve)), - volume(webrtc::VoEVolumeControl::GetInterface(ve)), - hardware(webrtc::VoEHardware::GetInterface(ve)), - rtp(webrtc::VoERTP_RTCP::GetInterface(ve)) { - CHECK(ve != NULL, "Voice engine instance failed to be created"); - CHECK(base != NULL, "Failed to acquire base interface"); - CHECK(codec != NULL, "Failed to acquire codec interface"); - CHECK(file != NULL, "Failed to acquire file interface"); - CHECK(netw != NULL, "Failed to acquire netw interface"); - CHECK(apm != NULL, "Failed to acquire apm interface"); - CHECK(volume != NULL, "Failed to acquire volume interface"); - CHECK(hardware != NULL, "Failed to acquire hardware interface"); - CHECK(rtp != NULL, "Failed to acquire rtp interface"); - } - - ~VoiceEngineData() { - CHECK(channel_transports_.empty(), - "VoE transports must be deleted before terminating"); - CHECK(base->Terminate() == 0, "VoE failed to terminate"); - ReleaseSubApi(base); - ReleaseSubApi(codec); - ReleaseSubApi(file); - ReleaseSubApi(netw); - ReleaseSubApi(apm); - ReleaseSubApi(volume); - ReleaseSubApi(hardware); - ReleaseSubApi(rtp); - webrtc::VoiceEngine* ve_instance = ve; - CHECK(webrtc::VoiceEngine::Delete(ve_instance), "VoE failed to be deleted"); - } - - int CreateChannel() { - int channel = base->CreateChannel(); - if (channel == -1) { - return -1; - } - CreateTransport(channel); - return channel; - } - - int DeleteChannel(int channel) { - if (base->DeleteChannel(channel) != 0) { - return -1; - } - DeleteTransport(channel); - return 0; - } - - webrtc::test::VoiceChannelTransport* GetTransport(int channel) { - ChannelTransports::iterator found = channel_transports_.find(channel); - if (found == channel_transports_.end()) { - return NULL; - } - return found->second; - } - - webrtc::VoiceEngine* const ve; - webrtc::VoEBase* const base; - webrtc::VoECodec* const codec; - webrtc::VoEFile* const file; - webrtc::VoENetwork* const netw; - webrtc::VoEAudioProcessing* const apm; - webrtc::VoEVolumeControl* const volume; - webrtc::VoEHardware* const hardware; - webrtc::VoERTP_RTCP* const rtp; - - private: - // Voice engine no longer provides a socket implementation. There is, - // however, a socket implementation in webrtc::test. - typedef std::map - ChannelTransports; - - void CreateTransport(int channel) { - CHECK(GetTransport(channel) == NULL, - "Transport already created for VoE channel, inconsistent state"); - channel_transports_[channel] = - new webrtc::test::VoiceChannelTransport(netw, channel); - } - void DeleteTransport(int channel) { - CHECK(GetTransport(channel) != NULL, - "VoE channel missing transport, inconsistent state"); - delete channel_transports_[channel]; - channel_transports_.erase(channel); - } - - ChannelTransports channel_transports_; -}; - -webrtc::CodecInst* GetCodecInst(JNIEnv* jni, jobject j_codec) { - jclass j_codec_class = jni->GetObjectClass(j_codec); - jfieldID native_codec_id = - jni->GetFieldID(j_codec_class, "nativeCodecInst", "J"); - jlong j_p = jni->GetLongField(j_codec, native_codec_id); - return reinterpret_cast(j_p); -} - -} // namespace - -namespace webrtc_examples { - -void SetVoeDeviceObjects(JavaVM* vm) { - CHECK(vm, "Trying to register NULL vm"); - g_vm = vm; - webrtc::AttachThreadScoped ats(g_vm); - JNIEnv* jni = ats.env(); - g_class_reference_holder = new ClassReferenceHolder( - jni, g_classes, arraysize(g_classes)); -} - -void ClearVoeDeviceObjects() { - CHECK(g_vm, "Clearing vm without it being set"); - { - webrtc::AttachThreadScoped ats(g_vm); - g_class_reference_holder->FreeReferences(ats.env()); - } - g_vm = NULL; - delete g_class_reference_holder; - g_class_reference_holder = NULL; -} - -} // namespace webrtc_examples - -VoiceEngineData* GetVoiceEngineData(JNIEnv* jni, jobject j_voe) { - jclass j_voe_class = jni->GetObjectClass(j_voe); - jfieldID native_voe_id = - jni->GetFieldID(j_voe_class, "nativeVoiceEngine", "J"); - jlong j_p = jni->GetLongField(j_voe, native_voe_id); - return reinterpret_cast(j_p); -} - -webrtc::VoiceEngine* GetVoiceEngine(JNIEnv* jni, jobject j_voe) { - return GetVoiceEngineData(jni, j_voe)->ve; -} - -JOWW(jlong, VoiceEngine_create)(JNIEnv* jni, jclass) { - VoiceEngineData* voe_data = new VoiceEngineData(); - return jlongFromPointer(voe_data); -} - -JOWW(void, VoiceEngine_dispose)(JNIEnv* jni, jobject j_voe) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - delete voe_data; -} - -JOWW(jint, VoiceEngine_init)(JNIEnv* jni, jobject j_voe) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->base->Init(); -} - -JOWW(jint, VoiceEngine_createChannel)(JNIEnv* jni, jobject j_voe) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->CreateChannel(); -} - -JOWW(jint, VoiceEngine_deleteChannel)(JNIEnv* jni, jobject j_voe, - jint channel) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->DeleteChannel(channel); -} - -JOWW(jint, VoiceEngine_setLocalReceiver)(JNIEnv* jni, jobject j_voe, - jint channel, jint port) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - webrtc::test::VoiceChannelTransport* transport = - voe_data->GetTransport(channel); - return transport->SetLocalReceiver(port); -} - -JOWW(jint, VoiceEngine_setSendDestination)(JNIEnv* jni, jobject j_voe, - jint channel, jint port, - jstring j_addr) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - std::string addr = JavaToStdString(jni, j_addr); - webrtc::test::VoiceChannelTransport* transport = - voe_data->GetTransport(channel); - return transport->SetSendDestination(addr.c_str(), port); -} - -JOWW(jint, VoiceEngine_startListen)(JNIEnv* jni, jobject j_voe, jint channel) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->base->StartReceive(channel); -} - -JOWW(jint, VoiceEngine_startPlayout)(JNIEnv* jni, jobject j_voe, jint channel) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->base->StartPlayout(channel); -} - -JOWW(jint, VoiceEngine_startSend)(JNIEnv* jni, jobject j_voe, jint channel) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->base->StartSend(channel); -} - -JOWW(jint, VoiceEngine_stopListen)(JNIEnv* jni, jobject j_voe, jint channel) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->base->StartReceive(channel); -} - -JOWW(jint, VoiceEngine_stopPlayout)(JNIEnv* jni, jobject j_voe, jint channel) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->base->StopPlayout(channel); -} - -JOWW(jint, VoiceEngine_stopSend)(JNIEnv* jni, jobject j_voe, jint channel) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->base->StopSend(channel); -} - -JOWW(jint, VoiceEngine_setSpeakerVolume)(JNIEnv* jni, jobject j_voe, - jint level) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->volume->SetSpeakerVolume(level); -} - -JOWW(jint, VoiceEngine_startPlayingFileLocally)(JNIEnv* jni, jobject j_voe, - jint channel, - jstring j_filename, - jboolean loop) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - std::string filename = JavaToStdString(jni, j_filename); - return voe_data->file->StartPlayingFileLocally(channel, - filename.c_str(), - loop); -} - -JOWW(jint, VoiceEngine_stopPlayingFileLocally)(JNIEnv* jni, jobject j_voe, - jint channel) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->file->StopPlayingFileLocally(channel); -} - -JOWW(jint, VoiceEngine_startPlayingFileAsMicrophone)(JNIEnv* jni, jobject j_voe, - jint channel, - jstring j_filename, - jboolean loop) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - std::string filename = JavaToStdString(jni, j_filename); - return voe_data->file->StartPlayingFileAsMicrophone(channel, - filename.c_str(), - loop); -} - -JOWW(jint, VoiceEngine_stopPlayingFileAsMicrophone)(JNIEnv* jni, jobject j_voe, - jint channel) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->file->StopPlayingFileAsMicrophone(channel); -} - -JOWW(jint, VoiceEngine_numOfCodecs)(JNIEnv* jni, jobject j_voe) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->codec->NumOfCodecs(); -} - -JOWW(jobject, VoiceEngine_getCodec)(JNIEnv* jni, jobject j_voe, jint index) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - webrtc::CodecInst* codec = new webrtc::CodecInst(); - CHECK(voe_data->codec->GetCodec(index, *codec) == 0, - "getCodec must be called with valid index"); - jclass j_codec_class = GetClass(jni, "org/webrtc/webrtcdemo/CodecInst"); - jmethodID j_codec_ctor = GetMethodID(jni, j_codec_class, "", "(J)V"); - jobject j_codec = - jni->NewObject(j_codec_class, j_codec_ctor, jlongFromPointer(codec)); - CHECK_JNI_EXCEPTION(jni, "error during NewObject"); - return j_codec; -} - -JOWW(jint, VoiceEngine_setSendCodec)(JNIEnv* jni, jobject j_voe, jint channel, - jobject j_codec) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - webrtc::CodecInst* inst = GetCodecInst(jni, j_codec); - return voe_data->codec->SetSendCodec(channel, *inst); -} - -JOWW(jint, VoiceEngine_setEcStatus)(JNIEnv* jni, jobject j_voe, jboolean enable, - jint ec_mode) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->apm->SetEcStatus(enable, - static_cast(ec_mode)); -} - -JOWW(jint, VoiceEngine_setAecmMode)(JNIEnv* jni, jobject j_voe, jint aecm_mode, - jboolean cng) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->apm->SetAecmMode(static_cast(aecm_mode), - cng); -} - -JOWW(jint, VoiceEngine_setAgcStatus)(JNIEnv* jni, jobject j_voe, - jboolean enable, jint agc_mode) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->apm->SetAgcStatus(enable, - static_cast(agc_mode)); -} - -// Returns the native AgcConfig object associated with the Java object -// |j_codec|. -void GetNativeAgcConfig(JNIEnv* jni, jobject j_codec, - webrtc::AgcConfig* agc_config) { - jclass j_codec_class = jni->GetObjectClass(j_codec); - jfieldID dBOv_id = jni->GetFieldID(j_codec_class, "targetLevelDbOv", "I"); - agc_config->targetLeveldBOv = jni->GetIntField(j_codec, dBOv_id); - jfieldID gain_id = - jni->GetFieldID(j_codec_class, "digitalCompressionGaindB", "I"); - agc_config->digitalCompressionGaindB = jni->GetIntField(j_codec, gain_id); - jfieldID limiter_id = jni->GetFieldID(j_codec_class, "limiterEnable", "Z"); - agc_config->limiterEnable = jni->GetBooleanField(j_codec, limiter_id); -} - -JOWW(jint, VoiceEngine_setAgcConfig)(JNIEnv* jni, jobject j_voe, - jobject j_config) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - webrtc::AgcConfig config; - GetNativeAgcConfig(jni, j_config, &config); - return voe_data->apm->SetAgcConfig(config); -} - -JOWW(jint, VoiceEngine_setNsStatus)(JNIEnv* jni, jobject j_voe, jboolean enable, - jint ns_mode) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->apm->SetNsStatus(enable, - static_cast(ns_mode)); -} - -JOWW(jint, VoiceEngine_startDebugRecording)(JNIEnv* jni, jobject j_voe, - jstring j_filename) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - std::string filename = JavaToStdString(jni, j_filename); - return voe_data->apm->StartDebugRecording(filename.c_str()); -} - -JOWW(jint, VoiceEngine_stopDebugRecording)(JNIEnv* jni, jobject j_voe) { - VoiceEngineData* voe_data = GetVoiceEngineData(jni, j_voe); - return voe_data->apm->StopDebugRecording(); -} - -JOWW(void, CodecInst_dispose)(JNIEnv* jni, jobject j_codec) { - delete GetCodecInst(jni, j_codec); -} - -JOWW(jint, CodecInst_plType)(JNIEnv* jni, jobject j_codec) { - return GetCodecInst(jni, j_codec)->pltype; -} - -JOWW(jstring, CodecInst_name)(JNIEnv* jni, jobject j_codec) { - return jni->NewStringUTF(GetCodecInst(jni, j_codec)->plname); -} - -JOWW(jint, CodecInst_plFrequency)(JNIEnv* jni, jobject j_codec) { - return GetCodecInst(jni, j_codec)->plfreq; -} - -JOWW(jint, CodecInst_pacSize)(JNIEnv* jni, jobject j_codec) { - return GetCodecInst(jni, j_codec)->pacsize; -} - -JOWW(jint, CodecInst_channels)(JNIEnv* jni, jobject j_codec) { - return GetCodecInst(jni, j_codec)->channels; -} - -JOWW(jint, CodecInst_rate)(JNIEnv* jni, jobject j_codec) { - return GetCodecInst(jni, j_codec)->rate; -} diff --git a/webrtc/examples/android/media_demo/jni/voice_engine_jni.h b/webrtc/examples/android/media_demo/jni/voice_engine_jni.h deleted file mode 100644 index 57ef507653..0000000000 --- a/webrtc/examples/android/media_demo/jni/voice_engine_jni.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_EXAMPLES_ANDROID_MEDIA_DEMO_JNI_VOICE_ENGINE_H_ -#define WEBRTC_EXAMPLES_ANDROID_MEDIA_DEMO_JNI_VOICE_ENGINE_H_ - -#include - -namespace webrtc { - -class VoiceEngine; - -} // namespace webrtc - -namespace webrtc_examples { - -void SetVoeDeviceObjects(JavaVM* vm); -void ClearVoeDeviceObjects(); - -} // namespace webrtc_examples - -webrtc::VoiceEngine* GetVoiceEngine(JNIEnv* jni, jobject j_voe); - -#endif // WEBRTC_EXAMPLES_ANDROID_MEDIA_DEMO_JNI_VOICE_ENGINE_H_ diff --git a/webrtc/examples/android/media_demo/project.properties b/webrtc/examples/android/media_demo/project.properties deleted file mode 100644 index 69eb2d039b..0000000000 --- a/webrtc/examples/android/media_demo/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-23 diff --git a/webrtc/examples/android/media_demo/res/drawable/logo.png b/webrtc/examples/android/media_demo/res/drawable/logo.png deleted file mode 100644 index 1ff07d1102..0000000000 Binary files a/webrtc/examples/android/media_demo/res/drawable/logo.png and /dev/null differ diff --git a/webrtc/examples/android/media_demo/res/layout/audiomenu.xml b/webrtc/examples/android/media_demo/res/layout/audiomenu.xml deleted file mode 100644 index f35547062a..0000000000 --- a/webrtc/examples/android/media_demo/res/layout/audiomenu.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/webrtc/examples/android/media_demo/res/layout/dropdownitems.xml b/webrtc/examples/android/media_demo/res/layout/dropdownitems.xml deleted file mode 100644 index 1014612000..0000000000 --- a/webrtc/examples/android/media_demo/res/layout/dropdownitems.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - \ No newline at end of file diff --git a/webrtc/examples/android/media_demo/res/layout/mainmenu.xml b/webrtc/examples/android/media_demo/res/layout/mainmenu.xml deleted file mode 100644 index 89f5399df7..0000000000 --- a/webrtc/examples/android/media_demo/res/layout/mainmenu.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - -