/*
* Copyright (c) 2012 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.
*/
package org.webrtc.videoengineapp;
import android.app.AlertDialog;
import android.app.TabActivity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.hardware.SensorManager;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TextView;
import org.webrtc.videoengine.ViERenderer;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
/** {@} */
public class WebRTCDemo 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 = -1;
private int cameraId;
private int voiceChannel = -1;
// flags
private boolean viERunning = false;
private boolean voERunning = false;
// debug
private boolean enableTrace = true;
// Constant
private static final String TAG = "WEBRTC";
private static final int RECEIVE_CODEC_FRAMERATE = 15;
private static final int SEND_CODEC_FRAMERATE = 15;
private static final int INIT_BITRATE = 500;
private static final String LOOPBACK_IP = "127.0.0.1";
// Zero means don't automatically start/stop calls.
private static final long AUTO_CALL_RESTART_DELAY_MS = 0;
private Handler handler = new Handler();
private Runnable startOrStopCallback = new Runnable() {
public void run() {
startOrStop();
}
};
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 = true;
private EditText etRemoteIp;
private String remoteIp = "";
private CheckBox cbLoopback;
private boolean loopbackMode = true;
private CheckBox cbStats;
private boolean isStatsOn = true;
public enum RenderType {
OPENGL,
SURFACE,
MEDIACODEC
}
RenderType renderType = RenderType.OPENGL;
// Video settings
private Spinner spCodecType;
private int codecType = 0;
private Spinner spCodecSize;
private int codecSizeWidth = 0;
private int codecSizeHeight = 0;
private TextView etVRxPort;
private int receivePortVideo = 11111;
private TextView etVTxPort;
private int destinationPortVideo = 11111;
private CheckBox cbEnableNack;
private boolean enableNack = true;
private CheckBox cbEnableVideoRTPDump;
// Audio settings
private Spinner spVoiceCodecType;
private int voiceCodecType = 0;
private TextView etARxPort;
private int receivePortVoice = 11113;
private TextView etATxPort;
private int destinationPortVoice = 11113;
private CheckBox cbEnableSpeaker;
private CheckBox cbEnableAGC;
private boolean enableAGC = false;
private CheckBox cbEnableAECM;
private boolean enableAECM = false;
private CheckBox cbEnableNS;
private boolean enableNS = false;
private CheckBox cbEnableDebugAPM;
private CheckBox cbEnableVoiceRTPDump;
// Stats variables
private int frameRateI;
private int bitRateI;
private int packetLoss;
private int frameRateO;
private int bitRateO;
private int numCalls = 0;
// Variable for storing variables
private String webrtcName = "/webrtc";
private String webrtcDebugDir = null;
private WakeLock wakeLock;
private boolean usingFrontCamera = true;
private String[] mVideoCodecsStrings = null;
private String[] mVideoCodecsSizeStrings = { "176x144", "320x240",
"352x288", "640x480" };
private String[] mVoiceCodecsStrings = null;
private OrientationEventListener orientationListener;
int currentOrientation = OrientationEventListener.ORIENTATION_UNKNOWN;
int currentCameraOrientation = 0;
private StatsView statsView = null;
private BroadcastReceiver receiver;
public int getCameraOrientation(int cameraOrientation) {
Display display = this.getWindowManager().getDefaultDisplay();
int displatyRotation = display.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) {
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Set screen orientation
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
PowerManager pm = (PowerManager) this.getSystemService(
Context.POWER_SERV
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
视频会议软件代码(WebRTC技术,音频和视频效果很好) (159个子文件)
all-wcprops 1KB
all-wcprops 1014B
all-wcprops 874B
all-wcprops 643B
all-wcprops 643B
all-wcprops 303B
all-wcprops 303B
all-wcprops 242B
all-wcprops 240B
all-wcprops 113B
all-wcprops 113B
all-wcprops 106B
all-wcprops 106B
all-wcprops 102B
all-wcprops 102B
all-wcprops 102B
vie_android_java_api.cc 55KB
android_media_codec_decoder.cc 3KB
WebRTCDemo.class 25KB
VideoCaptureDeviceInfoAndroid.class 12KB
VideoCaptureAndroid.class 8KB
WebRTCAudioDevice.class 7KB
ViEAndroidGLES20$ConfigChooser.class 6KB
ViEMediaCodecDecoder.class 6KB
CodecState.class 5KB
ViEAndroidGLES20.class 5KB
ViEAndroidJavaAPI.class 3KB
ViEAndroidGLES20$ContextFactory.class 2KB
WebRTCDemo$StatsView.class 2KB
R$id.class 2KB
WebRTCDemo$2.class 2KB
WebRTCDemo$SpinnerAdapter.class 2KB
R$string.class 2KB
ViEMediaCodecDecoder$1$1.class 2KB
VideoCaptureDeviceInfoAndroid$FrontFacingCameraType.class 1KB
ViEMediaCodecDecoder$1.class 1KB
ViERenderer.class 1KB
WebRTCDemo$RenderType.class 1KB
VideoCaptureDeviceInfoAndroid$AndroidVideoCaptureDevice.class 1KB
WebRTCDemo$3.class 917B
WebRTCDemo$4.class 852B
WebRTCDemo$1.class 654B
R$layout.class 591B
R.class 580B
Frame.class 483B
CaptureCapabilityAndroid.class 458B
R$drawable.class 421B
R$attr.class 361B
BuildConfig.class 359B
IViEAndroidCallback.class 178B
.classpath 450B
vie_android_java_api.o.d 24KB
android_media_codec_decoder.o.d 22KB
entries 1KB
entries 1KB
entries 1KB
entries 801B
entries 801B
entries 430B
entries 430B
entries 408B
entries 407B
entries 283B
entries 283B
entries 272B
entries 250B
entries 250B
entries 243B
entries 243B
gdbserver 263KB
android_video_demo.gypi 2KB
org_webrtc_videoengineapp_vie_android_java_api.h 15KB
android_media_codec_decoder.h 4KB
WebRTCDemo.java 38KB
WebRTCAudioDevice.java 15KB
VideoCaptureDeviceInfoAndroid.java 15KB
ViEAndroidGLES20.java 14KB
ViEMediaCodecDecoder.java 13KB
VideoCaptureAndroid.java 9KB
ViEAndroidJavaAPI.java 5KB
R.java 5KB
ViERenderer.java 2KB
IViEAndroidCallback.java 611B
CaptureCapabilityAndroid.java 569B
BuildConfig.java 167B
Android.mk 11KB
Application.mk 496B
vie_android_java_api.o 297KB
android_media_codec_decoder.o 96KB
OWNERS 42B
logo.png 3KB
logo.png 2KB
.project 813B
project.properties 446B
build_demo.py 3KB
gdb.setup 625B
libwebrtc-video-demo-jni.so 24.56MB
libwebrtc-video-demo-jni.so 2.39MB
build.xml.svn-base 78KB
vie_android_java_api.cc.svn-base 55KB
共 159 条
- 1
- 2
资源评论
- learndeeplearning2017-02-18实在,不错,挺好的
- shlices2015-11-03测试了一下,感觉没有介绍的那么神。
- lyric5201232015-12-29感觉一般,不是我想要的.
- ljstring198510142017-10-29webrtc的demo,还要这么多分
- Torch0092015-11-24webrtc的demo,骗人还要这么多分。
怒放的向日葵
- 粉丝: 1
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功