OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 private static final String TAG = "PCRTCClient"; | 72 private static final String TAG = "PCRTCClient"; |
73 private static final String FIELD_TRIAL_VP9 = "WebRTC-SupportVP9/Enabled/"; | 73 private static final String FIELD_TRIAL_VP9 = "WebRTC-SupportVP9/Enabled/"; |
74 private static final String VIDEO_CODEC_VP8 = "VP8"; | 74 private static final String VIDEO_CODEC_VP8 = "VP8"; |
75 private static final String VIDEO_CODEC_VP9 = "VP9"; | 75 private static final String VIDEO_CODEC_VP9 = "VP9"; |
76 private static final String VIDEO_CODEC_H264 = "H264"; | 76 private static final String VIDEO_CODEC_H264 = "H264"; |
77 private static final String AUDIO_CODEC_OPUS = "opus"; | 77 private static final String AUDIO_CODEC_OPUS = "opus"; |
78 private static final String AUDIO_CODEC_ISAC = "ISAC"; | 78 private static final String AUDIO_CODEC_ISAC = "ISAC"; |
79 private static final String VIDEO_CODEC_PARAM_START_BITRATE = | 79 private static final String VIDEO_CODEC_PARAM_START_BITRATE = |
80 "x-google-start-bitrate"; | 80 "x-google-start-bitrate"; |
81 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; | 81 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; |
82 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; | |
83 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT= "googAutoGainC
ontrol"; | |
84 private static final String AUDIO_HIGH_PASS_FILTER_CONSTRAINT = "googHighpass
Filter"; | |
85 private static final String AUDIO_NOISE_SUPPRESSION_CONSTRAINT = "googNoiseSup
pression"; | |
86 private static final String MAX_VIDEO_WIDTH_CONSTRAINT = "maxWidth"; | 82 private static final String MAX_VIDEO_WIDTH_CONSTRAINT = "maxWidth"; |
87 private static final String MIN_VIDEO_WIDTH_CONSTRAINT = "minWidth"; | 83 private static final String MIN_VIDEO_WIDTH_CONSTRAINT = "minWidth"; |
88 private static final String MAX_VIDEO_HEIGHT_CONSTRAINT = "maxHeight"; | 84 private static final String MAX_VIDEO_HEIGHT_CONSTRAINT = "maxHeight"; |
89 private static final String MIN_VIDEO_HEIGHT_CONSTRAINT = "minHeight"; | 85 private static final String MIN_VIDEO_HEIGHT_CONSTRAINT = "minHeight"; |
90 private static final String MAX_VIDEO_FPS_CONSTRAINT = "maxFrameRate"; | 86 private static final String MAX_VIDEO_FPS_CONSTRAINT = "maxFrameRate"; |
91 private static final String MIN_VIDEO_FPS_CONSTRAINT = "minFrameRate"; | 87 private static final String MIN_VIDEO_FPS_CONSTRAINT = "minFrameRate"; |
92 private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyA
greement"; | 88 private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyA
greement"; |
93 private static final int HD_VIDEO_WIDTH = 1280; | 89 private static final int HD_VIDEO_WIDTH = 1280; |
94 private static final int HD_VIDEO_HEIGHT = 720; | 90 private static final int HD_VIDEO_HEIGHT = 720; |
95 private static final int MAX_VIDEO_WIDTH = 1280; | 91 private static final int MAX_VIDEO_WIDTH = 1280; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 public final boolean videoCallEnabled; | 137 public final boolean videoCallEnabled; |
142 public final boolean loopback; | 138 public final boolean loopback; |
143 public final int videoWidth; | 139 public final int videoWidth; |
144 public final int videoHeight; | 140 public final int videoHeight; |
145 public final int videoFps; | 141 public final int videoFps; |
146 public final int videoStartBitrate; | 142 public final int videoStartBitrate; |
147 public final String videoCodec; | 143 public final String videoCodec; |
148 public final boolean videoCodecHwAcceleration; | 144 public final boolean videoCodecHwAcceleration; |
149 public final int audioStartBitrate; | 145 public final int audioStartBitrate; |
150 public final String audioCodec; | 146 public final String audioCodec; |
151 public final boolean noAudioProcessing; | |
152 public final boolean cpuOveruseDetection; | 147 public final boolean cpuOveruseDetection; |
153 | 148 |
154 public PeerConnectionParameters( | 149 public PeerConnectionParameters( |
155 boolean videoCallEnabled, boolean loopback, | 150 boolean videoCallEnabled, boolean loopback, |
156 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, | 151 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, |
157 String videoCodec, boolean videoCodecHwAcceleration, | 152 String videoCodec, boolean videoCodecHwAcceleration, |
158 int audioStartBitrate, String audioCodec, | 153 int audioStartBitrate, String audioCodec, |
159 boolean noAudioProcessing, boolean cpuOveruseDetection) { | 154 boolean cpuOveruseDetection) { |
160 this.videoCallEnabled = videoCallEnabled; | 155 this.videoCallEnabled = videoCallEnabled; |
161 this.loopback = loopback; | 156 this.loopback = loopback; |
162 this.videoWidth = videoWidth; | 157 this.videoWidth = videoWidth; |
163 this.videoHeight = videoHeight; | 158 this.videoHeight = videoHeight; |
164 this.videoFps = videoFps; | 159 this.videoFps = videoFps; |
165 this.videoStartBitrate = videoStartBitrate; | 160 this.videoStartBitrate = videoStartBitrate; |
166 this.videoCodec = videoCodec; | 161 this.videoCodec = videoCodec; |
167 this.videoCodecHwAcceleration = videoCodecHwAcceleration; | 162 this.videoCodecHwAcceleration = videoCodecHwAcceleration; |
168 this.audioStartBitrate = audioStartBitrate; | 163 this.audioStartBitrate = audioStartBitrate; |
169 this.audioCodec = audioCodec; | 164 this.audioCodec = audioCodec; |
170 this.noAudioProcessing = noAudioProcessing; | |
171 this.cpuOveruseDetection = cpuOveruseDetection; | 165 this.cpuOveruseDetection = cpuOveruseDetection; |
172 } | 166 } |
173 } | 167 } |
174 | 168 |
175 /** | 169 /** |
176 * Peer connection events. | 170 * Peer connection events. |
177 */ | 171 */ |
178 public static interface PeerConnectionEvents { | 172 public static interface PeerConnectionEvents { |
179 /** | 173 /** |
180 * Callback fired once local SDP is created and set. | 174 * Callback fired once local SDP is created and set. |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 videoFps = Math.min(videoFps, MAX_VIDEO_FPS); | 380 videoFps = Math.min(videoFps, MAX_VIDEO_FPS); |
387 videoConstraints.mandatory.add(new KeyValuePair( | 381 videoConstraints.mandatory.add(new KeyValuePair( |
388 MIN_VIDEO_FPS_CONSTRAINT, Integer.toString(videoFps))); | 382 MIN_VIDEO_FPS_CONSTRAINT, Integer.toString(videoFps))); |
389 videoConstraints.mandatory.add(new KeyValuePair( | 383 videoConstraints.mandatory.add(new KeyValuePair( |
390 MAX_VIDEO_FPS_CONSTRAINT, Integer.toString(videoFps))); | 384 MAX_VIDEO_FPS_CONSTRAINT, Integer.toString(videoFps))); |
391 } | 385 } |
392 } | 386 } |
393 | 387 |
394 // Create audio constraints. | 388 // Create audio constraints. |
395 audioConstraints = new MediaConstraints(); | 389 audioConstraints = new MediaConstraints(); |
396 // added for audio performance measurements | 390 |
397 if (peerConnectionParameters.noAudioProcessing) { | |
398 Log.d(TAG, "Disabling audio processing"); | |
399 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | |
400 AUDIO_ECHO_CANCELLATION_CONSTRAINT, "false")); | |
401 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | |
402 AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT, "false")); | |
403 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | |
404 AUDIO_HIGH_PASS_FILTER_CONSTRAINT, "false")); | |
405 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | |
406 AUDIO_NOISE_SUPPRESSION_CONSTRAINT , "false")); | |
407 } | |
408 // Create SDP constraints. | 391 // Create SDP constraints. |
409 sdpMediaConstraints = new MediaConstraints(); | 392 sdpMediaConstraints = new MediaConstraints(); |
410 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 393 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
411 "OfferToReceiveAudio", "true")); | 394 "OfferToReceiveAudio", "true")); |
412 if (videoCallEnabled || peerConnectionParameters.loopback) { | 395 if (videoCallEnabled || peerConnectionParameters.loopback) { |
413 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 396 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
414 "OfferToReceiveVideo", "true")); | 397 "OfferToReceiveVideo", "true")); |
415 } else { | 398 } else { |
416 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 399 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
417 "OfferToReceiveVideo", "false")); | 400 "OfferToReceiveVideo", "false")); |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 public void onCreateFailure(final String error) { | 1002 public void onCreateFailure(final String error) { |
1020 reportError("createSDP error: " + error); | 1003 reportError("createSDP error: " + error); |
1021 } | 1004 } |
1022 | 1005 |
1023 @Override | 1006 @Override |
1024 public void onSetFailure(final String error) { | 1007 public void onSetFailure(final String error) { |
1025 reportError("setSDP error: " + error); | 1008 reportError("setSDP error: " + error); |
1026 } | 1009 } |
1027 } | 1010 } |
1028 } | 1011 } |
OLD | NEW |