Add VoiceEngine apm settings to test application
Implement apm settings and add a small bug fix BUG= TEST=build and test on android Review URL: https://webrtc-codereview.appspot.com/632008 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2390 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
be581640c1
commit
6724c4239b
@ -408,18 +408,18 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1Set
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VoE_SetECStatus
|
||||
* Signature: (ZIII)I
|
||||
* Signature: (Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1SetECStatus
|
||||
(JNIEnv *, jobject, jboolean, jint, jint, jint);
|
||||
(JNIEnv *, jobject, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VoE_SetAGCStatus
|
||||
* Signature: (ZI)I
|
||||
* Signature: (Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1SetAGCStatus
|
||||
(JNIEnv *, jobject, jboolean, jint);
|
||||
(JNIEnv *, jobject, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
@ -427,7 +427,7 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1Set
|
||||
* Signature: (ZI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1SetNSStatus
|
||||
(JNIEnv *, jobject, jboolean, jint);
|
||||
(JNIEnv *, jobject, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -1526,48 +1526,47 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1Set
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VoE_SetECStatus
|
||||
* Signature: (ZIII)I
|
||||
* Signature: (Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1SetECStatus(
|
||||
JNIEnv *,
|
||||
jobject,
|
||||
jboolean enable,
|
||||
jint mode,
|
||||
jint AESmode,
|
||||
jint AESattenuation)
|
||||
{
|
||||
// TODO(leozwang) implement
|
||||
return -1;
|
||||
jboolean enable) {
|
||||
VALIDATE_APM_POINTER;
|
||||
if (voeData.apm->SetEcStatus(enable, kEcAecm) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VoE_SetAGCStatus
|
||||
* Signature: (ZI)I
|
||||
* Signature: (Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1SetAGCStatus(
|
||||
JNIEnv *,
|
||||
jobject,
|
||||
jboolean enable,
|
||||
jint mode)
|
||||
{
|
||||
// TODO(leozwang) implement
|
||||
return -1;
|
||||
jboolean enable) {
|
||||
VALIDATE_APM_POINTER;
|
||||
if (voeData.apm->SetAgcStatus(enable) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VoE_SetNSStatus
|
||||
* Signature: (ZI)I
|
||||
* Signature: (Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1SetNSStatus(
|
||||
JNIEnv *,
|
||||
jobject,
|
||||
jboolean enable,
|
||||
jint mode)
|
||||
{
|
||||
// TODO(leozwang) implement
|
||||
return -1;
|
||||
jboolean enable) {
|
||||
VALIDATE_APM_POINTER;
|
||||
if (voeData.apm->SetNsStatus(enable) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@ -1,81 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:orientation="vertical"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textSize="24dip"
|
||||
android:text="Audio Settings"></TextView>
|
||||
<TextView android:id="@+id/TextView03"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
</TextView>
|
||||
<TextView android:id="@+id/TextView01"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/codecType">
|
||||
</TextView>
|
||||
<Spinner android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:id="@+id/spVoiceCodecType">
|
||||
</Spinner>
|
||||
|
||||
<LinearLayout android:id="@+id/LinearLayout02"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent">
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/aTxPort">
|
||||
</TextView>
|
||||
<EditText android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/etATxPort">
|
||||
</EditText>
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/aRxPort">
|
||||
</TextView>
|
||||
<EditText android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/etARxPort" >
|
||||
</EditText>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/LinearLayout02"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent">
|
||||
<CheckBox android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cbSpeaker"
|
||||
android:text="@string/speaker">
|
||||
</CheckBox>
|
||||
<CheckBox android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cbAutoGainControl"
|
||||
android:text="@string/AutoGainControl">
|
||||
</CheckBox>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/LinearLayout02"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent">
|
||||
<CheckBox android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cbAECM"
|
||||
android:text="@string/AECM">
|
||||
</CheckBox>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/LinearLayout03"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent">
|
||||
<CheckBox android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cbNoiseSuppression"
|
||||
android:text="@string/NoiseSuppression">
|
||||
</CheckBox>
|
||||
</LinearLayout>
|
||||
android:layout_height="fill_parent" android:orientation="vertical"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textSize="24dip"
|
||||
android:text="Audio Settings"></TextView>
|
||||
<TextView android:id="@+id/TextView03"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
</TextView>
|
||||
<TextView android:id="@+id/TextView01"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/codecType">
|
||||
</TextView>
|
||||
<Spinner android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:id="@+id/spVoiceCodecType">
|
||||
</Spinner>
|
||||
|
||||
<LinearLayout android:id="@+id/LinearLayout02"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent">
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/aTxPort">
|
||||
</TextView>
|
||||
<EditText android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/etATxPort">
|
||||
</EditText>
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/aRxPort">
|
||||
</TextView>
|
||||
<EditText android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/etARxPort" >
|
||||
</EditText>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/LinearLayout02"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent">
|
||||
<CheckBox android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cbAECM"
|
||||
android:text="@string/AECM">
|
||||
</CheckBox>
|
||||
<CheckBox android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cbNoiseSuppression"
|
||||
android:text="@string/NoiseSuppression">
|
||||
</CheckBox>
|
||||
<CheckBox android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cbAutoGainControl"
|
||||
android:text="@string/AutoGainControl">
|
||||
</CheckBox>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/LinearLayout02"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent">
|
||||
<CheckBox android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cbSpeaker"
|
||||
android:text="@string/speaker">
|
||||
</CheckBox>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">WebRTC</string>
|
||||
<string name="error">Error</string>
|
||||
<string name="errorCamera">Camera Error</string>
|
||||
<resources>
|
||||
<string name="app_name">WebRTC</string>
|
||||
<string name="error">Error</string>
|
||||
<string name="errorCamera">Camera Error</string>
|
||||
<string name="codectype_prompt">Choose a codec type</string>
|
||||
<string name="demoTitle">Video Engine Android Demo</string>
|
||||
<string name="codecType">Codec Type</string>
|
||||
@ -22,10 +22,10 @@
|
||||
<string name="vRxPort">Video Rx Port</string>
|
||||
<string name="aTxPort">Audio Tx Port</string>
|
||||
<string name="aRxPort">Audio Rx Port</string>
|
||||
<string name="AutoGainControl">Auto Gain Control</string>
|
||||
<string name="VoiceActivityDetection">Voice Activity Detection</string>
|
||||
<string name="AECM">Acoustic Echo Control</string>
|
||||
<string name="NoiseSuppression">Noise Suppression</string>
|
||||
<string name="AutoGainControl">AGC</string>
|
||||
<string name="VoiceActivityDetection">VAD</string>
|
||||
<string name="AECM">AECM</string>
|
||||
<string name="NoiseSuppression">NS</string>
|
||||
<string name="nack">NACK</string>
|
||||
<string name="frontCamera">SwitchToFront</string>
|
||||
<string name="backCamera">SwitchToBack</string>
|
||||
|
||||
@ -114,15 +114,17 @@ public class ViEAndroidJavaAPI {
|
||||
public native int VoE_SetLoudspeakerStatus(boolean enable);
|
||||
|
||||
// Playout file locally
|
||||
public native int VoE_StartPlayingFileLocally(int channel,
|
||||
String fileName,
|
||||
boolean loop);
|
||||
public native int VoE_StartPlayingFileLocally(
|
||||
int channel,
|
||||
String fileName,
|
||||
boolean loop);
|
||||
public native int VoE_StopPlayingFileLocally(int channel);
|
||||
|
||||
// Play file as microphone
|
||||
public native int VoE_StartPlayingFileAsMicrophone(int channel,
|
||||
String fileName,
|
||||
boolean loop);
|
||||
public native int VoE_StartPlayingFileAsMicrophone(
|
||||
int channel,
|
||||
String fileName,
|
||||
boolean loop);
|
||||
public native int VoE_StopPlayingFileAsMicrophone(int channel);
|
||||
|
||||
// Codec-setting functions
|
||||
@ -131,8 +133,7 @@ public class ViEAndroidJavaAPI {
|
||||
public native int VoE_SetSendCodec(int channel, int index);
|
||||
|
||||
//VE funtions
|
||||
public native int VoE_SetECStatus(boolean enable, int mode,
|
||||
int AESmode, int AESattenuation);
|
||||
public native int VoE_SetAGCStatus(boolean enable, int mode);
|
||||
public native int VoE_SetNSStatus(boolean enable, int mode);
|
||||
public native int VoE_SetECStatus(boolean enable);
|
||||
public native int VoE_SetAGCStatus(boolean enable);
|
||||
public native int VoE_SetNSStatus(boolean enable);
|
||||
}
|
||||
|
||||
@ -131,8 +131,8 @@ public class WebRTCDemo extends TabActivity implements IViEAndroidCallback,
|
||||
private Spinner spCodecType;
|
||||
private int codecType = 0;
|
||||
private Spinner spCodecSize;
|
||||
private int codecSizeWidth = 352;
|
||||
private int codecSizeHeight = 288;
|
||||
private int codecSizeWidth = 0;
|
||||
private int codecSizeHeight = 0;
|
||||
private TextView etVRxPort;
|
||||
private int receivePortVideo = 11111;
|
||||
private TextView etVTxPort;
|
||||
@ -497,6 +497,9 @@ public class WebRTCDemo extends TabActivity implements IViEAndroidCallback,
|
||||
|
||||
cbEnableAGC.setOnClickListener(this);
|
||||
cbEnableNS.setOnClickListener(this);
|
||||
|
||||
// Read settings to refresh each configuration
|
||||
ReadSettings();
|
||||
}
|
||||
|
||||
private void StartCall() {
|
||||
@ -664,15 +667,22 @@ public class WebRTCDemo extends TabActivity implements IViEAndroidCallback,
|
||||
Log.d(TAG, "VoE set send destination failed");
|
||||
}
|
||||
|
||||
// 0 = iPCM-wb, 5 = PCMU
|
||||
if (0 != ViEAndroidAPI.VoE_SetSendCodec(voiceChannel, voiceCodecType)) {
|
||||
Log.d(TAG, "VoE set send codec failed");
|
||||
}
|
||||
|
||||
if (0 != ViEAndroidAPI.VoE_SetECStatus(enableAECM, 5, 0, 28)){
|
||||
if (0 != ViEAndroidAPI.VoE_SetECStatus(enableAECM)) {
|
||||
Log.d(TAG, "VoE set EC Status failed");
|
||||
}
|
||||
|
||||
if (0 != ViEAndroidAPI.VoE_SetAGCStatus(enableAGC)) {
|
||||
Log.d(TAG, "VoE set AGC Status failed");
|
||||
}
|
||||
|
||||
if (0 != ViEAndroidAPI.VoE_SetNSStatus(enableNS)) {
|
||||
Log.d(TAG, "VoE set NS Status failed");
|
||||
}
|
||||
|
||||
if (0 != ViEAndroidAPI.VoE_StartSend(voiceChannel)) {
|
||||
Log.d(TAG, "VoE start send failed");
|
||||
}
|
||||
@ -765,23 +775,19 @@ public class WebRTCDemo extends TabActivity implements IViEAndroidCallback,
|
||||
case R.id.cbAutoGainControl:
|
||||
enableAGC=cbEnableAGC.isChecked();
|
||||
if(voERunning) {
|
||||
// Enable AGC default mode.
|
||||
ViEAndroidAPI.VoE_SetAGCStatus(enableAGC,1);
|
||||
ViEAndroidAPI.VoE_SetAGCStatus(enableAGC);
|
||||
}
|
||||
break;
|
||||
case R.id.cbNoiseSuppression:
|
||||
enableNS=cbEnableNS.isChecked();
|
||||
if(voERunning) {
|
||||
// Enable NS default mode.
|
||||
ViEAndroidAPI.VoE_SetNSStatus(enableNS, 1);
|
||||
ViEAndroidAPI.VoE_SetNSStatus(enableNS);
|
||||
}
|
||||
break;
|
||||
case R.id.cbAECM:
|
||||
enableAECM = cbEnableAECM.isChecked();
|
||||
if (voERunning) {
|
||||
// EC_AECM=5
|
||||
// AECM_DEFAULT=0
|
||||
ViEAndroidAPI.VoE_SetECStatus(enableAECM, 5, 0, 28);
|
||||
ViEAndroidAPI.VoE_SetECStatus(enableAECM);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user