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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 private static final String VIDEO_CODEC_H264 = "H264"; | 73 private static final String VIDEO_CODEC_H264 = "H264"; |
74 private static final String AUDIO_CODEC_OPUS = "opus"; | 74 private static final String AUDIO_CODEC_OPUS = "opus"; |
75 private static final String AUDIO_CODEC_ISAC = "ISAC"; | 75 private static final String AUDIO_CODEC_ISAC = "ISAC"; |
76 private static final String VIDEO_CODEC_PARAM_START_BITRATE = | 76 private static final String VIDEO_CODEC_PARAM_START_BITRATE = |
77 "x-google-start-bitrate"; | 77 "x-google-start-bitrate"; |
78 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; | 78 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; |
79 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; | 79 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; |
80 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT= "googAutoGainC
ontrol"; | 80 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT= "googAutoGainC
ontrol"; |
81 private static final String AUDIO_HIGH_PASS_FILTER_CONSTRAINT = "googHighpass
Filter"; | 81 private static final String AUDIO_HIGH_PASS_FILTER_CONSTRAINT = "googHighpass
Filter"; |
82 private static final String AUDIO_NOISE_SUPPRESSION_CONSTRAINT = "googNoiseSup
pression"; | 82 private static final String AUDIO_NOISE_SUPPRESSION_CONSTRAINT = "googNoiseSup
pression"; |
| 83 private static final String AUDIO_LEVEL_CONTROL_CONSTRAINT = "levelControl"; |
83 private static final String MAX_VIDEO_WIDTH_CONSTRAINT = "maxWidth"; | 84 private static final String MAX_VIDEO_WIDTH_CONSTRAINT = "maxWidth"; |
84 private static final String MIN_VIDEO_WIDTH_CONSTRAINT = "minWidth"; | 85 private static final String MIN_VIDEO_WIDTH_CONSTRAINT = "minWidth"; |
85 private static final String MAX_VIDEO_HEIGHT_CONSTRAINT = "maxHeight"; | 86 private static final String MAX_VIDEO_HEIGHT_CONSTRAINT = "maxHeight"; |
86 private static final String MIN_VIDEO_HEIGHT_CONSTRAINT = "minHeight"; | 87 private static final String MIN_VIDEO_HEIGHT_CONSTRAINT = "minHeight"; |
87 private static final String MAX_VIDEO_FPS_CONSTRAINT = "maxFrameRate"; | 88 private static final String MAX_VIDEO_FPS_CONSTRAINT = "maxFrameRate"; |
88 private static final String MIN_VIDEO_FPS_CONSTRAINT = "minFrameRate"; | 89 private static final String MIN_VIDEO_FPS_CONSTRAINT = "minFrameRate"; |
89 private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyA
greement"; | 90 private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyA
greement"; |
90 private static final int HD_VIDEO_WIDTH = 1280; | 91 private static final int HD_VIDEO_WIDTH = 1280; |
91 private static final int HD_VIDEO_HEIGHT = 720; | 92 private static final int HD_VIDEO_HEIGHT = 720; |
92 private static final int MAX_VIDEO_WIDTH = 1280; | 93 private static final int MAX_VIDEO_WIDTH = 1280; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 public final boolean videoCodecHwAcceleration; | 156 public final boolean videoCodecHwAcceleration; |
156 public final boolean captureToTexture; | 157 public final boolean captureToTexture; |
157 public final int audioStartBitrate; | 158 public final int audioStartBitrate; |
158 public final String audioCodec; | 159 public final String audioCodec; |
159 public final boolean noAudioProcessing; | 160 public final boolean noAudioProcessing; |
160 public final boolean aecDump; | 161 public final boolean aecDump; |
161 public final boolean useOpenSLES; | 162 public final boolean useOpenSLES; |
162 public final boolean disableBuiltInAEC; | 163 public final boolean disableBuiltInAEC; |
163 public final boolean disableBuiltInAGC; | 164 public final boolean disableBuiltInAGC; |
164 public final boolean disableBuiltInNS; | 165 public final boolean disableBuiltInNS; |
| 166 public final boolean enableLevelControl; |
165 | 167 |
166 public PeerConnectionParameters( | 168 public PeerConnectionParameters( |
167 boolean videoCallEnabled, boolean loopback, boolean tracing, boolean use
Camera2, | 169 boolean videoCallEnabled, boolean loopback, boolean tracing, boolean use
Camera2, |
168 int videoWidth, int videoHeight, int videoFps, | 170 int videoWidth, int videoHeight, int videoFps, |
169 int videoStartBitrate, String videoCodec, boolean videoCodecHwAccelerati
on, | 171 int videoStartBitrate, String videoCodec, boolean videoCodecHwAccelerati
on, |
170 boolean captureToTexture, int audioStartBitrate, String audioCodec, | 172 boolean captureToTexture, int audioStartBitrate, String audioCodec, |
171 boolean noAudioProcessing, boolean aecDump, boolean useOpenSLES, | 173 boolean noAudioProcessing, boolean aecDump, boolean useOpenSLES, |
172 boolean disableBuiltInAEC, boolean disableBuiltInAGC, boolean disableBui
ltInNS) { | 174 boolean disableBuiltInAEC, boolean disableBuiltInAGC, boolean disableBui
ltInNS, |
| 175 boolean enableLevelControl) { |
173 this.videoCallEnabled = videoCallEnabled; | 176 this.videoCallEnabled = videoCallEnabled; |
174 this.useCamera2 = useCamera2; | 177 this.useCamera2 = useCamera2; |
175 this.loopback = loopback; | 178 this.loopback = loopback; |
176 this.tracing = tracing; | 179 this.tracing = tracing; |
177 this.videoWidth = videoWidth; | 180 this.videoWidth = videoWidth; |
178 this.videoHeight = videoHeight; | 181 this.videoHeight = videoHeight; |
179 this.videoFps = videoFps; | 182 this.videoFps = videoFps; |
180 this.videoStartBitrate = videoStartBitrate; | 183 this.videoStartBitrate = videoStartBitrate; |
181 this.videoCodec = videoCodec; | 184 this.videoCodec = videoCodec; |
182 this.videoCodecHwAcceleration = videoCodecHwAcceleration; | 185 this.videoCodecHwAcceleration = videoCodecHwAcceleration; |
183 this.captureToTexture = captureToTexture; | 186 this.captureToTexture = captureToTexture; |
184 this.audioStartBitrate = audioStartBitrate; | 187 this.audioStartBitrate = audioStartBitrate; |
185 this.audioCodec = audioCodec; | 188 this.audioCodec = audioCodec; |
186 this.noAudioProcessing = noAudioProcessing; | 189 this.noAudioProcessing = noAudioProcessing; |
187 this.aecDump = aecDump; | 190 this.aecDump = aecDump; |
188 this.useOpenSLES = useOpenSLES; | 191 this.useOpenSLES = useOpenSLES; |
189 this.disableBuiltInAEC = disableBuiltInAEC; | 192 this.disableBuiltInAEC = disableBuiltInAEC; |
190 this.disableBuiltInAGC = disableBuiltInAGC; | 193 this.disableBuiltInAGC = disableBuiltInAGC; |
191 this.disableBuiltInNS = disableBuiltInNS; | 194 this.disableBuiltInNS = disableBuiltInNS; |
| 195 this.enableLevelControl = enableLevelControl; |
192 } | 196 } |
193 } | 197 } |
194 | 198 |
195 /** | 199 /** |
196 * Peer connection events. | 200 * Peer connection events. |
197 */ | 201 */ |
198 public interface PeerConnectionEvents { | 202 public interface PeerConnectionEvents { |
199 /** | 203 /** |
200 * Callback fired once local SDP is created and set. | 204 * Callback fired once local SDP is created and set. |
201 */ | 205 */ |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 Log.d(TAG, "Disabling audio processing"); | 452 Log.d(TAG, "Disabling audio processing"); |
449 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 453 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
450 AUDIO_ECHO_CANCELLATION_CONSTRAINT, "false")); | 454 AUDIO_ECHO_CANCELLATION_CONSTRAINT, "false")); |
451 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 455 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
452 AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT, "false")); | 456 AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT, "false")); |
453 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 457 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
454 AUDIO_HIGH_PASS_FILTER_CONSTRAINT, "false")); | 458 AUDIO_HIGH_PASS_FILTER_CONSTRAINT, "false")); |
455 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 459 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
456 AUDIO_NOISE_SUPPRESSION_CONSTRAINT , "false")); | 460 AUDIO_NOISE_SUPPRESSION_CONSTRAINT , "false")); |
457 } | 461 } |
| 462 if (peerConnectionParameters.enableLevelControl) { |
| 463 Log.d(TAG, "Enabling level control."); |
| 464 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
| 465 AUDIO_LEVEL_CONTROL_CONSTRAINT, "true")); |
| 466 } |
458 // Create SDP constraints. | 467 // Create SDP constraints. |
459 sdpMediaConstraints = new MediaConstraints(); | 468 sdpMediaConstraints = new MediaConstraints(); |
460 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 469 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
461 "OfferToReceiveAudio", "true")); | 470 "OfferToReceiveAudio", "true")); |
462 if (videoCallEnabled || peerConnectionParameters.loopback) { | 471 if (videoCallEnabled || peerConnectionParameters.loopback) { |
463 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 472 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
464 "OfferToReceiveVideo", "true")); | 473 "OfferToReceiveVideo", "true")); |
465 } else { | 474 } else { |
466 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 475 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
467 "OfferToReceiveVideo", "false")); | 476 "OfferToReceiveVideo", "false")); |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 public void onCreateFailure(final String error) { | 1198 public void onCreateFailure(final String error) { |
1190 reportError("createSDP error: " + error); | 1199 reportError("createSDP error: " + error); |
1191 } | 1200 } |
1192 | 1201 |
1193 @Override | 1202 @Override |
1194 public void onSetFailure(final String error) { | 1203 public void onSetFailure(final String error) { |
1195 reportError("setSDP error: " + error); | 1204 reportError("setSDP error: " + error); |
1196 } | 1205 } |
1197 } | 1206 } |
1198 } | 1207 } |
OLD | NEW |