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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 private static final String VIDEO_CODEC_H264_BASELINE = "H264 Baseline"; | 80 private static final String VIDEO_CODEC_H264_BASELINE = "H264 Baseline"; |
81 private static final String VIDEO_CODEC_H264_HIGH = "H264 High"; | 81 private static final String VIDEO_CODEC_H264_HIGH = "H264 High"; |
82 private static final String AUDIO_CODEC_OPUS = "opus"; | 82 private static final String AUDIO_CODEC_OPUS = "opus"; |
83 private static final String AUDIO_CODEC_ISAC = "ISAC"; | 83 private static final String AUDIO_CODEC_ISAC = "ISAC"; |
84 private static final String VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start-
bitrate"; | 84 private static final String VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start-
bitrate"; |
85 private static final String VIDEO_FLEXFEC_FIELDTRIAL = | 85 private static final String VIDEO_FLEXFEC_FIELDTRIAL = |
86 "WebRTC-FlexFEC-03-Advertised/Enabled/WebRTC-FlexFEC-03/Enabled/"; | 86 "WebRTC-FlexFEC-03-Advertised/Enabled/WebRTC-FlexFEC-03/Enabled/"; |
87 private static final String VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL = "WebRTC-In
telVP8/Enabled/"; | 87 private static final String VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL = "WebRTC-In
telVP8/Enabled/"; |
88 private static final String VIDEO_H264_HIGH_PROFILE_FIELDTRIAL = | 88 private static final String VIDEO_H264_HIGH_PROFILE_FIELDTRIAL = |
89 "WebRTC-H264HighProfile/Enabled/"; | 89 "WebRTC-H264HighProfile/Enabled/"; |
| 90 private static final String DISABLE_WEBRTC_AGC_FIELDTRIAL = |
| 91 "WebRTC-Audio-MinimizeResamplingOnMobile/Enabled/"; |
90 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; | 92 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; |
91 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; | 93 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; |
92 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT = "googAutoGain
Control"; | 94 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT = "googAutoGain
Control"; |
93 private static final String AUDIO_HIGH_PASS_FILTER_CONSTRAINT = "googHighpassF
ilter"; | 95 private static final String AUDIO_HIGH_PASS_FILTER_CONSTRAINT = "googHighpassF
ilter"; |
94 private static final String AUDIO_NOISE_SUPPRESSION_CONSTRAINT = "googNoiseSup
pression"; | 96 private static final String AUDIO_NOISE_SUPPRESSION_CONSTRAINT = "googNoiseSup
pression"; |
95 private static final String AUDIO_LEVEL_CONTROL_CONSTRAINT = "levelControl"; | 97 private static final String AUDIO_LEVEL_CONTROL_CONSTRAINT = "levelControl"; |
96 private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyA
greement"; | 98 private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyA
greement"; |
97 private static final int HD_VIDEO_WIDTH = 1280; | 99 private static final int HD_VIDEO_WIDTH = 1280; |
98 private static final int HD_VIDEO_HEIGHT = 720; | 100 private static final int HD_VIDEO_HEIGHT = 720; |
99 private static final int BPS_IN_KBPS = 1000; | 101 private static final int BPS_IN_KBPS = 1000; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 public final boolean videoFlexfecEnabled; | 185 public final boolean videoFlexfecEnabled; |
184 public final int audioStartBitrate; | 186 public final int audioStartBitrate; |
185 public final String audioCodec; | 187 public final String audioCodec; |
186 public final boolean noAudioProcessing; | 188 public final boolean noAudioProcessing; |
187 public final boolean aecDump; | 189 public final boolean aecDump; |
188 public final boolean useOpenSLES; | 190 public final boolean useOpenSLES; |
189 public final boolean disableBuiltInAEC; | 191 public final boolean disableBuiltInAEC; |
190 public final boolean disableBuiltInAGC; | 192 public final boolean disableBuiltInAGC; |
191 public final boolean disableBuiltInNS; | 193 public final boolean disableBuiltInNS; |
192 public final boolean enableLevelControl; | 194 public final boolean enableLevelControl; |
| 195 public final boolean disableWebRtcAGCAndHPF; |
193 private final DataChannelParameters dataChannelParameters; | 196 private final DataChannelParameters dataChannelParameters; |
194 | 197 |
195 public PeerConnectionParameters(boolean videoCallEnabled, boolean loopback,
boolean tracing, | 198 public PeerConnectionParameters(boolean videoCallEnabled, boolean loopback,
boolean tracing, |
196 int videoWidth, int videoHeight, int videoFps, int videoMaxBitrate, Stri
ng videoCodec, | 199 int videoWidth, int videoHeight, int videoFps, int videoMaxBitrate, Stri
ng videoCodec, |
197 boolean videoCodecHwAcceleration, boolean videoFlexfecEnabled, int audio
StartBitrate, | 200 boolean videoCodecHwAcceleration, boolean videoFlexfecEnabled, int audio
StartBitrate, |
198 String audioCodec, boolean noAudioProcessing, boolean aecDump, boolean u
seOpenSLES, | 201 String audioCodec, boolean noAudioProcessing, boolean aecDump, boolean u
seOpenSLES, |
199 boolean disableBuiltInAEC, boolean disableBuiltInAGC, boolean disableBui
ltInNS, | 202 boolean disableBuiltInAEC, boolean disableBuiltInAGC, boolean disableBui
ltInNS, |
200 boolean enableLevelControl) { | 203 boolean enableLevelControl, boolean disableWebRtcAGCAndHPF) { |
201 this(videoCallEnabled, loopback, tracing, videoWidth, videoHeight, videoFp
s, videoMaxBitrate, | 204 this(videoCallEnabled, loopback, tracing, videoWidth, videoHeight, videoFp
s, videoMaxBitrate, |
202 videoCodec, videoCodecHwAcceleration, videoFlexfecEnabled, audioStartB
itrate, audioCodec, | 205 videoCodec, videoCodecHwAcceleration, videoFlexfecEnabled, audioStartB
itrate, audioCodec, |
203 noAudioProcessing, aecDump, useOpenSLES, disableBuiltInAEC, disableBui
ltInAGC, | 206 noAudioProcessing, aecDump, useOpenSLES, disableBuiltInAEC, disableBui
ltInAGC, |
204 disableBuiltInNS, enableLevelControl, null); | 207 disableBuiltInNS, enableLevelControl, disableWebRtcAGCAndHPF, null); |
205 } | 208 } |
206 | 209 |
207 public PeerConnectionParameters(boolean videoCallEnabled, boolean loopback,
boolean tracing, | 210 public PeerConnectionParameters(boolean videoCallEnabled, boolean loopback,
boolean tracing, |
208 int videoWidth, int videoHeight, int videoFps, int videoMaxBitrate, Stri
ng videoCodec, | 211 int videoWidth, int videoHeight, int videoFps, int videoMaxBitrate, Stri
ng videoCodec, |
209 boolean videoCodecHwAcceleration, boolean videoFlexfecEnabled, int audio
StartBitrate, | 212 boolean videoCodecHwAcceleration, boolean videoFlexfecEnabled, int audio
StartBitrate, |
210 String audioCodec, boolean noAudioProcessing, boolean aecDump, boolean u
seOpenSLES, | 213 String audioCodec, boolean noAudioProcessing, boolean aecDump, boolean u
seOpenSLES, |
211 boolean disableBuiltInAEC, boolean disableBuiltInAGC, boolean disableBui
ltInNS, | 214 boolean disableBuiltInAEC, boolean disableBuiltInAGC, boolean disableBui
ltInNS, |
212 boolean enableLevelControl, DataChannelParameters dataChannelParameters)
{ | 215 boolean enableLevelControl, boolean disableWebRtcAGCAndHPF, |
| 216 DataChannelParameters dataChannelParameters) { |
213 this.videoCallEnabled = videoCallEnabled; | 217 this.videoCallEnabled = videoCallEnabled; |
214 this.loopback = loopback; | 218 this.loopback = loopback; |
215 this.tracing = tracing; | 219 this.tracing = tracing; |
216 this.videoWidth = videoWidth; | 220 this.videoWidth = videoWidth; |
217 this.videoHeight = videoHeight; | 221 this.videoHeight = videoHeight; |
218 this.videoFps = videoFps; | 222 this.videoFps = videoFps; |
219 this.videoMaxBitrate = videoMaxBitrate; | 223 this.videoMaxBitrate = videoMaxBitrate; |
220 this.videoCodec = videoCodec; | 224 this.videoCodec = videoCodec; |
221 this.videoFlexfecEnabled = videoFlexfecEnabled; | 225 this.videoFlexfecEnabled = videoFlexfecEnabled; |
222 this.videoCodecHwAcceleration = videoCodecHwAcceleration; | 226 this.videoCodecHwAcceleration = videoCodecHwAcceleration; |
223 this.audioStartBitrate = audioStartBitrate; | 227 this.audioStartBitrate = audioStartBitrate; |
224 this.audioCodec = audioCodec; | 228 this.audioCodec = audioCodec; |
225 this.noAudioProcessing = noAudioProcessing; | 229 this.noAudioProcessing = noAudioProcessing; |
226 this.aecDump = aecDump; | 230 this.aecDump = aecDump; |
227 this.useOpenSLES = useOpenSLES; | 231 this.useOpenSLES = useOpenSLES; |
228 this.disableBuiltInAEC = disableBuiltInAEC; | 232 this.disableBuiltInAEC = disableBuiltInAEC; |
229 this.disableBuiltInAGC = disableBuiltInAGC; | 233 this.disableBuiltInAGC = disableBuiltInAGC; |
230 this.disableBuiltInNS = disableBuiltInNS; | 234 this.disableBuiltInNS = disableBuiltInNS; |
231 this.enableLevelControl = enableLevelControl; | 235 this.enableLevelControl = enableLevelControl; |
| 236 this.disableWebRtcAGCAndHPF = disableWebRtcAGCAndHPF; |
232 this.dataChannelParameters = dataChannelParameters; | 237 this.dataChannelParameters = dataChannelParameters; |
233 } | 238 } |
234 } | 239 } |
235 | 240 |
236 /** | 241 /** |
237 * Peer connection events. | 242 * Peer connection events. |
238 */ | 243 */ |
239 public interface PeerConnectionEvents { | 244 public interface PeerConnectionEvents { |
240 /** | 245 /** |
241 * Callback fired once local SDP is created and set. | 246 * Callback fired once local SDP is created and set. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 "Create peer connection factory. Use video: " + peerConnectionParameters
.videoCallEnabled); | 387 "Create peer connection factory. Use video: " + peerConnectionParameters
.videoCallEnabled); |
383 isError = false; | 388 isError = false; |
384 | 389 |
385 // Initialize field trials. | 390 // Initialize field trials. |
386 String fieldTrials = ""; | 391 String fieldTrials = ""; |
387 if (peerConnectionParameters.videoFlexfecEnabled) { | 392 if (peerConnectionParameters.videoFlexfecEnabled) { |
388 fieldTrials += VIDEO_FLEXFEC_FIELDTRIAL; | 393 fieldTrials += VIDEO_FLEXFEC_FIELDTRIAL; |
389 Log.d(TAG, "Enable FlexFEC field trial."); | 394 Log.d(TAG, "Enable FlexFEC field trial."); |
390 } | 395 } |
391 fieldTrials += VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL; | 396 fieldTrials += VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL; |
| 397 if (peerConnectionParameters.disableWebRtcAGCAndHPF) { |
| 398 fieldTrials += DISABLE_WEBRTC_AGC_FIELDTRIAL; |
| 399 Log.d(TAG, "Disable WebRTC AGC field trial."); |
| 400 } |
392 | 401 |
393 // Check preferred video codec. | 402 // Check preferred video codec. |
394 preferredVideoCodec = VIDEO_CODEC_VP8; | 403 preferredVideoCodec = VIDEO_CODEC_VP8; |
395 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { | 404 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { |
396 switch (peerConnectionParameters.videoCodec) { | 405 switch (peerConnectionParameters.videoCodec) { |
397 case VIDEO_CODEC_VP8: | 406 case VIDEO_CODEC_VP8: |
398 preferredVideoCodec = VIDEO_CODEC_VP8; | 407 preferredVideoCodec = VIDEO_CODEC_VP8; |
399 break; | 408 break; |
400 case VIDEO_CODEC_VP9: | 409 case VIDEO_CODEC_VP9: |
401 preferredVideoCodec = VIDEO_CODEC_VP9; | 410 preferredVideoCodec = VIDEO_CODEC_VP9; |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 public void onCreateFailure(final String error) { | 1352 public void onCreateFailure(final String error) { |
1344 reportError("createSDP error: " + error); | 1353 reportError("createSDP error: " + error); |
1345 } | 1354 } |
1346 | 1355 |
1347 @Override | 1356 @Override |
1348 public void onSetFailure(final String error) { | 1357 public void onSetFailure(final String error) { |
1349 reportError("setSDP error: " + error); | 1358 reportError("setSDP error: " + error); |
1350 } | 1359 } |
1351 } | 1360 } |
1352 } | 1361 } |
OLD | NEW |