Make test app work on android
Review URL: http://webrtc-codereview.appspot.com/137014 git-svn-id: http://webrtc.googlecode.com/svn/trunk@525 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
fb298d3783
commit
9d23ba096d
25
src/voice_engine/main/test/android/android_test/Android.mk
Normal file
25
src/voice_engine/main/test/android/android_test/Android.mk
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Copyright (c) 2011 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.
|
||||||
|
|
||||||
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := tests
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := \
|
||||||
|
src/org/webrtc/voiceengine/test/AndroidTest.java
|
||||||
|
|
||||||
|
LOCAL_PACKAGE_NAME := webrtc-voice-demo
|
||||||
|
LOCAL_CERTIFICATE := platform
|
||||||
|
|
||||||
|
LOCAL_JNI_SHARED_LIBRARIES := libwebrtc-voice-demo-jni
|
||||||
|
|
||||||
|
include $(BUILD_PACKAGE)
|
||||||
|
|
||||||
|
include $(call all-makefiles-under,$(LOCAL_PATH))
|
@ -6,6 +6,8 @@
|
|||||||
# in the file PATENTS. All contributing project authors may
|
# in the file PATENTS. All contributing project authors may
|
||||||
# be found in the AUTHORS file in the root of the source tree.
|
# be found in the AUTHORS file in the root of the source tree.
|
||||||
|
|
||||||
|
ifdef NDK_ROOT
|
||||||
|
|
||||||
MY_WEBRTC_ROOT_PATH := $(call my-dir)
|
MY_WEBRTC_ROOT_PATH := $(call my-dir)
|
||||||
|
|
||||||
MY_WEBRTC_SRC_PATH := ../../../../../../..
|
MY_WEBRTC_SRC_PATH := ../../../../../../..
|
||||||
@ -64,9 +66,6 @@ LOCAL_SHARED_LIBRARIES := \
|
|||||||
|
|
||||||
LOCAL_PRELINK_MODULE := false
|
LOCAL_PRELINK_MODULE := false
|
||||||
|
|
||||||
ifndef NDK_ROOT
|
|
||||||
include external/stlport/libstlport.mk
|
|
||||||
endif
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
###
|
###
|
||||||
@ -76,7 +75,7 @@ LOCAL_PATH := $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_ARM_MODE := arm
|
LOCAL_ARM_MODE := arm
|
||||||
LOCAL_MODULE := libwebrtc
|
LOCAL_MODULE := libwebrtc-voice-demo-jni
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
|
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||||
@ -109,7 +108,37 @@ LOCAL_SHARED_LIBRARIES := \
|
|||||||
|
|
||||||
LOCAL_PRELINK_MODULE := false
|
LOCAL_PRELINK_MODULE := false
|
||||||
|
|
||||||
ifndef NDK_ROOT
|
|
||||||
include external/stlport/libstlport.mk
|
|
||||||
endif
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := tests
|
||||||
|
LOCAL_MODULE := libwebrtc-voice-demo-jni
|
||||||
|
LOCAL_CPP_EXTENSION := .cc
|
||||||
|
LOCAL_SRC_FILES := android_test.cc
|
||||||
|
LOCAL_CFLAGS := \
|
||||||
|
'-DWEBRTC_TARGET_PC' \
|
||||||
|
'-DWEBRTC_ANDROID'
|
||||||
|
|
||||||
|
LOCAL_C_INCLUDES := \
|
||||||
|
$(LOCAL_PATH)/../../../auto_test \
|
||||||
|
$(LOCAL_PATH)/../../../../interface \
|
||||||
|
$(LOCAL_PATH)/../../../../../.. \
|
||||||
|
$(LOCAL_PATH)/../../../../../../system_wrappers/interface
|
||||||
|
|
||||||
|
LOCAL_PRELINK_MODULE := false
|
||||||
|
|
||||||
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
|
libutils \
|
||||||
|
libstlport \
|
||||||
|
libandroid \
|
||||||
|
libwebrtc \
|
||||||
|
libGLESv2
|
||||||
|
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
endif
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.5 KiB |
@ -9,5 +9,5 @@
|
|||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">WebRtc VoiceEngine Android Test</string>
|
<string name="app_name">WebRtc VoE</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license that can be found
|
* 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
|
* 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
|
* intellectual property rights grant can be found in the file PATENTS. All
|
||||||
@ -185,25 +185,19 @@ public class AndroidTest extends Activity {
|
|||||||
this,
|
this,
|
||||||
android.R.layout.simple_spinner_dropdown_item,
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
ap4);
|
ap4);
|
||||||
String codecs[] = {"iSAC", "PCMU", "PCMA", "iLBC", "G.729"};
|
String codecs[] = {"iSAC", "PCMU", "PCMA", "iLBC"};
|
||||||
final ArrayAdapter<String> adapterCodecs = new ArrayAdapter<String>(
|
final ArrayAdapter<String> adapterCodecs = new ArrayAdapter<String>(
|
||||||
this,
|
this,
|
||||||
android.R.layout.simple_spinner_dropdown_item,
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
codecs);
|
codecs);
|
||||||
String audio[] =
|
|
||||||
{"Volume Up", "Volume Down", "Loudspeaker", "Earpiece"};
|
|
||||||
final ArrayAdapter<String> adapterAudio = new ArrayAdapter<String>(
|
|
||||||
this,
|
|
||||||
android.R.layout.simple_spinner_dropdown_item,
|
|
||||||
audio);
|
|
||||||
|
|
||||||
final Spinner spinnerSettings1 = (Spinner) findViewById(R.id.Spinner01);
|
final Spinner spinnerSettings1 = (Spinner) findViewById(R.id.Spinner01);
|
||||||
final Spinner spinnerSettings2 = (Spinner) findViewById(R.id.Spinner02);
|
final Spinner spinnerSettings2 = (Spinner) findViewById(R.id.Spinner02);
|
||||||
spinnerSettings1.setMinimumWidth(200);
|
spinnerSettings1.setMinimumWidth(200);
|
||||||
String settings[] =
|
String settings[] =
|
||||||
{"Audio", "Codec", "Echo Control", "Noise Suppression",
|
{"Codec", "Echo Control", "Noise Suppression",
|
||||||
"Automatic Gain Control",
|
"Automatic Gain Control",
|
||||||
"Voice Activity Detection"};
|
"Voice Activity Detection"};
|
||||||
ArrayAdapter<String> adapterSettings1 = new ArrayAdapter<String>(
|
ArrayAdapter<String> adapterSettings1 = new ArrayAdapter<String>(
|
||||||
this,
|
this,
|
||||||
android.R.layout.simple_spinner_dropdown_item,
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
@ -217,26 +211,22 @@ public class AndroidTest extends Activity {
|
|||||||
_settingMenu = position;
|
_settingMenu = position;
|
||||||
_settingSet = false;
|
_settingSet = false;
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
spinnerSettings2.setAdapter(adapterAudio);
|
|
||||||
spinnerSettings2.setSelection(_audioIndex);
|
|
||||||
}
|
|
||||||
if (position == 1) {
|
|
||||||
spinnerSettings2.setAdapter(adapterCodecs);
|
spinnerSettings2.setAdapter(adapterCodecs);
|
||||||
spinnerSettings2.setSelection(_codecIndex);
|
spinnerSettings2.setSelection(_codecIndex);
|
||||||
}
|
}
|
||||||
if (position == 2) {
|
if (position == 1) {
|
||||||
spinnerSettings2.setAdapter(adapterAp1);
|
spinnerSettings2.setAdapter(adapterAp1);
|
||||||
spinnerSettings2.setSelection(_ecIndex);
|
spinnerSettings2.setSelection(_ecIndex);
|
||||||
}
|
}
|
||||||
if (position == 3) {
|
if (position == 2) {
|
||||||
spinnerSettings2.setAdapter(adapterAp2);
|
spinnerSettings2.setAdapter(adapterAp2);
|
||||||
spinnerSettings2.setSelection(_nsIndex);
|
spinnerSettings2.setSelection(_nsIndex);
|
||||||
}
|
}
|
||||||
if (position == 4) {
|
if (position == 3) {
|
||||||
spinnerSettings2.setAdapter(adapterAp3);
|
spinnerSettings2.setAdapter(adapterAp3);
|
||||||
spinnerSettings2.setSelection(_agcIndex);
|
spinnerSettings2.setSelection(_agcIndex);
|
||||||
}
|
}
|
||||||
if (position == 5) {
|
if (position == 4) {
|
||||||
spinnerSettings2.setAdapter(adapterAp4);
|
spinnerSettings2.setAdapter(adapterAp4);
|
||||||
spinnerSettings2.setSelection(_vadIndex);
|
spinnerSettings2.setSelection(_vadIndex);
|
||||||
}
|
}
|
||||||
@ -389,7 +379,7 @@ public class AndroidTest extends Activity {
|
|||||||
Create(); // Error logging is done in native API wrapper
|
Create(); // Error logging is done in native API wrapper
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
if (0 != Init(0, 0, 0, false, false)) {
|
if (0 != Init(false, false)) {
|
||||||
WebrtcLog("VoE init failed");
|
WebrtcLog("VoE init failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,12 +431,6 @@ public class AndroidTest extends Activity {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set volume to default value
|
|
||||||
if (0 != SetSpeakerVolume(_volumeLevel)) {
|
|
||||||
WebrtcLog("VoE set speaker volume failed");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WebrtcLog("VoE start record now"); if (0 !=
|
* WebrtcLog("VoE start record now"); if (0 !=
|
||||||
* StartRecordingPlayout(_channel, "/sdcard/singleUserDemoOut.pcm",
|
* StartRecordingPlayout(_channel, "/sdcard/singleUserDemoOut.pcm",
|
||||||
@ -1185,14 +1169,15 @@ public class AndroidTest extends Activity {
|
|||||||
private native int SetLoudspeakerStatus(boolean enable);
|
private native int SetLoudspeakerStatus(boolean enable);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this is used to load the 'AndroidJavaAPI' library on application startup.
|
* this is used to load the 'webrtc-voice-demo-jni'
|
||||||
|
* library on application startup.
|
||||||
* The library has already been unpacked into
|
* The library has already been unpacked into
|
||||||
* /data/data/webrtc.android.AndroidTest/lib/libAndroidJavaAPI.so at
|
* /data/data/webrtc.android.AndroidTest/lib/libwebrtc-voice-demo-jni.so
|
||||||
* installation time by the package manager.
|
* at installation time by the package manager.
|
||||||
*/
|
*/
|
||||||
static {
|
static {
|
||||||
Log.d("*Webrtc*", "Loading AndroidJavaAPI...");
|
Log.d("*Webrtc*", "Loading webrtc-voice-demo-jni...");
|
||||||
System.loadLibrary("AndroidJavaAPI");
|
System.loadLibrary("webrtc-voice-demo-jni");
|
||||||
|
|
||||||
Log.d("*Webrtc*", "Calling native init...");
|
Log.d("*Webrtc*", "Calling native init...");
|
||||||
if (!NativeInit()) {
|
if (!NativeInit()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user