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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 public final int videoStartBitrate; | 153 public final int videoStartBitrate; |
154 public final String videoCodec; | 154 public final String videoCodec; |
155 public final boolean videoCodecHwAcceleration; | 155 public final boolean videoCodecHwAcceleration; |
156 public final boolean captureToTexture; | 156 public final boolean captureToTexture; |
157 public final int audioStartBitrate; | 157 public final int audioStartBitrate; |
158 public final String audioCodec; | 158 public final String audioCodec; |
159 public final boolean noAudioProcessing; | 159 public final boolean noAudioProcessing; |
160 public final boolean aecDump; | 160 public final boolean aecDump; |
161 public final boolean useOpenSLES; | 161 public final boolean useOpenSLES; |
162 public final boolean disableBuiltInAEC; | 162 public final boolean disableBuiltInAEC; |
| 163 public final boolean disableBuiltInAGC; |
| 164 public final boolean disableBuiltInNS; |
163 | 165 |
164 public PeerConnectionParameters( | 166 public PeerConnectionParameters( |
165 boolean videoCallEnabled, boolean loopback, boolean tracing, boolean use
Camera2, | 167 boolean videoCallEnabled, boolean loopback, boolean tracing, boolean use
Camera2, |
166 int videoWidth, int videoHeight, int videoFps, | 168 int videoWidth, int videoHeight, int videoFps, |
167 int videoStartBitrate, String videoCodec, boolean videoCodecHwAccelerati
on, | 169 int videoStartBitrate, String videoCodec, boolean videoCodecHwAccelerati
on, |
168 boolean captureToTexture, int audioStartBitrate, String audioCodec, | 170 boolean captureToTexture, int audioStartBitrate, String audioCodec, |
169 boolean noAudioProcessing, boolean aecDump, boolean useOpenSLES, | 171 boolean noAudioProcessing, boolean aecDump, boolean useOpenSLES, |
170 boolean disableBuiltInAEC) { | 172 boolean disableBuiltInAEC, boolean disableBuiltInAGC, boolean disableBui
ltInNS) { |
171 this.videoCallEnabled = videoCallEnabled; | 173 this.videoCallEnabled = videoCallEnabled; |
172 this.useCamera2 = useCamera2; | 174 this.useCamera2 = useCamera2; |
173 this.loopback = loopback; | 175 this.loopback = loopback; |
174 this.tracing = tracing; | 176 this.tracing = tracing; |
175 this.videoWidth = videoWidth; | 177 this.videoWidth = videoWidth; |
176 this.videoHeight = videoHeight; | 178 this.videoHeight = videoHeight; |
177 this.videoFps = videoFps; | 179 this.videoFps = videoFps; |
178 this.videoStartBitrate = videoStartBitrate; | 180 this.videoStartBitrate = videoStartBitrate; |
179 this.videoCodec = videoCodec; | 181 this.videoCodec = videoCodec; |
180 this.videoCodecHwAcceleration = videoCodecHwAcceleration; | 182 this.videoCodecHwAcceleration = videoCodecHwAcceleration; |
181 this.captureToTexture = captureToTexture; | 183 this.captureToTexture = captureToTexture; |
182 this.audioStartBitrate = audioStartBitrate; | 184 this.audioStartBitrate = audioStartBitrate; |
183 this.audioCodec = audioCodec; | 185 this.audioCodec = audioCodec; |
184 this.noAudioProcessing = noAudioProcessing; | 186 this.noAudioProcessing = noAudioProcessing; |
185 this.aecDump = aecDump; | 187 this.aecDump = aecDump; |
186 this.useOpenSLES = useOpenSLES; | 188 this.useOpenSLES = useOpenSLES; |
187 this.disableBuiltInAEC = disableBuiltInAEC; | 189 this.disableBuiltInAEC = disableBuiltInAEC; |
| 190 this.disableBuiltInAGC = disableBuiltInAGC; |
| 191 this.disableBuiltInNS = disableBuiltInNS; |
188 } | 192 } |
189 } | 193 } |
190 | 194 |
191 /** | 195 /** |
192 * Peer connection events. | 196 * Peer connection events. |
193 */ | 197 */ |
194 public interface PeerConnectionEvents { | 198 public interface PeerConnectionEvents { |
195 /** | 199 /** |
196 * Callback fired once local SDP is created and set. | 200 * Callback fired once local SDP is created and set. |
197 */ | 201 */ |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 365 } |
362 | 366 |
363 if (peerConnectionParameters.disableBuiltInAEC) { | 367 if (peerConnectionParameters.disableBuiltInAEC) { |
364 Log.d(TAG, "Disable built-in AEC even if device supports it"); | 368 Log.d(TAG, "Disable built-in AEC even if device supports it"); |
365 WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true); | 369 WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true); |
366 } else { | 370 } else { |
367 Log.d(TAG, "Enable built-in AEC if device supports it"); | 371 Log.d(TAG, "Enable built-in AEC if device supports it"); |
368 WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(false); | 372 WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(false); |
369 } | 373 } |
370 | 374 |
| 375 if (peerConnectionParameters.disableBuiltInAGC) { |
| 376 Log.d(TAG, "Disable built-in AGC even if device supports it"); |
| 377 WebRtcAudioUtils.setWebRtcBasedAutomaticGainControl(true); |
| 378 } else { |
| 379 Log.d(TAG, "Enable built-in AGC if device supports it"); |
| 380 WebRtcAudioUtils.setWebRtcBasedAutomaticGainControl(false); |
| 381 } |
| 382 |
| 383 if (peerConnectionParameters.disableBuiltInNS) { |
| 384 Log.d(TAG, "Disable built-in NS even if device supports it"); |
| 385 WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true); |
| 386 } else { |
| 387 Log.d(TAG, "Enable built-in NS if device supports it"); |
| 388 WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(false); |
| 389 } |
| 390 |
371 // Create peer connection factory. | 391 // Create peer connection factory. |
372 if (!PeerConnectionFactory.initializeAndroidGlobals(context, true, true, | 392 if (!PeerConnectionFactory.initializeAndroidGlobals(context, true, true, |
373 peerConnectionParameters.videoCodecHwAcceleration)) { | 393 peerConnectionParameters.videoCodecHwAcceleration)) { |
374 events.onPeerConnectionError("Failed to initializeAndroidGlobals"); | 394 events.onPeerConnectionError("Failed to initializeAndroidGlobals"); |
375 } | 395 } |
376 if (options != null) { | 396 if (options != null) { |
377 Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMas
k); | 397 Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMas
k); |
378 } | 398 } |
379 this.context = context; | 399 this.context = context; |
380 factory = new PeerConnectionFactory(options); | 400 factory = new PeerConnectionFactory(options); |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 public void onCreateFailure(final String error) { | 1189 public void onCreateFailure(final String error) { |
1170 reportError("createSDP error: " + error); | 1190 reportError("createSDP error: " + error); |
1171 } | 1191 } |
1172 | 1192 |
1173 @Override | 1193 @Override |
1174 public void onSetFailure(final String error) { | 1194 public void onSetFailure(final String error) { |
1175 reportError("setSDP error: " + error); | 1195 reportError("setSDP error: " + error); |
1176 } | 1196 } |
1177 } | 1197 } |
1178 } | 1198 } |
OLD | NEW |