| 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"; |
| 82 private static final String MAX_VIDEO_WIDTH_CONSTRAINT = "maxWidth"; | 86 private static final String MAX_VIDEO_WIDTH_CONSTRAINT = "maxWidth"; |
| 83 private static final String MIN_VIDEO_WIDTH_CONSTRAINT = "minWidth"; | 87 private static final String MIN_VIDEO_WIDTH_CONSTRAINT = "minWidth"; |
| 84 private static final String MAX_VIDEO_HEIGHT_CONSTRAINT = "maxHeight"; | 88 private static final String MAX_VIDEO_HEIGHT_CONSTRAINT = "maxHeight"; |
| 85 private static final String MIN_VIDEO_HEIGHT_CONSTRAINT = "minHeight"; | 89 private static final String MIN_VIDEO_HEIGHT_CONSTRAINT = "minHeight"; |
| 86 private static final String MAX_VIDEO_FPS_CONSTRAINT = "maxFrameRate"; | 90 private static final String MAX_VIDEO_FPS_CONSTRAINT = "maxFrameRate"; |
| 87 private static final String MIN_VIDEO_FPS_CONSTRAINT = "minFrameRate"; | 91 private static final String MIN_VIDEO_FPS_CONSTRAINT = "minFrameRate"; |
| 88 private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyA
greement"; | 92 private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyA
greement"; |
| 89 private static final int HD_VIDEO_WIDTH = 1280; | 93 private static final int HD_VIDEO_WIDTH = 1280; |
| 90 private static final int HD_VIDEO_HEIGHT = 720; | 94 private static final int HD_VIDEO_HEIGHT = 720; |
| 91 private static final int MAX_VIDEO_WIDTH = 1280; | 95 private static final int MAX_VIDEO_WIDTH = 1280; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 public final boolean videoCallEnabled; | 141 public final boolean videoCallEnabled; |
| 138 public final boolean loopback; | 142 public final boolean loopback; |
| 139 public final int videoWidth; | 143 public final int videoWidth; |
| 140 public final int videoHeight; | 144 public final int videoHeight; |
| 141 public final int videoFps; | 145 public final int videoFps; |
| 142 public final int videoStartBitrate; | 146 public final int videoStartBitrate; |
| 143 public final String videoCodec; | 147 public final String videoCodec; |
| 144 public final boolean videoCodecHwAcceleration; | 148 public final boolean videoCodecHwAcceleration; |
| 145 public final int audioStartBitrate; | 149 public final int audioStartBitrate; |
| 146 public final String audioCodec; | 150 public final String audioCodec; |
| 151 public final boolean noAudioProcessing; |
| 147 public final boolean cpuOveruseDetection; | 152 public final boolean cpuOveruseDetection; |
| 148 | 153 |
| 149 public PeerConnectionParameters( | 154 public PeerConnectionParameters( |
| 150 boolean videoCallEnabled, boolean loopback, | 155 boolean videoCallEnabled, boolean loopback, |
| 151 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, | 156 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, |
| 152 String videoCodec, boolean videoCodecHwAcceleration, | 157 String videoCodec, boolean videoCodecHwAcceleration, |
| 153 int audioStartBitrate, String audioCodec, | 158 int audioStartBitrate, String audioCodec, |
| 154 boolean cpuOveruseDetection) { | 159 boolean noAudioProcessing, boolean cpuOveruseDetection) { |
| 155 this.videoCallEnabled = videoCallEnabled; | 160 this.videoCallEnabled = videoCallEnabled; |
| 156 this.loopback = loopback; | 161 this.loopback = loopback; |
| 157 this.videoWidth = videoWidth; | 162 this.videoWidth = videoWidth; |
| 158 this.videoHeight = videoHeight; | 163 this.videoHeight = videoHeight; |
| 159 this.videoFps = videoFps; | 164 this.videoFps = videoFps; |
| 160 this.videoStartBitrate = videoStartBitrate; | 165 this.videoStartBitrate = videoStartBitrate; |
| 161 this.videoCodec = videoCodec; | 166 this.videoCodec = videoCodec; |
| 162 this.videoCodecHwAcceleration = videoCodecHwAcceleration; | 167 this.videoCodecHwAcceleration = videoCodecHwAcceleration; |
| 163 this.audioStartBitrate = audioStartBitrate; | 168 this.audioStartBitrate = audioStartBitrate; |
| 164 this.audioCodec = audioCodec; | 169 this.audioCodec = audioCodec; |
| 170 this.noAudioProcessing = noAudioProcessing; |
| 165 this.cpuOveruseDetection = cpuOveruseDetection; | 171 this.cpuOveruseDetection = cpuOveruseDetection; |
| 166 } | 172 } |
| 167 } | 173 } |
| 168 | 174 |
| 169 /** | 175 /** |
| 170 * Peer connection events. | 176 * Peer connection events. |
| 171 */ | 177 */ |
| 172 public static interface PeerConnectionEvents { | 178 public static interface PeerConnectionEvents { |
| 173 /** | 179 /** |
| 174 * Callback fired once local SDP is created and set. | 180 * Callback fired once local SDP is created and set. |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 videoFps = Math.min(videoFps, MAX_VIDEO_FPS); | 386 videoFps = Math.min(videoFps, MAX_VIDEO_FPS); |
| 381 videoConstraints.mandatory.add(new KeyValuePair( | 387 videoConstraints.mandatory.add(new KeyValuePair( |
| 382 MIN_VIDEO_FPS_CONSTRAINT, Integer.toString(videoFps))); | 388 MIN_VIDEO_FPS_CONSTRAINT, Integer.toString(videoFps))); |
| 383 videoConstraints.mandatory.add(new KeyValuePair( | 389 videoConstraints.mandatory.add(new KeyValuePair( |
| 384 MAX_VIDEO_FPS_CONSTRAINT, Integer.toString(videoFps))); | 390 MAX_VIDEO_FPS_CONSTRAINT, Integer.toString(videoFps))); |
| 385 } | 391 } |
| 386 } | 392 } |
| 387 | 393 |
| 388 // Create audio constraints. | 394 // Create audio constraints. |
| 389 audioConstraints = new MediaConstraints(); | 395 audioConstraints = new MediaConstraints(); |
| 390 | 396 // added for audio performance measurements |
| 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 } |
| 391 // Create SDP constraints. | 408 // Create SDP constraints. |
| 392 sdpMediaConstraints = new MediaConstraints(); | 409 sdpMediaConstraints = new MediaConstraints(); |
| 393 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 410 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
| 394 "OfferToReceiveAudio", "true")); | 411 "OfferToReceiveAudio", "true")); |
| 395 if (videoCallEnabled || peerConnectionParameters.loopback) { | 412 if (videoCallEnabled || peerConnectionParameters.loopback) { |
| 396 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 413 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
| 397 "OfferToReceiveVideo", "true")); | 414 "OfferToReceiveVideo", "true")); |
| 398 } else { | 415 } else { |
| 399 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( | 416 sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair( |
| 400 "OfferToReceiveVideo", "false")); | 417 "OfferToReceiveVideo", "false")); |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 public void onCreateFailure(final String error) { | 1019 public void onCreateFailure(final String error) { |
| 1003 reportError("createSDP error: " + error); | 1020 reportError("createSDP error: " + error); |
| 1004 } | 1021 } |
| 1005 | 1022 |
| 1006 @Override | 1023 @Override |
| 1007 public void onSetFailure(final String error) { | 1024 public void onSetFailure(final String error) { |
| 1008 reportError("setSDP error: " + error); | 1025 reportError("setSDP error: " + error); |
| 1009 } | 1026 } |
| 1010 } | 1027 } |
| 1011 } | 1028 } |
| OLD | NEW |