OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 import org.webrtc.PeerConnection.IceConnectionState; | 27 import org.webrtc.PeerConnection.IceConnectionState; |
28 import org.webrtc.PeerConnectionFactory; | 28 import org.webrtc.PeerConnectionFactory; |
29 import org.webrtc.SdpObserver; | 29 import org.webrtc.SdpObserver; |
30 import org.webrtc.SessionDescription; | 30 import org.webrtc.SessionDescription; |
31 import org.webrtc.StatsObserver; | 31 import org.webrtc.StatsObserver; |
32 import org.webrtc.StatsReport; | 32 import org.webrtc.StatsReport; |
33 import org.webrtc.VideoCapturerAndroid; | 33 import org.webrtc.VideoCapturerAndroid; |
34 import org.webrtc.VideoRenderer; | 34 import org.webrtc.VideoRenderer; |
35 import org.webrtc.VideoSource; | 35 import org.webrtc.VideoSource; |
36 import org.webrtc.VideoTrack; | 36 import org.webrtc.VideoTrack; |
| 37 import org.webrtc.voiceengine.WebRtcAudioManager; |
37 | 38 |
38 import java.util.EnumSet; | 39 import java.util.EnumSet; |
39 import java.util.LinkedList; | 40 import java.util.LinkedList; |
40 import java.util.Timer; | 41 import java.util.Timer; |
41 import java.util.TimerTask; | 42 import java.util.TimerTask; |
42 import java.util.regex.Matcher; | 43 import java.util.regex.Matcher; |
43 import java.util.regex.Pattern; | 44 import java.util.regex.Pattern; |
44 | 45 |
45 import javax.microedition.khronos.egl.EGLContext; | 46 import javax.microedition.khronos.egl.EGLContext; |
46 | 47 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 public final boolean loopback; | 130 public final boolean loopback; |
130 public final int videoWidth; | 131 public final int videoWidth; |
131 public final int videoHeight; | 132 public final int videoHeight; |
132 public final int videoFps; | 133 public final int videoFps; |
133 public final int videoStartBitrate; | 134 public final int videoStartBitrate; |
134 public final String videoCodec; | 135 public final String videoCodec; |
135 public final boolean videoCodecHwAcceleration; | 136 public final boolean videoCodecHwAcceleration; |
136 public final int audioStartBitrate; | 137 public final int audioStartBitrate; |
137 public final String audioCodec; | 138 public final String audioCodec; |
138 public final boolean noAudioProcessing; | 139 public final boolean noAudioProcessing; |
139 public final boolean cpuOveruseDetection; | 140 public final boolean useOpenSLES; |
140 | 141 |
141 public PeerConnectionParameters( | 142 public PeerConnectionParameters( |
142 boolean videoCallEnabled, boolean loopback, | 143 boolean videoCallEnabled, boolean loopback, |
143 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, | 144 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, |
144 String videoCodec, boolean videoCodecHwAcceleration, | 145 String videoCodec, boolean videoCodecHwAcceleration, |
145 int audioStartBitrate, String audioCodec, | 146 int audioStartBitrate, String audioCodec, |
146 boolean noAudioProcessing, boolean cpuOveruseDetection) { | 147 boolean noAudioProcessing, boolean useOpenSLES) { |
147 this.videoCallEnabled = videoCallEnabled; | 148 this.videoCallEnabled = videoCallEnabled; |
148 this.loopback = loopback; | 149 this.loopback = loopback; |
149 this.videoWidth = videoWidth; | 150 this.videoWidth = videoWidth; |
150 this.videoHeight = videoHeight; | 151 this.videoHeight = videoHeight; |
151 this.videoFps = videoFps; | 152 this.videoFps = videoFps; |
152 this.videoStartBitrate = videoStartBitrate; | 153 this.videoStartBitrate = videoStartBitrate; |
153 this.videoCodec = videoCodec; | 154 this.videoCodec = videoCodec; |
154 this.videoCodecHwAcceleration = videoCodecHwAcceleration; | 155 this.videoCodecHwAcceleration = videoCodecHwAcceleration; |
155 this.audioStartBitrate = audioStartBitrate; | 156 this.audioStartBitrate = audioStartBitrate; |
156 this.audioCodec = audioCodec; | 157 this.audioCodec = audioCodec; |
157 this.noAudioProcessing = noAudioProcessing; | 158 this.noAudioProcessing = noAudioProcessing; |
158 this.cpuOveruseDetection = cpuOveruseDetection; | 159 this.useOpenSLES = useOpenSLES; |
159 } | 160 } |
160 } | 161 } |
161 | 162 |
162 /** | 163 /** |
163 * Peer connection events. | 164 * Peer connection events. |
164 */ | 165 */ |
165 public static interface PeerConnectionEvents { | 166 public static interface PeerConnectionEvents { |
166 /** | 167 /** |
167 * Callback fired once local SDP is created and set. | 168 * Callback fired once local SDP is created and set. |
168 */ | 169 */ |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 if (videoCallEnabled && peerConnectionParameters.videoCodec != null | 302 if (videoCallEnabled && peerConnectionParameters.videoCodec != null |
302 && peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264)) { | 303 && peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264)) { |
303 preferH264 = true; | 304 preferH264 = true; |
304 } | 305 } |
305 // Check if ISAC is used by default. | 306 // Check if ISAC is used by default. |
306 preferIsac = false; | 307 preferIsac = false; |
307 if (peerConnectionParameters.audioCodec != null | 308 if (peerConnectionParameters.audioCodec != null |
308 && peerConnectionParameters.audioCodec.equals(AUDIO_CODEC_ISAC)) { | 309 && peerConnectionParameters.audioCodec.equals(AUDIO_CODEC_ISAC)) { |
309 preferIsac = true; | 310 preferIsac = true; |
310 } | 311 } |
| 312 |
| 313 // Enable/disable OpenSL ES playback. |
| 314 if (!peerConnectionParameters.useOpenSLES) { |
| 315 Log.d(TAG, "Disable OpenSL ES audio"); |
| 316 WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true /* enable */); |
| 317 } |
| 318 |
| 319 // Create peer connection factory. |
311 if (!PeerConnectionFactory.initializeAndroidGlobals(context, true, true, | 320 if (!PeerConnectionFactory.initializeAndroidGlobals(context, true, true, |
312 peerConnectionParameters.videoCodecHwAcceleration)) { | 321 peerConnectionParameters.videoCodecHwAcceleration)) { |
313 events.onPeerConnectionError("Failed to initializeAndroidGlobals"); | 322 events.onPeerConnectionError("Failed to initializeAndroidGlobals"); |
314 } | 323 } |
315 factory = new PeerConnectionFactory(); | 324 factory = new PeerConnectionFactory(); |
316 if (options != null) { | 325 if (options != null) { |
317 Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMas
k); | 326 Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMas
k); |
318 factory.setOptions(options); | 327 factory.setOptions(options); |
319 } | 328 } |
320 Log.d(TAG, "Peer connection factory created."); | 329 Log.d(TAG, "Peer connection factory created."); |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 public void onCreateFailure(final String error) { | 1042 public void onCreateFailure(final String error) { |
1034 reportError("createSDP error: " + error); | 1043 reportError("createSDP error: " + error); |
1035 } | 1044 } |
1036 | 1045 |
1037 @Override | 1046 @Override |
1038 public void onSetFailure(final String error) { | 1047 public void onSetFailure(final String error) { |
1039 reportError("setSDP error: " + error); | 1048 reportError("setSDP error: " + error); |
1040 } | 1049 } |
1041 } | 1050 } |
1042 } | 1051 } |
OLD | NEW |