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 20 matching lines...) Expand all Loading... | |
31 import org.webrtc.PeerConnectionFactory; | 31 import org.webrtc.PeerConnectionFactory; |
32 import org.webrtc.SdpObserver; | 32 import org.webrtc.SdpObserver; |
33 import org.webrtc.SessionDescription; | 33 import org.webrtc.SessionDescription; |
34 import org.webrtc.StatsObserver; | 34 import org.webrtc.StatsObserver; |
35 import org.webrtc.StatsReport; | 35 import org.webrtc.StatsReport; |
36 import org.webrtc.VideoCapturerAndroid; | 36 import org.webrtc.VideoCapturerAndroid; |
37 import org.webrtc.VideoRenderer; | 37 import org.webrtc.VideoRenderer; |
38 import org.webrtc.VideoSource; | 38 import org.webrtc.VideoSource; |
39 import org.webrtc.VideoTrack; | 39 import org.webrtc.VideoTrack; |
40 import org.webrtc.voiceengine.WebRtcAudioManager; | 40 import org.webrtc.voiceengine.WebRtcAudioManager; |
41 import org.webrtc.voiceengine.WebRtcAudioUtils; | |
41 | 42 |
42 import java.io.File; | 43 import java.io.File; |
43 import java.io.IOException; | 44 import java.io.IOException; |
44 import java.util.EnumSet; | 45 import java.util.EnumSet; |
45 import java.util.LinkedList; | 46 import java.util.LinkedList; |
46 import java.util.Timer; | 47 import java.util.Timer; |
47 import java.util.TimerTask; | 48 import java.util.TimerTask; |
48 import java.util.concurrent.ExecutorService; | 49 import java.util.concurrent.ExecutorService; |
49 import java.util.concurrent.Executors; | 50 import java.util.concurrent.Executors; |
50 import java.util.concurrent.ScheduledExecutorService; | 51 import java.util.concurrent.ScheduledExecutorService; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 public final int videoFps; | 142 public final int videoFps; |
142 public final int videoStartBitrate; | 143 public final int videoStartBitrate; |
143 public final String videoCodec; | 144 public final String videoCodec; |
144 public final boolean videoCodecHwAcceleration; | 145 public final boolean videoCodecHwAcceleration; |
145 public final boolean captureToTexture; | 146 public final boolean captureToTexture; |
146 public final int audioStartBitrate; | 147 public final int audioStartBitrate; |
147 public final String audioCodec; | 148 public final String audioCodec; |
148 public final boolean noAudioProcessing; | 149 public final boolean noAudioProcessing; |
149 public final boolean aecDump; | 150 public final boolean aecDump; |
150 public final boolean useOpenSLES; | 151 public final boolean useOpenSLES; |
152 public final boolean disableBuiltInAEC; | |
151 | 153 |
152 public PeerConnectionParameters( | 154 public PeerConnectionParameters( |
153 boolean videoCallEnabled, boolean loopback, boolean tracing, | 155 boolean videoCallEnabled, boolean loopback, boolean tracing, |
154 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, | 156 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, |
155 String videoCodec, boolean videoCodecHwAcceleration, boolean captureToTe xture, | 157 String videoCodec, boolean videoCodecHwAcceleration, boolean captureToTe xture, |
156 int audioStartBitrate, String audioCodec, | 158 int audioStartBitrate, String audioCodec, |
157 boolean noAudioProcessing, boolean aecDump, boolean useOpenSLES) { | 159 boolean noAudioProcessing, boolean aecDump, boolean useOpenSLES, |
160 boolean disableBuiltInAEC) { | |
158 this.videoCallEnabled = videoCallEnabled; | 161 this.videoCallEnabled = videoCallEnabled; |
159 this.loopback = loopback; | 162 this.loopback = loopback; |
160 this.tracing = tracing; | 163 this.tracing = tracing; |
161 this.videoWidth = videoWidth; | 164 this.videoWidth = videoWidth; |
162 this.videoHeight = videoHeight; | 165 this.videoHeight = videoHeight; |
163 this.videoFps = videoFps; | 166 this.videoFps = videoFps; |
164 this.videoStartBitrate = videoStartBitrate; | 167 this.videoStartBitrate = videoStartBitrate; |
165 this.videoCodec = videoCodec; | 168 this.videoCodec = videoCodec; |
166 this.videoCodecHwAcceleration = videoCodecHwAcceleration; | 169 this.videoCodecHwAcceleration = videoCodecHwAcceleration; |
167 this.captureToTexture = captureToTexture; | 170 this.captureToTexture = captureToTexture; |
168 this.audioStartBitrate = audioStartBitrate; | 171 this.audioStartBitrate = audioStartBitrate; |
169 this.audioCodec = audioCodec; | 172 this.audioCodec = audioCodec; |
170 this.noAudioProcessing = noAudioProcessing; | 173 this.noAudioProcessing = noAudioProcessing; |
171 this.aecDump = aecDump; | 174 this.aecDump = aecDump; |
172 this.useOpenSLES = useOpenSLES; | 175 this.useOpenSLES = useOpenSLES; |
176 this.disableBuiltInAEC = disableBuiltInAEC; | |
173 } | 177 } |
174 } | 178 } |
175 | 179 |
176 /** | 180 /** |
177 * Peer connection events. | 181 * Peer connection events. |
178 */ | 182 */ |
179 public interface PeerConnectionEvents { | 183 public interface PeerConnectionEvents { |
180 /** | 184 /** |
181 * Callback fired once local SDP is created and set. | 185 * Callback fired once local SDP is created and set. |
182 */ | 186 */ |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 | 336 |
333 // Enable/disable OpenSL ES playback. | 337 // Enable/disable OpenSL ES playback. |
334 if (!peerConnectionParameters.useOpenSLES) { | 338 if (!peerConnectionParameters.useOpenSLES) { |
335 Log.d(TAG, "Disable OpenSL ES audio even if device supports it"); | 339 Log.d(TAG, "Disable OpenSL ES audio even if device supports it"); |
336 WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true /* enable */); | 340 WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true /* enable */); |
337 } else { | 341 } else { |
338 Log.d(TAG, "Allow OpenSL ES audio if device supports it"); | 342 Log.d(TAG, "Allow OpenSL ES audio if device supports it"); |
339 WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(false); | 343 WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(false); |
340 } | 344 } |
341 | 345 |
346 if (peerConnectionParameters.disableBuiltInAEC) { | |
347 Log.d(TAG, "Disable built-in AEC even if device supports it"); | |
348 WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true); | |
349 } else { | |
350 Log.d(TAG, "Allow built-in AEC if device supports it"); | |
henrika_webrtc
2016/05/24 11:14:00
Comment is a bit vague. Is it enabled or disabled?
| |
351 WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(false); | |
352 } | |
353 | |
342 // Create peer connection factory. | 354 // Create peer connection factory. |
343 if (!PeerConnectionFactory.initializeAndroidGlobals(context, true, true, | 355 if (!PeerConnectionFactory.initializeAndroidGlobals(context, true, true, |
344 peerConnectionParameters.videoCodecHwAcceleration)) { | 356 peerConnectionParameters.videoCodecHwAcceleration)) { |
345 events.onPeerConnectionError("Failed to initializeAndroidGlobals"); | 357 events.onPeerConnectionError("Failed to initializeAndroidGlobals"); |
346 } | 358 } |
347 if (options != null) { | 359 if (options != null) { |
348 Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMas k); | 360 Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMas k); |
349 } | 361 } |
350 factory = new PeerConnectionFactory(options); | 362 factory = new PeerConnectionFactory(options); |
351 Log.d(TAG, "Peer connection factory created."); | 363 Log.d(TAG, "Peer connection factory created."); |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1124 public void onCreateFailure(final String error) { | 1136 public void onCreateFailure(final String error) { |
1125 reportError("createSDP error: " + error); | 1137 reportError("createSDP error: " + error); |
1126 } | 1138 } |
1127 | 1139 |
1128 @Override | 1140 @Override |
1129 public void onSetFailure(final String error) { | 1141 public void onSetFailure(final String error) { |
1130 reportError("setSDP error: " + error); | 1142 reportError("setSDP error: " + error); |
1131 } | 1143 } |
1132 } | 1144 } |
1133 } | 1145 } |
OLD | NEW |