git-svn-id: http://webrtc.googlecode.com/svn/trunk@9 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
9
video_engine/main/test/AndroidTest/.classpath
Normal file
9
video_engine/main/test/AndroidTest/.classpath
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="lib" path="libs/VideoEngine_android_java.jar"/>
|
||||
<classpathentry kind="lib" path="libs/VoiceEngine_android_java.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
33
video_engine/main/test/AndroidTest/.project
Normal file
33
video_engine/main/test/AndroidTest/.project
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>ViEAndroidDemo</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
25
video_engine/main/test/AndroidTest/AndroidManifest.xml
Normal file
25
video_engine/main/test/AndroidTest/AndroidManifest.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="1" package="org.webrtc.videoengineapp" android:versionName="1.07">
|
||||
<application android:icon="@drawable/logo" android:label="@string/app_name" android:debuggable="true">
|
||||
<activity android:name=".ViEAndroidDemo"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
>
|
||||
<!--android:configChanges="keyboardHidden|orientation" -->
|
||||
<!-- android:screenOrientation="landscape" -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="7" />
|
||||
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
</manifest>
|
||||
13
video_engine/main/test/AndroidTest/default.properties
Normal file
13
video_engine/main/test/AndroidTest/default.properties
Normal file
@@ -0,0 +1,13 @@
|
||||
# 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,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Indicates whether an apk should be generated for each density.
|
||||
split.density=false
|
||||
# Project target.
|
||||
target=android-9
|
||||
@@ -0,0 +1,68 @@
|
||||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package org.webrtc.videoengineapp;
|
||||
|
||||
public final class R {
|
||||
public static final class array {
|
||||
public static final int codecSize=0x7f040001;
|
||||
public static final int codectype=0x7f040000;
|
||||
public static final int voiceCodecType=0x7f040002;
|
||||
}
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int bar=0x7f020000;
|
||||
public static final int bg=0x7f020001;
|
||||
public static final int logo=0x7f020002;
|
||||
public static final int robot=0x7f020003;
|
||||
public static final int video=0x7f020004;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int LinearLayout01=0x7f060010;
|
||||
public static final int LinearLayout02=0x7f060006;
|
||||
public static final int TextView01=0x7f060005;
|
||||
public static final int TextView02=0x7f06000b;
|
||||
public static final int TextView03=0x7f060004;
|
||||
public static final int btStartBoth=0x7f060013;
|
||||
public static final int btStartListen=0x7f060011;
|
||||
public static final int btStartSend=0x7f060012;
|
||||
public static final int cbLoopback=0x7f06000e;
|
||||
public static final int cbVoice=0x7f06000d;
|
||||
public static final int etRemoteIp=0x7f06000c;
|
||||
public static final int ivPreview=0x7f060014;
|
||||
public static final int ivTopBar=0x7f060002;
|
||||
public static final int rlSurfaces=0x7f060000;
|
||||
public static final int spCodecSize=0x7f06000a;
|
||||
public static final int spCodecType=0x7f060007;
|
||||
public static final int spVoiceCodecType=0x7f060008;
|
||||
public static final int svLocal=0x7f060001;
|
||||
public static final int tvCodecSize=0x7f060009;
|
||||
public static final int tvLocalIp=0x7f06000f;
|
||||
public static final int tvTitle=0x7f060003;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int both=0x7f030000;
|
||||
public static final int main=0x7f030001;
|
||||
public static final int send=0x7f030002;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f050001;
|
||||
public static final int codecSize=0x7f050007;
|
||||
public static final int codecType=0x7f050006;
|
||||
public static final int codectype_prompt=0x7f050004;
|
||||
public static final int demoTitle=0x7f050005;
|
||||
public static final int enableVoice=0x7f05000d;
|
||||
public static final int error=0x7f050002;
|
||||
public static final int errorCamera=0x7f050003;
|
||||
public static final int loopback=0x7f050009;
|
||||
public static final int remoteIp=0x7f050008;
|
||||
public static final int startBoth=0x7f05000c;
|
||||
public static final int startListen=0x7f05000a;
|
||||
public static final int startSend=0x7f05000b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,442 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_webrtc_videoengineapp_ViEAndroidJavaAPI */
|
||||
|
||||
#ifndef _Included_org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
#define _Included_org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: NativeInit
|
||||
* Signature: (Landroid/content/Context;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_NativeInit
|
||||
(JNIEnv *, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: GetVideoEngine
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_GetVideoEngine
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: Init
|
||||
* Signature: (IIIZ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1Init
|
||||
(JNIEnv *, jobject, jint, jint, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: Terminate
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1Terminate
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StartSend
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StartSend
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StopRender
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StopRender
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StopSend
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StopSend
|
||||
(JNIEnv *, jobject,jint);
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StartReceive
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StartReceive
|
||||
(JNIEnv *, jobject,jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StopReceive
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StopReceive
|
||||
(JNIEnv *, jobject,jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: CreateChannel
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1CreateChannel
|
||||
(JNIEnv *, jobject,jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: SetLocalReceiver
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1SetLocalReceiver
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: SetSendDestination
|
||||
* Signature: (II[B)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1SetSendDestination
|
||||
(JNIEnv *, jobject, jint, jint, jbyteArray);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: SetReceiveCodec
|
||||
* Signature: (IIIIIIZ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1SetReceiveCodec
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: SetSendCodec
|
||||
* Signature: (IIIIIIZ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1SetSendCodec
|
||||
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: AddRemoteRenderer
|
||||
* Signature: (ILandroid/view/SurfaceView;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1AddRemoteRenderer
|
||||
(JNIEnv *, jobject, jint, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: RemoveRemoteRenderer
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1RemoveRemoteRenderer
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StartRender
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StartRender
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StartCamera
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StartCamera
|
||||
(JNIEnv *, jobject,jint channel,jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StopCamera
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StopCamera
|
||||
(JNIEnv *, jobject,jint);
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: GetCameraOrientation
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1GetCameraOrientation
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: SetRotation
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1SetRotation
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: EnableNACK
|
||||
* Signature: (IZ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1EnableNACK
|
||||
(JNIEnv *, jobject, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: EnablePLI
|
||||
* Signature: (IZ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1EnablePLI
|
||||
(JNIEnv *, jobject, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StartSendNative
|
||||
* Signature: (III[BIIIIIILandroid/view/SurfaceView;III)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StartSendNative
|
||||
(JNIEnv *, jobject, jint, jint, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jobject, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StartListenNative
|
||||
* Signature: (III[BIIIIIIILandroid/view/SurfaceView;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StartListenNative
|
||||
(JNIEnv *, jobject, jint, jint, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jint, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: StopAllNative
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1StopAllNative
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: SetCallback
|
||||
* Signature: (ILorg/webrtc/videoengineapp/IViEAndroidCallback;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_1SetCallback
|
||||
(JNIEnv *, jobject, jint, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_Create
|
||||
* Signature: (Landroid/app/Activity;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1Create
|
||||
(JNIEnv *, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_Delete
|
||||
* Signature: ()Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1Delete
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_Init
|
||||
* Signature: (IIIZZ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1Init
|
||||
(JNIEnv *, jobject, jint, jint, jint, jboolean, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_Terminate
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1Terminate
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_CreateChannel
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1CreateChannel
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_DeleteChannel
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1DeleteChannel
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_SetLocalReceiver
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1SetLocalReceiver
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_SetSendDestination
|
||||
* Signature: (IILjava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1SetSendDestination
|
||||
(JNIEnv *, jobject, jint, jint, jstring);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_StartListen
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1StartListen
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_StartPlayout
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1StartPlayout
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_StartSend
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1StartSend
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_StopListen
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1StopListen
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_StopPlayout
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1StopPlayout
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_StopSend
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1StopSend
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_SetSpeakerVolume
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1SetSpeakerVolume
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_SetLoudspeakerStatus
|
||||
* Signature: (Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1SetLoudspeakerStatus
|
||||
(JNIEnv *, jobject, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_StartPlayingFileLocally
|
||||
* Signature: (ILjava/lang/String;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1StartPlayingFileLocally
|
||||
(JNIEnv *, jobject, jint, jstring, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_StopPlayingFileLocally
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1StopPlayingFileLocally
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_StartPlayingFileAsMicrophone
|
||||
* Signature: (ILjava/lang/String;Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1StartPlayingFileAsMicrophone
|
||||
(JNIEnv *, jobject, jint, jstring, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_StopPlayingFileAsMicrophone
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1StopPlayingFileAsMicrophone
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_NumOfCodecs
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1NumOfCodecs
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_SetSendCodec
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1SetSendCodec
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_SetECStatus
|
||||
* Signature: (ZI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1SetECStatus
|
||||
(JNIEnv *, jobject, jboolean, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_SetNSStatus
|
||||
* Signature: (ZI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1SetNSStatus
|
||||
(JNIEnv *, jobject, jboolean, jint);
|
||||
|
||||
/*
|
||||
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
|
||||
* Method: VE_SetAGCStatus
|
||||
* Signature: (ZI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VE_1SetAGCStatus
|
||||
(JNIEnv *, jobject, jboolean, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
1751
video_engine/main/test/AndroidTest/jni/vie_android_java_api.cc
Normal file
1751
video_engine/main/test/AndroidTest/jni/vie_android_java_api.cc
Normal file
File diff suppressed because it is too large
Load Diff
BIN
video_engine/main/test/AndroidTest/res/drawable/logo.png
Normal file
BIN
video_engine/main/test/AndroidTest/res/drawable/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 409 B |
35
video_engine/main/test/AndroidTest/res/layout/aconfig.xml
Normal file
35
video_engine/main/test/AndroidTest/res/layout/aconfig.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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>
|
||||
|
||||
</LinearLayout>
|
||||
43
video_engine/main/test/AndroidTest/res/layout/both.xml
Normal file
43
video_engine/main/test/AndroidTest/res/layout/both.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="120dip"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout android:id="@+id/llLocalView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="80dip">
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="" />
|
||||
<Button android:id="@+id/btSwitchCamera"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/frontCamera"
|
||||
android:layout_gravity="bottom"/>
|
||||
<Button android:id="@+id/btStartStopCall"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/startCall"
|
||||
android:layout_gravity="bottom"/>
|
||||
<Button android:id="@+id/btExit"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:text="@string/exit"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/llRemoteView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1">
|
||||
</LinearLayout>
|
||||
</LinearLayout >
|
||||
|
||||
19
video_engine/main/test/AndroidTest/res/layout/main.xml
Normal file
19
video_engine/main/test/AndroidTest/res/layout/main.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:layout_gravity="right"
|
||||
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tvTitle" android:textStyle="bold" android:textSize="24dip" android:text="@string/gSettings"></TextView>
|
||||
<TextView android:id="@+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
|
||||
<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/cbVideoReceive" android:text="@string/enableVideoReceive"></CheckBox>
|
||||
<CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cbVideoSend" android:text="@string/enableVideoSend"></CheckBox>
|
||||
</LinearLayout>
|
||||
<CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cbVoice" android:text="@string/enableVoice"></CheckBox>
|
||||
|
||||
<TextView android:id="@+id/TextView02" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:text="@string/remoteIp"></TextView>
|
||||
<EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/etRemoteIp" ></EditText>
|
||||
|
||||
<CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cbLoopback" android:text="@string/loopback"></CheckBox>
|
||||
</LinearLayout>
|
||||
11
video_engine/main/test/AndroidTest/res/layout/send.xml
Normal file
11
video_engine/main/test/AndroidTest/res/layout/send.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
|
||||
|
||||
<SurfaceView android:id="@+id/svLocal" android:layout_width="wrap_content" android:layout_height="wrap_content"></SurfaceView><ImageView android:id="@+id/ivPreview" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
|
||||
|
||||
</LinearLayout>
|
||||
37
video_engine/main/test/AndroidTest/res/layout/stats.xml
Normal file
37
video_engine/main/test/AndroidTest/res/layout/stats.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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="Stats"></TextView>
|
||||
|
||||
<TextView android:id="@+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
|
||||
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" android:id="@+id/tvLocalIp"
|
||||
android:textStyle="bold"></TextView>
|
||||
|
||||
<TextView android:id="@+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
|
||||
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" android:id="@+id/tvFrameRateI"
|
||||
android:textStyle="bold"></TextView>
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" android:id="@+id/tvBitRateI"
|
||||
android:textStyle="bold"></TextView>
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" android:id="@+id/tvPacketLoss"
|
||||
android:textStyle="bold"></TextView>
|
||||
|
||||
<TextView android:id="@+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
|
||||
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" android:id="@+id/tvFrameRateO"
|
||||
android:textStyle="bold"></TextView>
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" android:id="@+id/tvBitRateO"
|
||||
android:textStyle="bold"></TextView>
|
||||
</LinearLayout>
|
||||
25
video_engine/main/test/AndroidTest/res/layout/tabhost.xml
Normal file
25
video_engine/main/test/AndroidTest/res/layout/tabhost.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/tabhost"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<include android:id="@+id/tab_video" layout="@layout/both" />
|
||||
<include android:id="@+id/tab_config" layout="@layout/main" />
|
||||
<include android:id="@+id/tab_vconfig" layout="@layout/vconfig" />
|
||||
<include android:id="@+id/tab_aconfig" layout="@layout/aconfig" />
|
||||
<include android:id="@+id/tab_stats" layout="@layout/stats" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
</TabHost>
|
||||
29
video_engine/main/test/AndroidTest/res/layout/vconfig.xml
Normal file
29
video_engine/main/test/AndroidTest/res/layout/vconfig.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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="@string/vSettings"></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_width="wrap_content" android:text="@string/codecType"></TextView>
|
||||
<Spinner android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" android:id="@+id/spCodecType"></Spinner>
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tvCodecSize" android:text="@string/codecSize"></TextView>
|
||||
<Spinner android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/spCodecSize"></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/vTxPort"></TextView>
|
||||
<EditText android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/etVTxPort" ></EditText>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/vRxPort"></TextView>
|
||||
<EditText android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/etVRxPort" ></EditText>
|
||||
</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/cbNack" android:text="@string/nack"></CheckBox>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
25
video_engine/main/test/AndroidTest/res/values/arrays.xml
Normal file
25
video_engine/main/test/AndroidTest/res/values/arrays.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<resources>
|
||||
|
||||
<string-array name="codectype">
|
||||
<item>H.263</item>
|
||||
<item>H.263-1998</item>
|
||||
<item>LSVX</item>
|
||||
<item>H.264</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="codecSize"><item>176x144</item><item>320x240</item>
|
||||
<item>352x288</item><item>640x480</item>
|
||||
|
||||
</string-array>
|
||||
|
||||
<string-array name="voiceCodecType">
|
||||
<item>iPCM-wb</item>
|
||||
<item>iSAC</item>
|
||||
<item>iSAC-LC</item>
|
||||
<item>EG711U</item>
|
||||
<item>EG711A</item>
|
||||
<item>PCMU</item>
|
||||
<item>PCMA</item>
|
||||
<item>iLBC</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
36
video_engine/main/test/AndroidTest/res/values/strings.xml
Normal file
36
video_engine/main/test/AndroidTest/res/values/strings.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">ViEAndroidDemo</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>
|
||||
<string name="codecSize">Codec Size</string>
|
||||
<string name="remoteIp">Remote IP address</string>
|
||||
<string name="loopback">Loopback</string>
|
||||
<string name="startListen">Start Listen</string>
|
||||
<string name="startSend">Start Send</string>
|
||||
<string name="startBoth">Start Both</string>
|
||||
<string name="enableVoice">Voice</string>
|
||||
<string name="enableVideoReceive">Video Receive</string>
|
||||
<string name="enableVideoSend">Video Send</string>
|
||||
<string name="gSettings">Global Settings</string>
|
||||
<string name="vSettings">Video Settings</string>
|
||||
<string name="vTxPort">Video Tx Port</string>
|
||||
<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="nack">NACK</string>
|
||||
<string name="frontCamera">SwitchToFront</string>
|
||||
<string name="backCamera">SwitchToBack</string>
|
||||
<string name="startCall">StartCall</string>
|
||||
<string name="stopCall">StopCall</string>
|
||||
<string name="exit">Exit</string>
|
||||
<string name="speaker">Speaker</string>
|
||||
<string name="h263DecSw">H263 SW Decoder</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO, refactoring
|
||||
*/
|
||||
|
||||
package org.webrtc.videoengineapp;
|
||||
|
||||
public interface IViEAndroidCallback {
|
||||
public int UpdateStats(int frameRateI, int bitRateI, int packetLoss, int frameRateO, int bitRateO);
|
||||
}
|
||||
@@ -0,0 +1,775 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO, refactoring
|
||||
*/
|
||||
|
||||
package org.webrtc.videoengineapp;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import org.webrtc.videoengine.ViERenderer;
|
||||
|
||||
|
||||
import android.app.TabActivity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.hardware.SensorManager;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TextView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.TabHost.TabSpec;
|
||||
import android.view.OrientationEventListener;
|
||||
|
||||
public class ViEAndroidDemo extends TabActivity implements IViEAndroidCallback,
|
||||
View.OnClickListener, OnItemSelectedListener {
|
||||
private ViEAndroidJavaAPI _ViEAndroidAPI = null;
|
||||
|
||||
// remote renderer
|
||||
private SurfaceView _remoteSurfaceView = null;
|
||||
|
||||
// local renderer and camera
|
||||
private SurfaceView _svLocal=null;
|
||||
|
||||
// channel number
|
||||
private int _channel;
|
||||
private int _cameraId;
|
||||
private int _voiceChannel=-1;
|
||||
|
||||
// flags
|
||||
private boolean _viERunning = false;
|
||||
private boolean _voERunning = false;
|
||||
|
||||
// debug
|
||||
private boolean _enableTrace = false;
|
||||
|
||||
// Constant
|
||||
private static final String LOG_TAG = "*WEBRTCJ*";
|
||||
private static final int RECEIVE_CODEC_FRAMERATE = 30;
|
||||
private static final int SEND_CODEC_FRAMERATE = 15;
|
||||
private static final int INIT_BITRATE = 400;
|
||||
|
||||
private static final int EXPIRARY_YEAR = 2010;
|
||||
private static final int EXPIRARY_MONTH = 10;
|
||||
private static final int EXPIRARY_DAY = 22;
|
||||
|
||||
private int _volumeLevel = 204;
|
||||
|
||||
private TabHost mTabHost = null;
|
||||
|
||||
private TabSpec mTabSpecConfig;
|
||||
private TabSpec mTabSpecVideo;
|
||||
|
||||
private LinearLayout mLlRemoteSurface = null;
|
||||
private LinearLayout mLlLocalSurface = null;
|
||||
|
||||
private Button _btStartStopCall;
|
||||
private Button _btSwitchCamera;
|
||||
|
||||
//Global Settings
|
||||
private CheckBox _cbVideoSend;
|
||||
private boolean _enableVideoSend = true;
|
||||
private CheckBox _cbVideoReceive;
|
||||
private boolean _enableVideoReceive = true;
|
||||
private boolean _enableVideo = true;
|
||||
private CheckBox _cbVoice;
|
||||
private boolean _enableVoice = false;
|
||||
private EditText _etRemoteIp;
|
||||
private String _remoteIp = "10.1.100.68";
|
||||
private CheckBox _cbLoopback;
|
||||
private boolean _loopbackMode = true;
|
||||
|
||||
//Video settings
|
||||
private Spinner _spCodecType;
|
||||
private int _codecType = 0;
|
||||
private Spinner _spCodecSize;
|
||||
private int _codecSizeWidth = 352;
|
||||
private int _codecSizeHeight = 288;
|
||||
private TextView _etVRxPort;
|
||||
private int _receivePortVideo = 11111;
|
||||
private TextView _etVTxPort;
|
||||
private int _destinationPortVideo = 11111;
|
||||
private CheckBox _cbEnableNack;
|
||||
private boolean _enableNack = false;
|
||||
|
||||
//Audio settings
|
||||
private Spinner _spVoiceCodecType;
|
||||
private int _voiceCodecType = 5; //PCMU = 5
|
||||
private TextView _etARxPort;
|
||||
private int _receivePortVoice = 11113;
|
||||
private TextView _etATxPort;
|
||||
private int _destinationPortVoice = 11113;
|
||||
private CheckBox _cbEnableSpeaker;
|
||||
private boolean _enableSpeaker = false;
|
||||
private CheckBox _cbEnableAGC;
|
||||
private boolean _enableAGC = false;
|
||||
private CheckBox _cbEnableAECM;
|
||||
private boolean _enableAECM = false;
|
||||
private CheckBox _cbEnableNS;
|
||||
private boolean _enableNS = false;
|
||||
|
||||
//Stats
|
||||
private TextView _tvFrameRateI;
|
||||
private TextView _tvBitRateI;
|
||||
private TextView _tvPacketLoss;
|
||||
private TextView _tvFrameRateO;
|
||||
private TextView _tvBitRateO;
|
||||
private int _frameRateI;
|
||||
private int _bitRateI;
|
||||
private int _packetLoss;
|
||||
private int _frameRateO;
|
||||
private int _bitRateO;
|
||||
|
||||
private WakeLock _wakeLock;
|
||||
|
||||
private boolean _usingFrontCamera = false;
|
||||
|
||||
private OrientationEventListener _orientationListener;
|
||||
int _currentOrientation = OrientationEventListener.ORIENTATION_UNKNOWN;
|
||||
int _currentCameraOrientation =0;
|
||||
|
||||
|
||||
//Convert current display orientation to how much the camera should be rotated.
|
||||
public int GetCameraOrientation(int cameraOrientation)
|
||||
{
|
||||
int displatyRotation = this.getWindowManager().getDefaultDisplay().getRotation();
|
||||
int degrees = 0;
|
||||
switch (displatyRotation) {
|
||||
case Surface.ROTATION_0: degrees = 0; break;
|
||||
case Surface.ROTATION_90: degrees = 90; break;
|
||||
case Surface.ROTATION_180: degrees = 180; break;
|
||||
case Surface.ROTATION_270: degrees = 270; break;
|
||||
}
|
||||
int result=0;
|
||||
if(cameraOrientation>180)
|
||||
{
|
||||
result=(cameraOrientation + degrees) % 360;
|
||||
}
|
||||
else
|
||||
{
|
||||
result=(cameraOrientation - degrees+360) % 360;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
int newRotation = GetCameraOrientation(_currentCameraOrientation);
|
||||
if (_viERunning){
|
||||
_ViEAndroidAPI.SetRotation(_cameraId,newRotation);
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
PowerManager pm = (PowerManager)this.getSystemService(
|
||||
Context.POWER_SERVICE);
|
||||
_wakeLock = pm.newWakeLock(
|
||||
PowerManager.SCREEN_DIM_WAKE_LOCK, LOG_TAG);
|
||||
|
||||
setContentView(R.layout.tabhost);
|
||||
mTabHost = getTabHost();
|
||||
|
||||
//Video tab
|
||||
mTabSpecVideo = mTabHost.newTabSpec("tab_video");
|
||||
mTabSpecVideo.setIndicator("Video");
|
||||
mTabSpecVideo.setContent(R.id.tab_video);
|
||||
mTabHost.addTab(mTabSpecVideo);
|
||||
|
||||
//Shared config tab
|
||||
mTabHost = getTabHost();
|
||||
mTabSpecConfig = mTabHost.newTabSpec("tab_config");
|
||||
mTabSpecConfig.setIndicator("Config");
|
||||
mTabSpecConfig.setContent(R.id.tab_config);
|
||||
mTabHost.addTab(mTabSpecConfig);
|
||||
|
||||
mTabHost.addTab(mTabHost.newTabSpec("tab_vconfig").setIndicator("V. Config").setContent(R.id.tab_vconfig));
|
||||
mTabHost.addTab(mTabHost.newTabSpec("tab_aconfig").setIndicator("A. Config").setContent(R.id.tab_aconfig));
|
||||
mTabHost.addTab(mTabHost.newTabSpec("tab_stats").setIndicator("Stats").setContent(R.id.tab_stats));
|
||||
|
||||
int childCount = mTabHost.getTabWidget().getChildCount();
|
||||
for (int i=0; i<childCount; i++)
|
||||
mTabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 50;
|
||||
|
||||
_orientationListener = new OrientationEventListener(this,SensorManager.SENSOR_DELAY_UI) {
|
||||
public void onOrientationChanged (int orientation) {
|
||||
if (orientation != ORIENTATION_UNKNOWN) {
|
||||
_currentOrientation = orientation;
|
||||
}
|
||||
}
|
||||
};
|
||||
_orientationListener.enable ();
|
||||
|
||||
StartMain();
|
||||
return;
|
||||
}
|
||||
|
||||
private String GetLocalIpAddress() {
|
||||
String localIPs = "";
|
||||
try {
|
||||
for (Enumeration<NetworkInterface> en = NetworkInterface
|
||||
.getNetworkInterfaces(); en.hasMoreElements();) {
|
||||
NetworkInterface intf = en.nextElement();
|
||||
for (Enumeration<InetAddress> enumIpAddr = intf
|
||||
.getInetAddresses(); enumIpAddr.hasMoreElements();) {
|
||||
InetAddress inetAddress = enumIpAddr.nextElement();
|
||||
if (!inetAddress.isLoopbackAddress()) {
|
||||
localIPs += inetAddress.getHostAddress().toString() + " ";
|
||||
//set the remote ip address the same as the local ip address of the last netif
|
||||
_remoteIp = inetAddress.getHostAddress().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException ex) {
|
||||
Log.e(LOG_TAG, ex.toString());
|
||||
}
|
||||
return localIPs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if (_viERunning){
|
||||
StopAll();
|
||||
StartMain();
|
||||
}
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
private void StopAll() {
|
||||
if (_ViEAndroidAPI != null) {
|
||||
if (_voERunning){
|
||||
_voERunning = false;
|
||||
StopVoiceEngine();
|
||||
}
|
||||
|
||||
if (_viERunning){
|
||||
_viERunning = false;
|
||||
_ViEAndroidAPI.StopRender(_channel);
|
||||
_ViEAndroidAPI.StopReceive(_channel);
|
||||
_ViEAndroidAPI.StopSend(_channel);
|
||||
_ViEAndroidAPI.RemoveRemoteRenderer(_channel);
|
||||
// stop the camera
|
||||
_ViEAndroidAPI.StopCamera(_cameraId);
|
||||
_ViEAndroidAPI.Terminate();
|
||||
mLlRemoteSurface.removeView(_remoteSurfaceView);
|
||||
mLlLocalSurface.removeView(_svLocal);
|
||||
_remoteSurfaceView = null;
|
||||
|
||||
_svLocal = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StartMain() {
|
||||
mTabHost.setCurrentTab(0);
|
||||
|
||||
mLlRemoteSurface = (LinearLayout) findViewById(R.id.llRemoteView);
|
||||
mLlLocalSurface = (LinearLayout) findViewById(R.id.llLocalView);
|
||||
|
||||
if (null==_ViEAndroidAPI)
|
||||
_ViEAndroidAPI = new ViEAndroidJavaAPI(this);
|
||||
|
||||
//setContentView(R.layout.main);
|
||||
|
||||
_btSwitchCamera = (Button)findViewById(R.id.btSwitchCamera);
|
||||
_btSwitchCamera.setOnClickListener(this);
|
||||
_btStartStopCall = (Button)findViewById(R.id.btStartStopCall);
|
||||
_btStartStopCall.setOnClickListener(this);
|
||||
findViewById(R.id.btExit).setOnClickListener(this);
|
||||
|
||||
// cleaning
|
||||
_remoteSurfaceView = null;
|
||||
_svLocal = null;
|
||||
|
||||
// init UI
|
||||
ArrayAdapter<?> adapter;
|
||||
// video codec
|
||||
_spCodecType = (Spinner) findViewById(R.id.spCodecType);
|
||||
adapter = ArrayAdapter.createFromResource(this, R.array.codectype,
|
||||
android.R.layout.simple_spinner_item);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
_spCodecType.setAdapter(adapter);
|
||||
_spCodecType.setSelection(_codecType);
|
||||
_spCodecType.setOnItemSelectedListener(this);
|
||||
|
||||
// voice codec
|
||||
_spVoiceCodecType = (Spinner) findViewById(R.id.spVoiceCodecType);
|
||||
adapter = ArrayAdapter.createFromResource(this, R.array.voiceCodecType,
|
||||
android.R.layout.simple_spinner_item);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
_spVoiceCodecType.setAdapter(adapter);
|
||||
_spVoiceCodecType.setSelection(_voiceCodecType);
|
||||
_spVoiceCodecType.setOnItemSelectedListener(this);
|
||||
|
||||
_spCodecSize = (Spinner) findViewById(R.id.spCodecSize);
|
||||
adapter = ArrayAdapter.createFromResource(this, R.array.codecSize,
|
||||
android.R.layout.simple_spinner_item);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
_spCodecSize.setAdapter(adapter);
|
||||
_spCodecSize.setOnItemSelectedListener(this);
|
||||
|
||||
String ip = GetLocalIpAddress();
|
||||
TextView tvLocalIp = (TextView) findViewById(R.id.tvLocalIp);
|
||||
tvLocalIp.setText("Local IP address - " + ip);
|
||||
|
||||
_etRemoteIp = (EditText) findViewById(R.id.etRemoteIp);
|
||||
_etRemoteIp.setText(_remoteIp);
|
||||
|
||||
_cbLoopback = (CheckBox) findViewById(R.id.cbLoopback);
|
||||
_cbLoopback.setChecked(_loopbackMode);
|
||||
|
||||
_cbVoice = (CheckBox) findViewById(R.id.cbVoice);
|
||||
_cbVoice.setChecked(_enableVoice);
|
||||
|
||||
_cbVideoSend = (CheckBox) findViewById(R.id.cbVideoSend);
|
||||
_cbVideoSend.setChecked(_enableVideoSend);
|
||||
_cbVideoReceive = (CheckBox) findViewById(R.id.cbVideoReceive);
|
||||
_cbVideoReceive.setChecked(_enableVideoReceive);
|
||||
|
||||
_etVTxPort = (EditText) findViewById(R.id.etVTxPort);
|
||||
_etVTxPort.setText(Integer.toString(_destinationPortVideo));
|
||||
|
||||
_etVRxPort = (EditText) findViewById(R.id.etVRxPort);
|
||||
_etVRxPort.setText(Integer.toString(_receivePortVideo));
|
||||
|
||||
_etATxPort = (EditText) findViewById(R.id.etATxPort);
|
||||
_etATxPort.setText(Integer.toString(_destinationPortVoice));
|
||||
|
||||
_etARxPort = (EditText) findViewById(R.id.etARxPort);
|
||||
_etARxPort.setText(Integer.toString(_receivePortVoice));
|
||||
|
||||
_cbEnableNack = (CheckBox) findViewById(R.id.cbNack);
|
||||
_cbEnableNack.setChecked(_enableNack);
|
||||
|
||||
_cbEnableSpeaker = (CheckBox) findViewById(R.id.cbSpeaker);
|
||||
_cbEnableSpeaker.setChecked(_enableSpeaker);
|
||||
_cbEnableAGC = (CheckBox) findViewById(R.id.cbAutoGainControl);
|
||||
_cbEnableAGC.setChecked(_enableAGC);
|
||||
_cbEnableAECM = (CheckBox) findViewById(R.id.cbAECM);
|
||||
_cbEnableAECM.setChecked(_enableAECM);
|
||||
_cbEnableNS = (CheckBox) findViewById(R.id.cbNoiseSuppression);
|
||||
_cbEnableNS.setChecked(_enableNS);
|
||||
|
||||
_cbEnableNack.setOnClickListener(this);
|
||||
_cbEnableSpeaker.setOnClickListener(this);
|
||||
_cbEnableAECM.setOnClickListener(this);
|
||||
//
|
||||
_cbEnableAGC.setOnClickListener(this);
|
||||
_cbEnableNS.setOnClickListener(this);
|
||||
|
||||
_tvFrameRateI = (TextView) findViewById(R.id.tvFrameRateI);
|
||||
_tvBitRateI = (TextView) findViewById(R.id.tvBitRateI);
|
||||
_tvPacketLoss = (TextView) findViewById(R.id.tvPacketLoss);
|
||||
_tvFrameRateO = (TextView) findViewById(R.id.tvFrameRateO);
|
||||
_tvBitRateO = (TextView) findViewById(R.id.tvBitRateO);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
/*if (_remoteSurfaceView != null)
|
||||
_glSurfaceView.onPause();*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
/*if (_glSurfaceView != null)
|
||||
_glSurfaceView.onResume();*/
|
||||
}
|
||||
|
||||
private void StartCall() {
|
||||
int ret = 0;
|
||||
|
||||
if (_enableVoice){
|
||||
SetupVoE();
|
||||
StartVoiceEngine();
|
||||
}
|
||||
|
||||
if (_enableVideo){
|
||||
if (_enableVideoSend){
|
||||
// camera and preview surface
|
||||
_svLocal=ViERenderer.CreateLocalRenderer(this);
|
||||
}
|
||||
|
||||
ret = _ViEAndroidAPI.GetVideoEngine();
|
||||
ret = _ViEAndroidAPI.Init(_enableTrace);
|
||||
_channel = _ViEAndroidAPI.CreateChannel(_voiceChannel);
|
||||
ret = _ViEAndroidAPI.SetLocalReceiver(_channel,
|
||||
_receivePortVideo);
|
||||
ret = _ViEAndroidAPI.SetSendDestination(_channel,
|
||||
_destinationPortVideo, _remoteIp.getBytes());
|
||||
|
||||
if(_codecType==3){//H.264 accordign to arrrys.xml
|
||||
ret = _ViEAndroidAPI.EnablePLI(_channel, true);
|
||||
}
|
||||
if (_enableVideoReceive){
|
||||
|
||||
if(android.os.Build.MANUFACTURER.equals("samsung"))
|
||||
{
|
||||
_remoteSurfaceView = ViERenderer.CreateRenderer(this,true); // Create an Open GL renderer
|
||||
ret = _ViEAndroidAPI.AddRemoteRenderer(_channel,_remoteSurfaceView);
|
||||
}
|
||||
else
|
||||
{
|
||||
_remoteSurfaceView= ViERenderer.CreateRenderer(this,false);
|
||||
ret = _ViEAndroidAPI.AddRemoteRenderer(_channel,_remoteSurfaceView);
|
||||
}
|
||||
|
||||
ret = _ViEAndroidAPI.SetReceiveCodec(_channel,
|
||||
_codecType, INIT_BITRATE, _codecSizeWidth, _codecSizeHeight, RECEIVE_CODEC_FRAMERATE);
|
||||
ret = _ViEAndroidAPI.StartRender(_channel);
|
||||
ret = _ViEAndroidAPI.StartReceive(_channel);
|
||||
}
|
||||
|
||||
if (_enableVideoSend){
|
||||
_currentCameraOrientation=_ViEAndroidAPI.GetCameraOrientation(_usingFrontCamera?1:0);
|
||||
ret = _ViEAndroidAPI.SetSendCodec(_channel,
|
||||
_codecType, INIT_BITRATE, _codecSizeWidth, _codecSizeHeight, SEND_CODEC_FRAMERATE);
|
||||
int cameraId = _ViEAndroidAPI.StartCamera(_channel,_usingFrontCamera?1:0);
|
||||
|
||||
if(cameraId>0)
|
||||
{
|
||||
_cameraId=cameraId;
|
||||
int neededRotation=GetCameraOrientation(_currentCameraOrientation);
|
||||
_ViEAndroidAPI.SetRotation(_cameraId,neededRotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret=cameraId;
|
||||
}
|
||||
ret = _ViEAndroidAPI.StartSend(_channel);
|
||||
}
|
||||
|
||||
ret = _ViEAndroidAPI.SetCallback(_channel,this);
|
||||
|
||||
if (_enableVideoSend){
|
||||
if (mLlLocalSurface!=null)
|
||||
mLlLocalSurface.addView(_svLocal);
|
||||
}
|
||||
|
||||
if (_enableVideoReceive){
|
||||
if (mLlRemoteSurface!=null)
|
||||
mLlRemoteSurface.addView(_remoteSurfaceView);
|
||||
}
|
||||
|
||||
_viERunning = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void DemoLog(String msg) {
|
||||
Log.d("*WEBRTC*", msg);
|
||||
}
|
||||
|
||||
|
||||
private void StopVoiceEngine() {
|
||||
// Stop send
|
||||
if (0 != _ViEAndroidAPI.VoE_StopSend(_voiceChannel)) {
|
||||
DemoLog("VoE stop send failed");
|
||||
}
|
||||
|
||||
// Stop listen
|
||||
if (0 != _ViEAndroidAPI.VoE_StopListen(_voiceChannel)) {
|
||||
DemoLog("VoE stop listen failed");
|
||||
}
|
||||
|
||||
// Stop playout
|
||||
if (0 != _ViEAndroidAPI.VoE_StopPlayout(_voiceChannel)) {
|
||||
DemoLog("VoE stop playout failed");
|
||||
}
|
||||
|
||||
if (0 != _ViEAndroidAPI.VoE_DeleteChannel(_voiceChannel)) {
|
||||
DemoLog("VoE delete channel failed");
|
||||
}
|
||||
_voiceChannel=-1;
|
||||
|
||||
// Terminate
|
||||
if (0 != _ViEAndroidAPI.VoE_Terminate()) {
|
||||
DemoLog("VoE terminate failed");
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupVoE() {
|
||||
// Create VoiceEngine
|
||||
_ViEAndroidAPI.VoE_Create(this); // Error logging is done in native API wrapper
|
||||
|
||||
// Initialize
|
||||
if (0 != _ViEAndroidAPI.VoE_Init(_enableTrace))
|
||||
{
|
||||
DemoLog("VoE init failed");
|
||||
}
|
||||
|
||||
// Create channel
|
||||
_voiceChannel = _ViEAndroidAPI.VoE_CreateChannel();
|
||||
if (0 != _voiceChannel) {
|
||||
DemoLog("VoE create channel failed");
|
||||
}
|
||||
|
||||
// Suggest to use the voice call audio stream for hardware volume controls
|
||||
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
|
||||
}
|
||||
|
||||
private int StartVoiceEngine() {
|
||||
// Set local receiver
|
||||
if (0 != _ViEAndroidAPI.VoE_SetLocalReceiver(_voiceChannel, _receivePortVoice)) {
|
||||
DemoLog("VoE set local receiver failed");
|
||||
}
|
||||
|
||||
if (0 != _ViEAndroidAPI.VoE_StartListen(_voiceChannel)) {
|
||||
DemoLog("VoE start listen failed");
|
||||
}
|
||||
|
||||
// Route audio
|
||||
RouteAudio(_enableSpeaker);
|
||||
|
||||
// set volume to default value
|
||||
if (0 != _ViEAndroidAPI.VoE_SetSpeakerVolume(_volumeLevel))
|
||||
{
|
||||
DemoLog("VoE set speaker volume failed");
|
||||
}
|
||||
|
||||
// Start playout
|
||||
if (0 != _ViEAndroidAPI.VoE_StartPlayout(_voiceChannel)) {
|
||||
DemoLog("VoE start playout failed");
|
||||
}
|
||||
|
||||
if (0 != _ViEAndroidAPI.VoE_SetSendDestination(_voiceChannel, _destinationPortVoice,
|
||||
_remoteIp)) {
|
||||
DemoLog("VoE set send destination failed");
|
||||
}
|
||||
|
||||
// 0 = iPCM-wb, 5 = PCMU
|
||||
if (0 != _ViEAndroidAPI.VoE_SetSendCodec(_voiceChannel, _voiceCodecType)) {
|
||||
DemoLog("VoE set send codec failed");
|
||||
}
|
||||
|
||||
if (0 != _ViEAndroidAPI.VoE_SetECStatus(_enableAECM, 5, 0, 28)){
|
||||
DemoLog("VoE set EC Status failed");
|
||||
}
|
||||
|
||||
if (0 != _ViEAndroidAPI.VoE_StartSend(_voiceChannel)) {
|
||||
DemoLog("VoE start send failed");
|
||||
}
|
||||
|
||||
_voERunning = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void RouteAudio(boolean enableSpeaker) {
|
||||
int sdkVersion = Integer.parseInt(android.os.Build.VERSION.SDK);
|
||||
if (sdkVersion >= 5) {
|
||||
AudioManager am = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
|
||||
am.setSpeakerphoneOn(enableSpeaker);
|
||||
}else{
|
||||
if (0 != _ViEAndroidAPI.VoE_SetLoudspeakerStatus(enableSpeaker))
|
||||
{
|
||||
DemoLog("VoE set louspeaker status failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onClick(View arg0) {
|
||||
switch (arg0.getId()) {
|
||||
case R.id.btSwitchCamera:
|
||||
if (_usingFrontCamera ){
|
||||
_btSwitchCamera.setText(R.string.frontCamera);
|
||||
}else{
|
||||
_btSwitchCamera.setText(R.string.backCamera);
|
||||
}
|
||||
_usingFrontCamera = !_usingFrontCamera;
|
||||
|
||||
if (_viERunning){
|
||||
_currentCameraOrientation=_ViEAndroidAPI.GetCameraOrientation(_usingFrontCamera?1:0);
|
||||
_ViEAndroidAPI.StopCamera(_cameraId);
|
||||
mLlLocalSurface.removeView(_svLocal);
|
||||
|
||||
_ViEAndroidAPI.StartCamera(_channel,_usingFrontCamera?1:0);
|
||||
mLlLocalSurface.addView(_svLocal);
|
||||
int neededRotation=GetCameraOrientation(_currentCameraOrientation);
|
||||
_ViEAndroidAPI.SetRotation(_cameraId,neededRotation);
|
||||
}
|
||||
break;
|
||||
case R.id.btStartStopCall:
|
||||
ReadSettings();
|
||||
if (_viERunning || _voERunning){
|
||||
StopAll();
|
||||
_wakeLock.release();//release the wake lock
|
||||
_btStartStopCall.setText(R.string.startCall);
|
||||
}
|
||||
else if (_enableVoice || _enableVideo){
|
||||
StartCall();
|
||||
_wakeLock.acquire();//screen stay on during the call
|
||||
_btStartStopCall.setText(R.string.stopCall);
|
||||
}
|
||||
break;
|
||||
case R.id.btExit:
|
||||
StopAll();
|
||||
finish();
|
||||
break;
|
||||
case R.id.cbNack:
|
||||
_enableNack = _cbEnableNack.isChecked();
|
||||
if (_viERunning){
|
||||
_ViEAndroidAPI.EnableNACK(_channel, _enableNack);
|
||||
}
|
||||
break;
|
||||
case R.id.cbSpeaker:
|
||||
_enableSpeaker = _cbEnableSpeaker.isChecked();
|
||||
if (_voERunning){
|
||||
RouteAudio(_enableSpeaker);
|
||||
}
|
||||
break;
|
||||
case R.id.cbAutoGainControl:
|
||||
_enableAGC=_cbEnableAGC.isChecked();
|
||||
if(_voERunning)
|
||||
{
|
||||
//Enable AGC default mode.
|
||||
_ViEAndroidAPI.VoE_SetAGCStatus(_enableAGC,1);
|
||||
}
|
||||
break;
|
||||
case R.id.cbNoiseSuppression:
|
||||
_enableNS=_cbEnableNS.isChecked();
|
||||
if(_voERunning)
|
||||
{
|
||||
//Enable NS default mode.
|
||||
_ViEAndroidAPI.VoE_SetNSStatus(_enableNS, 1);
|
||||
}
|
||||
break;
|
||||
case R.id.cbAECM:
|
||||
_enableAECM = _cbEnableAECM.isChecked();
|
||||
if (_voERunning){
|
||||
//EC_AECM=5
|
||||
//AECM_DEFAULT=0
|
||||
_ViEAndroidAPI.VoE_SetECStatus(_enableAECM, 5, 0, 28);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadSettings() {
|
||||
_codecType = _spCodecType.getSelectedItemPosition();
|
||||
_voiceCodecType = _spVoiceCodecType.getSelectedItemPosition();
|
||||
|
||||
String sCodecSize = _spCodecSize.getSelectedItem().toString();
|
||||
String[] aCodecSize = sCodecSize.split("x");
|
||||
_codecSizeWidth = Integer.parseInt(aCodecSize[0]);
|
||||
_codecSizeHeight = Integer.parseInt(aCodecSize[1]);
|
||||
|
||||
_loopbackMode = _cbLoopback.isChecked();
|
||||
_enableVoice = _cbVoice.isChecked();
|
||||
_enableVideoSend = _cbVideoSend.isChecked();
|
||||
_enableVideoReceive = _cbVideoReceive.isChecked();
|
||||
_enableVideo = _enableVideoSend || _enableVideoReceive;
|
||||
|
||||
_destinationPortVideo = Integer.parseInt(_etVTxPort.getText().toString());
|
||||
_receivePortVideo = Integer.parseInt(_etVRxPort.getText().toString());
|
||||
_destinationPortVoice = Integer.parseInt(_etATxPort.getText().toString());
|
||||
_receivePortVoice = Integer.parseInt(_etARxPort.getText().toString());
|
||||
|
||||
_enableNack = _cbEnableNack.isChecked();
|
||||
_enableSpeaker = _cbEnableSpeaker.isChecked();
|
||||
_enableAGC = _cbEnableAGC.isChecked();
|
||||
_enableAECM = _cbEnableAECM.isChecked();
|
||||
_enableNS = _cbEnableNS.isChecked();
|
||||
|
||||
if (_loopbackMode)
|
||||
_remoteIp = "127.0.0.1";
|
||||
else
|
||||
_remoteIp = _etRemoteIp.getText().toString();
|
||||
}
|
||||
|
||||
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
if ((adapterView==_spCodecType || adapterView==_spCodecSize) && _viERunning){
|
||||
ReadSettings();
|
||||
//change the codectype
|
||||
if (_enableVideoReceive){
|
||||
if (0 !=_ViEAndroidAPI.SetReceiveCodec(_channel,
|
||||
_codecType, INIT_BITRATE, _codecSizeWidth, _codecSizeHeight, RECEIVE_CODEC_FRAMERATE))
|
||||
DemoLog("ViE set receive codec failed");
|
||||
}
|
||||
if (_enableVideoSend){
|
||||
if (0!=_ViEAndroidAPI.SetSendCodec(_channel,
|
||||
_codecType, INIT_BITRATE, _codecSizeWidth, _codecSizeHeight, SEND_CODEC_FRAMERATE))
|
||||
DemoLog("ViE set send codec failed");
|
||||
}
|
||||
}else if ((adapterView==_spVoiceCodecType) && _voERunning){
|
||||
//change voice engine codec
|
||||
ReadSettings();
|
||||
if (0 != _ViEAndroidAPI.VoE_SetSendCodec(_voiceChannel, _voiceCodecType)) {
|
||||
DemoLog("VoE set send codec failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onNothingSelected(AdapterView<?> arg0) {
|
||||
DemoLog("No setting selected");
|
||||
}
|
||||
|
||||
|
||||
public int UpdateStats(int frameRateI, int bitRateI, int packetLoss,
|
||||
int frameRateO, int bitRateO) {
|
||||
_frameRateI = frameRateI;
|
||||
_bitRateI = bitRateI;
|
||||
_packetLoss = packetLoss;
|
||||
_frameRateO = frameRateO;
|
||||
_bitRateO = bitRateO;
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
_tvFrameRateI.setText("Incoming FrameRate - " + Integer.toString(_frameRateI));
|
||||
_tvBitRateI.setText("Incoming BitRate - " + Integer.toString(_bitRateI));
|
||||
_tvPacketLoss.setText("Incoming Packet Loss - " + Integer.toString(_packetLoss));
|
||||
_tvFrameRateO.setText("Send FrameRate - " + Integer.toString(_frameRateO));
|
||||
_tvBitRateO.setText("Send BitRate - " + Integer.toString(_bitRateO));
|
||||
}
|
||||
});
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* TODO, refactoring
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////
|
||||
//VideoEngine Java API class
|
||||
//for Android
|
||||
///////////////////////////////////////////////
|
||||
package org.webrtc.videoengineapp;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
|
||||
public class ViEAndroidJavaAPI {
|
||||
|
||||
public ViEAndroidJavaAPI(Context context) {
|
||||
Log.d("*WEBRTCJ*", "Loading ViEAndroidJavaAPI...");
|
||||
System.loadLibrary("ViEAndroidJavaAPI");
|
||||
|
||||
Log.d("*WEBRTCJ*", "Calling native init...");
|
||||
if (!NativeInit(context)) {
|
||||
Log.e("*WEBRTCJ*", "Native init failed");
|
||||
throw new RuntimeException("Native init failed");
|
||||
} else {
|
||||
Log.d("*WEBRTCJ*", "Native init successful");
|
||||
}
|
||||
String a = "";
|
||||
a.getBytes();
|
||||
}
|
||||
|
||||
// ####################API Native##############################
|
||||
private native boolean NativeInit(Context context);
|
||||
|
||||
// #################### Video Engine API ##############################
|
||||
// Initialization and Termination functions
|
||||
public native int GetVideoEngine();
|
||||
public native int Init(boolean enableTrace);
|
||||
public native int Terminate();
|
||||
|
||||
|
||||
public native int StartSend(int channel);
|
||||
|
||||
public native int StopRender(int channel);
|
||||
|
||||
public native int StopSend(int channel);
|
||||
|
||||
public native int StartReceive(int channel);
|
||||
|
||||
public native int StopReceive(int channel);
|
||||
|
||||
// Channel functions
|
||||
public native int CreateChannel(int voiceChannel);
|
||||
|
||||
// Receiver & Destination functions
|
||||
public native int SetLocalReceiver(int channel, int port);
|
||||
|
||||
public native int SetSendDestination(int channel, int port,
|
||||
byte ipadr[]);
|
||||
|
||||
// Codec
|
||||
public native int SetReceiveCodec(int channel, int codecNum,
|
||||
int intbitRate, int width, int height, int frameRate);
|
||||
|
||||
public native int SetSendCodec(int channel, int codecNum,
|
||||
int intbitRate, int width, int height, int frameRate);
|
||||
|
||||
// Rendering
|
||||
public native int AddRemoteRenderer(int channel,
|
||||
Object glSurface);
|
||||
|
||||
public native int RemoveRemoteRenderer(int channel);
|
||||
|
||||
public native int StartRender(int channel);
|
||||
|
||||
// Capture
|
||||
public native int StartCamera(int channel, int cameraNum);
|
||||
public native int StopCamera(int cameraId);
|
||||
public native int GetCameraOrientation(int cameraNum);
|
||||
public native int SetRotation(int cameraId,int degrees);
|
||||
|
||||
// NACK
|
||||
public native int EnableNACK(int channel, boolean enable);
|
||||
|
||||
//PLI for H.264
|
||||
public native int EnablePLI(int channel, boolean enable);
|
||||
|
||||
// Enable stats callback
|
||||
public native int SetCallback(int channel, IViEAndroidCallback callback);
|
||||
|
||||
// #################### Voice Engine API ##############################
|
||||
// Create and Delete functions
|
||||
public native boolean VoE_Create(Activity context);
|
||||
public native boolean VoE_Delete();
|
||||
|
||||
// Initialization and Termination functions
|
||||
public native int VoE_Authenticate(String key);
|
||||
public native int VoE_Init(int month, int day, int year, boolean enableTrace, boolean useExtTrans);
|
||||
public native int VoE_Terminate();
|
||||
|
||||
// Channel functions
|
||||
public native int VoE_CreateChannel();
|
||||
public native int VoE_DeleteChannel(int channel);
|
||||
|
||||
// Receiver & Destination functions
|
||||
public native int VoE_SetLocalReceiver(int channel, int port);
|
||||
public native int VoE_SetSendDestination(int channel, int port, String ipaddr);
|
||||
|
||||
// Media functions
|
||||
public native int VoE_StartListen(int channel);
|
||||
public native int VoE_StartPlayout(int channel);
|
||||
public native int VoE_StartSend(int channel);
|
||||
public native int VoE_StopListen(int channel);
|
||||
public native int VoE_StopPlayout(int channel);
|
||||
public native int VoE_StopSend(int channel);
|
||||
|
||||
// Volume
|
||||
public native int VoE_SetSpeakerVolume(int volume);
|
||||
|
||||
// Hardware
|
||||
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_StopPlayingFileLocally(int channel);
|
||||
|
||||
// Play file as microphone
|
||||
public native int VoE_StartPlayingFileAsMicrophone(int channel, String fileName, boolean loop);
|
||||
public native int VoE_StopPlayingFileAsMicrophone(int channel);
|
||||
|
||||
// Codec-setting functions
|
||||
public native int VoE_NumOfCodecs();
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user