From 32c26eb90b16fc6ea25d5756fe605aa4ddd8c313 Mon Sep 17 00:00:00 2001 From: "henrike@webrtc.org" Date: Fri, 17 Jan 2014 23:12:51 +0000 Subject: [PATCH] Android, OpenSlDemo: moved to webrtc/examples/android/opensl_loopback BUG=N/A R=andrew@webrtc.org, fischman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/7269004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5400 4adac7df-926f-26a2-2b94-8c16560cd09d --- OWNERS | 1 + webrtc/examples/OWNERS | 2 + .../opensl_loopback}/AndroidManifest.xml | 0 .../android/opensl_loopback}/README | 0 .../android/opensl_loopback}/build.xml | 0 .../fake_audio_device_buffer.cc | 2 +- .../fake_audio_device_buffer.h | 6 +- .../opensl_loopback}/jni/opensl_runner.cc | 4 +- .../opensl_loopback}/project.properties | 0 .../opensl_loopback}/res/drawable/logo.png | Bin .../res/layout/open_sl_demo.xml | 0 .../opensl_loopback}/res/values/strings.xml | 0 .../src/org/webrtc/app/OpenSlDemo.java | 0 .../src/org/webrtc/app/OpenSlRunner.java | 0 webrtc/modules/audio_device/audio_device.gypi | 64 ------------------ webrtc/webrtc_examples.gyp | 62 ++++++++++++++++- 16 files changed, 69 insertions(+), 72 deletions(-) create mode 100644 webrtc/examples/OWNERS rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/AndroidManifest.xml (100%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/README (100%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/build.xml (100%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/fake_audio_device_buffer.cc (97%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/fake_audio_device_buffer.h (90%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/jni/opensl_runner.cc (94%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/project.properties (100%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/res/drawable/logo.png (100%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/res/layout/open_sl_demo.xml (100%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/res/values/strings.xml (100%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/src/org/webrtc/app/OpenSlDemo.java (100%) rename webrtc/{modules/audio_device/android/test => examples/android/opensl_loopback}/src/org/webrtc/app/OpenSlRunner.java (100%) diff --git a/OWNERS b/OWNERS index acedc548b9..36d9928e72 100644 --- a/OWNERS +++ b/OWNERS @@ -9,3 +9,4 @@ per-file .gitignore=* per-file AUTHORS=* per-file DEPS=* per-file WATCHLISTS=* +per-file webrtc_examples.gyp=* diff --git a/webrtc/examples/OWNERS b/webrtc/examples/OWNERS new file mode 100644 index 0000000000..5c2e168242 --- /dev/null +++ b/webrtc/examples/OWNERS @@ -0,0 +1,2 @@ +fischman@webrtc.org +henrike@webrtc.org \ No newline at end of file diff --git a/webrtc/modules/audio_device/android/test/AndroidManifest.xml b/webrtc/examples/android/opensl_loopback/AndroidManifest.xml similarity index 100% rename from webrtc/modules/audio_device/android/test/AndroidManifest.xml rename to webrtc/examples/android/opensl_loopback/AndroidManifest.xml diff --git a/webrtc/modules/audio_device/android/test/README b/webrtc/examples/android/opensl_loopback/README similarity index 100% rename from webrtc/modules/audio_device/android/test/README rename to webrtc/examples/android/opensl_loopback/README diff --git a/webrtc/modules/audio_device/android/test/build.xml b/webrtc/examples/android/opensl_loopback/build.xml similarity index 100% rename from webrtc/modules/audio_device/android/test/build.xml rename to webrtc/examples/android/opensl_loopback/build.xml diff --git a/webrtc/modules/audio_device/android/test/fake_audio_device_buffer.cc b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.cc similarity index 97% rename from webrtc/modules/audio_device/android/test/fake_audio_device_buffer.cc rename to webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.cc index c12849c9d1..81adc8ff9a 100644 --- a/webrtc/modules/audio_device/android/test/fake_audio_device_buffer.cc +++ b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "webrtc/modules/audio_device/android/test/fake_audio_device_buffer.h" +#include "webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h" #include diff --git a/webrtc/modules/audio_device/android/test/fake_audio_device_buffer.h b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h similarity index 90% rename from webrtc/modules/audio_device/android/test/fake_audio_device_buffer.h rename to webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h index 9372e29400..b98ee1e814 100644 --- a/webrtc/modules/audio_device/android/test/fake_audio_device_buffer.h +++ b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_FAKE_AUDIO_DEVICE_BUFFER_H_ -#define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_FAKE_AUDIO_DEVICE_BUFFER_H_ +#ifndef WEBRTC_EXAMPLES_ANDROID_OPENSL_LOOPBACK_FAKE_AUDIO_DEVICE_BUFFER_H_ +#define WEBRTC_EXAMPLES_ANDROID_OPENSL_LOOPBACK_FAKE_AUDIO_DEVICE_BUFFER_H_ #include "webrtc/modules/audio_device/android/audio_manager_jni.h" #include "webrtc/modules/audio_device/android/single_rw_fifo.h" @@ -64,4 +64,4 @@ class FakeAudioDeviceBuffer : public AudioDeviceBuffer { } // namespace webrtc -#endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_FAKE_AUDIO_DEVICE_BUFFER_H_ +#endif // WEBRTC_EXAMPLES_ANDROID_OPENSL_LOOPBACK_FAKE_AUDIO_DEVICE_BUFFER_H_ diff --git a/webrtc/modules/audio_device/android/test/jni/opensl_runner.cc b/webrtc/examples/android/opensl_loopback/jni/opensl_runner.cc similarity index 94% rename from webrtc/modules/audio_device/android/test/jni/opensl_runner.cc rename to webrtc/examples/android/opensl_loopback/jni/opensl_runner.cc index 9d013300dc..5b7c092343 100644 --- a/webrtc/modules/audio_device/android/test/jni/opensl_runner.cc +++ b/webrtc/examples/android/opensl_loopback/jni/opensl_runner.cc @@ -11,12 +11,12 @@ #include #include +#include "webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h" #include "webrtc/modules/audio_device/android/audio_device_template.h" #include "webrtc/modules/audio_device/android/audio_record_jni.h" #include "webrtc/modules/audio_device/android/audio_track_jni.h" #include "webrtc/modules/audio_device/android/opensles_input.h" #include "webrtc/modules/audio_device/android/opensles_output.h" -#include "webrtc/modules/audio_device/android/test/fake_audio_device_buffer.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h" // Java globals @@ -84,8 +84,6 @@ class OpenSlRunner jobject obj, jobject context) { assert(!g_runner); // Should only be called once. - // Register the application context in the superclass to avoid having to - // qualify the template instantiation again. OpenSlesInput::SetAndroidAudioDeviceObjects(g_vm, env, context); OpenSlesOutput::SetAndroidAudioDeviceObjects(g_vm, env, context); g_runner = new OpenSlRunner(); diff --git a/webrtc/modules/audio_device/android/test/project.properties b/webrtc/examples/android/opensl_loopback/project.properties similarity index 100% rename from webrtc/modules/audio_device/android/test/project.properties rename to webrtc/examples/android/opensl_loopback/project.properties diff --git a/webrtc/modules/audio_device/android/test/res/drawable/logo.png b/webrtc/examples/android/opensl_loopback/res/drawable/logo.png similarity index 100% rename from webrtc/modules/audio_device/android/test/res/drawable/logo.png rename to webrtc/examples/android/opensl_loopback/res/drawable/logo.png diff --git a/webrtc/modules/audio_device/android/test/res/layout/open_sl_demo.xml b/webrtc/examples/android/opensl_loopback/res/layout/open_sl_demo.xml similarity index 100% rename from webrtc/modules/audio_device/android/test/res/layout/open_sl_demo.xml rename to webrtc/examples/android/opensl_loopback/res/layout/open_sl_demo.xml diff --git a/webrtc/modules/audio_device/android/test/res/values/strings.xml b/webrtc/examples/android/opensl_loopback/res/values/strings.xml similarity index 100% rename from webrtc/modules/audio_device/android/test/res/values/strings.xml rename to webrtc/examples/android/opensl_loopback/res/values/strings.xml diff --git a/webrtc/modules/audio_device/android/test/src/org/webrtc/app/OpenSlDemo.java b/webrtc/examples/android/opensl_loopback/src/org/webrtc/app/OpenSlDemo.java similarity index 100% rename from webrtc/modules/audio_device/android/test/src/org/webrtc/app/OpenSlDemo.java rename to webrtc/examples/android/opensl_loopback/src/org/webrtc/app/OpenSlDemo.java diff --git a/webrtc/modules/audio_device/android/test/src/org/webrtc/app/OpenSlRunner.java b/webrtc/examples/android/opensl_loopback/src/org/webrtc/app/OpenSlRunner.java similarity index 100% rename from webrtc/modules/audio_device/android/test/src/org/webrtc/app/OpenSlRunner.java rename to webrtc/examples/android/opensl_loopback/src/org/webrtc/app/OpenSlRunner.java diff --git a/webrtc/modules/audio_device/audio_device.gypi b/webrtc/modules/audio_device/audio_device.gypi index de008e885a..944f4222df 100644 --- a/webrtc/modules/audio_device/audio_device.gypi +++ b/webrtc/modules/audio_device/audio_device.gypi @@ -246,70 +246,6 @@ }, ], }], - ['OS=="android"', { - 'targets': [ - { - 'target_name': 'libopensl-demo-jni', - 'type': 'loadable_module', - 'dependencies': [ - 'audio_device', - ], - 'sources': [ - 'android/test/jni/opensl_runner.cc', - 'android/test/fake_audio_device_buffer.cc', - ], - 'link_settings': { - 'libraries': [ - '-llog', - '-lOpenSLES', - ], - }, - }, - { - 'target_name': 'OpenSlDemo', - 'type': 'none', - 'dependencies': [ - 'libopensl-demo-jni', - '<(modules_java_gyp_path):*', - ], - 'actions': [ - { - # TODO(henrik): Convert building of the demo to a proper GYP - # target so this action is not needed once chromium's - # apk-building machinery can be used. (crbug.com/225101) - 'action_name': 'build_opensldemo_apk', - 'variables': { - 'android_opensl_demo_root': '<(webrtc_root)/modules/audio_device/android/test', - 'ant_log': '../../../<(INTERMEDIATE_DIR)/ant.log', # ../../.. to compensate for the cd below. - }, - 'inputs' : [ - '<(PRODUCT_DIR)/lib.java/audio_device_module_java.jar', - '<(PRODUCT_DIR)/libopensl-demo-jni.so', - ' /dev/null && ' - 'cp <(android_opensl_demo_root)/bin/OpenSlDemo-debug.apk <(_outputs)' - ], - }, - ], - }], - }], ['OS=="android" and enable_android_opensl==1', { 'targets': [ { diff --git a/webrtc/webrtc_examples.gyp b/webrtc/webrtc_examples.gyp index 328681af6b..a7565ae9ce 100644 --- a/webrtc/webrtc_examples.gyp +++ b/webrtc/webrtc_examples.gyp @@ -7,7 +7,6 @@ # be found in the AUTHORS file in the root of the source tree. { 'includes': ['build/common.gypi'], - 'conditions': [ ['OS=="android"', { 'targets': [ @@ -83,6 +82,67 @@ }, ], }, + { + 'target_name': 'libopensl-demo-jni', + 'type': 'loadable_module', + 'dependencies': [ + '<(webrtc_root)/modules/modules.gyp:audio_device', + ], + 'sources': [ + 'examples/android/opensl_loopback/jni/opensl_runner.cc', + 'examples/android/opensl_loopback/fake_audio_device_buffer.cc', + ], + 'link_settings': { + 'libraries': [ + '-llog', + '-lOpenSLES', + ], + }, + }, + { + 'target_name': 'OpenSlDemo', + 'type': 'none', + 'dependencies': [ + 'libopensl-demo-jni', + '<(modules_java_gyp_path):*', + ], + 'actions': [ + { + # TODO(henrik): Convert building of the demo to a proper GYP + # target so this action is not needed once chromium's + # apk-building machinery can be used. (crbug.com/225101) + 'action_name': 'build_opensldemo_apk', + 'variables': { + 'android_opensl_demo_root': '<(webrtc_root)/examples/android/opensl_loopback', + 'ant_log': '../../../<(INTERMEDIATE_DIR)/ant.log', # ../../.. to compensate for the cd below. + }, + 'inputs' : [ + '<(PRODUCT_DIR)/lib.java/audio_device_module_java.jar', + '<(PRODUCT_DIR)/libopensl-demo-jni.so', + ' /dev/null && ' + 'cp <(android_opensl_demo_root)/bin/OpenSlDemo-debug.apk <(_outputs)' + ], + }, + ], + }, ], }], ],