/*
* Copyright 2014 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.appspot.apprtc;
import android.content.Context;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.appspot.apprtc.AppRTCClient.SignalingParameters;
import org.webrtc.AudioSource;
import org.webrtc.AudioTrack;
import org.webrtc.CameraVideoCapturer;
import org.webrtc.DataChannel;
import org.webrtc.EglBase;
import org.webrtc.IceCandidate;
import org.webrtc.Logging;
import org.webrtc.MediaConstraints;
import org.webrtc.MediaStream;
import org.webrtc.PeerConnection;
import org.webrtc.PeerConnection.IceConnectionState;
import org.webrtc.PeerConnectionFactory;
import org.webrtc.RtpParameters;
import org.webrtc.RtpReceiver;
import org.webrtc.RtpSender;
import org.webrtc.SdpObserver;
import org.webrtc.SessionDescription;
import org.webrtc.StatsObserver;
import org.webrtc.StatsReport;
import org.webrtc.VideoCapturer;
import org.webrtc.VideoRenderer;
import org.webrtc.VideoSource;
import org.webrtc.VideoTrack;
import org.webrtc.voiceengine.WebRtcAudioManager;
import org.webrtc.voiceengine.WebRtcAudioRecord;
import org.webrtc.voiceengine.WebRtcAudioRecord.WebRtcAudioRecordErrorCallback;
import org.webrtc.voiceengine.WebRtcAudioUtils;
/**
* Peer connection client implementation.
*
* <p>All public methods are routed to local looper thread.
* All PeerConnectionEvents callbacks are invoked from the same looper thread.
* This class is a singleton.
*/
public class PeerConnectionClient {
public static final String VIDEO_TRACK_ID = "ARDAMSv0";
public static final String AUDIO_TRACK_ID = "ARDAMSa0";
public static final String VIDEO_TRACK_TYPE = "video";
private static final String TAG = "PCRTCClient";
private static final String VIDEO_CODEC_VP8 = "VP8";
private static final String VIDEO_CODEC_VP9 = "VP9";
private static final String VIDEO_CODEC_H264 = "H264";
private static final String VIDEO_CODEC_H264_BASELINE = "H264 Baseline";
private static final String VIDEO_CODEC_H264_HIGH = "H264 High";
private static final String AUDIO_CODEC_OPUS = "opus";
private static final String AUDIO_CODEC_ISAC = "ISAC";
private static final String VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start-bitrate";
private static final String VIDEO_FLEXFEC_FIELDTRIAL = "WebRTC-FlexFEC-03/Enabled/";
private static final String VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL = "WebRTC-IntelVP8/Enabled/";
private static final String VIDEO_H264_HIGH_PROFILE_FIELDTRIAL =
"WebRTC-H264HighProfile/Enabled/";
private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate";
private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCancellation";
private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT = "googAutoGainControl";
private static final String AUDIO_HIGH_PASS_FILTER_CONSTRAINT = "googHighpassFilter";
private static final String AUDIO_NOISE_SUPPRESSION_CONSTRAINT = "googNoiseSuppression";
private static final String AUDIO_LEVEL_CONTROL_CONSTRAINT = "levelControl";
private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyAgreement";
private static final int HD_VIDEO_WIDTH = 1280;
private static final int HD_VIDEO_HEIGHT = 720;
private static final int BPS_IN_KBPS = 1000;
private static final PeerConnectionClient instance = new PeerConnectionClient();
private final PCObserver pcObserver = new PCObserver();
private final SDPObserver sdpObserver = new SDPObserver();
private final ScheduledExecutorService executor;
private PeerConnectionFactory factory;
private PeerConnection peerConnection;
PeerConnectionFactory.Options options = null;
private AudioSource audioSource;
private VideoSource videoSource;
private boolean videoCallEnabled;
private boolean preferIsac;
private String preferredVideoCodec;
private boolean videoCapturerStopped;
private boolean isError;
private Timer statsTimer;
private VideoRenderer.Callbacks localRender;
private List<VideoRenderer.Callbacks> remoteRenders;
private SignalingParameters signalingParameters;
private MediaConstraints pcConstraints;
private int videoWidth;
private int videoHeight;
private int videoFps;
private MediaConstraints audioConstraints;
private ParcelFileDescriptor aecDumpFileDescriptor;
private MediaConstraints sdpMediaConstraints;
private PeerConnectionParameters peerConnectionParameters;
// Queued remote ICE candidates are consumed only after both local and
// remote descriptions are set. Similarly local ICE candidates are sent to
// remote peer after both local and remote description are set.
private LinkedList<IceCandidate> queuedRemoteCandidates;
private PeerConnectionEvents events;
private boolean isInitiator;
private SessionDescription localSdp; // either offer or answer SDP
private MediaStream mediaStream;
private VideoCapturer videoCapturer;
// enableVideo is set to true if video should be rendered and sent.
private boolean renderVideo;
private VideoTrack localVideoTrack;
private VideoTrack remoteVideoTrack;
private RtpSender localVideoSender;
// enableAudio is set to true if audio should be sent.
private boolean enableAudio;
private AudioTrack localAudioTrack;
private DataChannel dataChannel;
private boolean dataChannelEnabled;
/**
* Peer connection parameters.
*/
public static class DataChannelParameters {
public final boolean ordered;
public final int maxRetransmitTimeMs;
public final int maxRetransmits;
public final String protocol;
public final boolean negotiated;
public final int id;
public DataChannelParameters(boolean ordered, int maxRetransmitTimeMs, int maxRetransmits,
String protocol, boolean negotiated, int id) {
this.ordered = ordered;
this.maxRetransmitTimeMs = maxRetransmitTimeMs;
this.maxRetransmits = maxRetransmits;
this.protocol = protocol;
this.negotiated = negotiated;
this.id = id;
}
}
/**
* Peer connection parameters.
*/
public static class PeerConnectionParameters {
public final boolean videoCallEnabled;
public final boolean loopback;
public final boolean tracing;
public final int videoWidth;
public final int videoHeight;
public final int videoFps;
public final int videoMaxBitrate;
public final String videoCodec;
public final boolean videoCodecHwAcceleration;
public final boolean videoFlexfecEnabled;
public final int audioStartBitrate;
public final String audioCodec;
public final boolean noAudioProcessing;
public final boolean aecDump;
public final boolean useOpenSLES;
public final boolean disableBuiltInAEC;
public final boolean disableBuiltInAGC;
public final boolean disableBuiltInNS;
public final boolean enableLevelControl;
private final DataChannelParameters dataChannelParameters;
public PeerConnectionParameters(boolean videoCallEnabled, boolean loopback, boolean tracing,
int videoWidth, int videoHeight, int videoFps, int videoMaxBitrate, String videoCodec,
boolean videoCodecHwAcceleration, boolea
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
webrtc_build.rar (77个子文件)
libjingle_peerconnection_builds
Release
res
aidl
assets
jni
armeabi-v7a
libjingle_peerconnection_so.so 4.94MB
x86_64
libjingle_peerconnection_so.so 8.59MB
arm64-v8a
libjingle_peerconnection_so.so 7.72MB
x86
libjingle_peerconnection_so.so 9.72MB
libs
base_java.jar 14KB
libjingle_peerconnection.jar 245KB
androidapp2
res
drawable-ldpi
ic_action_return_from_full_screen.png 477B
ic_loopback_call.png 2KB
disconnect.png 1KB
ic_launcher.png 2KB
ic_action_full_screen.png 461B
menu
connect_menu.xml 503B
drawable-hdpi
ic_action_return_from_full_screen.png 663B
ic_loopback_call.png 2KB
disconnect.png 1KB
ic_launcher.png 2KB
ic_action_full_screen.png 587B
drawable-xhdpi
ic_action_return_from_full_screen.png 761B
ic_loopback_call.png 2KB
disconnect.png 1KB
ic_launcher.png 3KB
ic_action_full_screen.png 743B
values
strings.xml 12KB
arrays.xml 2KB
drawable-mdpi
ic_action_return_from_full_screen.png 477B
ic_loopback_call.png 2KB
disconnect.png 1KB
ic_launcher.png 2KB
ic_action_full_screen.png 461B
layout
activity_connect.xml 3KB
fragment_call.xml 3KB
activity_call.xml 855B
fragment_hud.xml 3KB
xml
preferences.xml 11KB
values-v21
styles.xml 309B
values-v17
styles.xml 298B
ant.properties 698B
build.xml 4KB
start_loopback_stubbed_camera_saved_video_out.py 3KB
OWNERS 72B
src
org
appspot
apprtc
DirectRTCClient.java 10KB
AppRTCBluetoothManager.java 22KB
PeerConnectionClient.java 47KB
SettingsFragment.java 822B
ConnectActivity.java 26KB
TCPChannelClient.java 9KB
CallFragment.java 5KB
AppRTCClient.java 4KB
CallActivity.java 34KB
RoomParametersFetcher.java 8KB
WebSocketRTCClient.java 15KB
UnhandledExceptionHandler.java 3KB
WebSocketChannelClient.java 9KB
CaptureQualityController.java 4KB
AppRTCAudioManager.java 23KB
CpuMonitor.java 17KB
SettingsActivity.java 14KB
HudFragment.java 8KB
util
AsyncHttpURLConnection.java 4KB
AppRTCUtils.java 2KB
AppRTCProximitySensor.java 6KB
.idea
misc.xml 4KB
vcs.xml 164B
.name 11B
androidapp2.iml 336B
copyright
profiles_settings.xml 76B
modules.xml 274B
compiler.xml 686B
workspace.xml 34KB
README 1KB
third_party
autobanh
NOTICE 155B
BUILD.gn 513B
LICENSE 10KB
LICENSE.md 1KB
lib
autobanh.jar 44KB
project.properties 601B
AndroidManifest.xml 3KB
共 77 条
- 1
资源评论
- wangguol2017-03-30不错,有没有编译过程的文档。
不知道VS123
- 粉丝: 0
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功