| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 private boolean renderVideo; | 121 private boolean renderVideo; |
| 122 private VideoTrack localVideoTrack; | 122 private VideoTrack localVideoTrack; |
| 123 private VideoTrack remoteVideoTrack; | 123 private VideoTrack remoteVideoTrack; |
| 124 | 124 |
| 125 /** | 125 /** |
| 126 * Peer connection parameters. | 126 * Peer connection parameters. |
| 127 */ | 127 */ |
| 128 public static class PeerConnectionParameters { | 128 public static class PeerConnectionParameters { |
| 129 public final boolean videoCallEnabled; | 129 public final boolean videoCallEnabled; |
| 130 public final boolean loopback; | 130 public final boolean loopback; |
| 131 public final boolean tracing; |
| 131 public final int videoWidth; | 132 public final int videoWidth; |
| 132 public final int videoHeight; | 133 public final int videoHeight; |
| 133 public final int videoFps; | 134 public final int videoFps; |
| 134 public final int videoStartBitrate; | 135 public final int videoStartBitrate; |
| 135 public final String videoCodec; | 136 public final String videoCodec; |
| 136 public final boolean videoCodecHwAcceleration; | 137 public final boolean videoCodecHwAcceleration; |
| 137 public final boolean captureToTexture; | 138 public final boolean captureToTexture; |
| 138 public final int audioStartBitrate; | 139 public final int audioStartBitrate; |
| 139 public final String audioCodec; | 140 public final String audioCodec; |
| 140 public final boolean noAudioProcessing; | 141 public final boolean noAudioProcessing; |
| 141 public final boolean useOpenSLES; | 142 public final boolean useOpenSLES; |
| 142 | 143 |
| 143 public PeerConnectionParameters( | 144 public PeerConnectionParameters( |
| 144 boolean videoCallEnabled, boolean loopback, | 145 boolean videoCallEnabled, boolean loopback, boolean tracing, |
| 145 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, | 146 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, |
| 146 String videoCodec, boolean videoCodecHwAcceleration, boolean captureToTe
xture, | 147 String videoCodec, boolean videoCodecHwAcceleration, boolean captureToTe
xture, |
| 147 int audioStartBitrate, String audioCodec, | 148 int audioStartBitrate, String audioCodec, |
| 148 boolean noAudioProcessing, boolean useOpenSLES) { | 149 boolean noAudioProcessing, boolean useOpenSLES) { |
| 149 this.videoCallEnabled = videoCallEnabled; | 150 this.videoCallEnabled = videoCallEnabled; |
| 150 this.loopback = loopback; | 151 this.loopback = loopback; |
| 152 this.tracing = tracing; |
| 151 this.videoWidth = videoWidth; | 153 this.videoWidth = videoWidth; |
| 152 this.videoHeight = videoHeight; | 154 this.videoHeight = videoHeight; |
| 153 this.videoFps = videoFps; | 155 this.videoFps = videoFps; |
| 154 this.videoStartBitrate = videoStartBitrate; | 156 this.videoStartBitrate = videoStartBitrate; |
| 155 this.videoCodec = videoCodec; | 157 this.videoCodec = videoCodec; |
| 156 this.videoCodecHwAcceleration = videoCodecHwAcceleration; | 158 this.videoCodecHwAcceleration = videoCodecHwAcceleration; |
| 157 this.captureToTexture = captureToTexture; | 159 this.captureToTexture = captureToTexture; |
| 158 this.audioStartBitrate = audioStartBitrate; | 160 this.audioStartBitrate = audioStartBitrate; |
| 159 this.audioCodec = audioCodec; | 161 this.audioCodec = audioCodec; |
| 160 this.noAudioProcessing = noAudioProcessing; | 162 this.noAudioProcessing = noAudioProcessing; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 closeInternal(); | 280 closeInternal(); |
| 279 } | 281 } |
| 280 }); | 282 }); |
| 281 } | 283 } |
| 282 | 284 |
| 283 public boolean isVideoCallEnabled() { | 285 public boolean isVideoCallEnabled() { |
| 284 return videoCallEnabled; | 286 return videoCallEnabled; |
| 285 } | 287 } |
| 286 | 288 |
| 287 private void createPeerConnectionFactoryInternal(Context context) { | 289 private void createPeerConnectionFactoryInternal(Context context) { |
| 290 PeerConnectionFactory.initializeInternalTracer(); |
| 291 if (peerConnectionParameters.tracing) { |
| 292 PeerConnectionFactory.startInternalTracingCapture("/mnt/sdcard/webrtc-
trace.txt"); |
| 293 } |
| 288 Log.d(TAG, "Create peer connection factory. Use video: " + | 294 Log.d(TAG, "Create peer connection factory. Use video: " + |
| 289 peerConnectionParameters.videoCallEnabled); | 295 peerConnectionParameters.videoCallEnabled); |
| 290 isError = false; | 296 isError = false; |
| 291 | 297 |
| 292 // Initialize field trials. | 298 // Initialize field trials. |
| 293 PeerConnectionFactory.initializeFieldTrials(FIELD_TRIAL_AUTOMATIC_RESIZE); | 299 PeerConnectionFactory.initializeFieldTrials(FIELD_TRIAL_AUTOMATIC_RESIZE); |
| 294 | 300 |
| 295 // Check preferred video codec. | 301 // Check preferred video codec. |
| 296 preferredVideoCodec = VIDEO_CODEC_VP8; | 302 preferredVideoCodec = VIDEO_CODEC_VP8; |
| 297 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { | 303 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 videoSource = null; | 501 videoSource = null; |
| 496 } | 502 } |
| 497 Log.d(TAG, "Closing peer connection factory."); | 503 Log.d(TAG, "Closing peer connection factory."); |
| 498 if (factory != null) { | 504 if (factory != null) { |
| 499 factory.dispose(); | 505 factory.dispose(); |
| 500 factory = null; | 506 factory = null; |
| 501 } | 507 } |
| 502 options = null; | 508 options = null; |
| 503 Log.d(TAG, "Closing peer connection done."); | 509 Log.d(TAG, "Closing peer connection done."); |
| 504 events.onPeerConnectionClosed(); | 510 events.onPeerConnectionClosed(); |
| 511 PeerConnectionFactory.stopInternalTracingCapture(); |
| 512 PeerConnectionFactory.shutdownInternalTracer(); |
| 505 } | 513 } |
| 506 | 514 |
| 507 public boolean isHDVideo() { | 515 public boolean isHDVideo() { |
| 508 if (!videoCallEnabled) { | 516 if (!videoCallEnabled) { |
| 509 return false; | 517 return false; |
| 510 } | 518 } |
| 511 int minWidth = 0; | 519 int minWidth = 0; |
| 512 int minHeight = 0; | 520 int minHeight = 0; |
| 513 for (KeyValuePair keyValuePair : videoConstraints.mandatory) { | 521 for (KeyValuePair keyValuePair : videoConstraints.mandatory) { |
| 514 if (keyValuePair.getKey().equals("minWidth")) { | 522 if (keyValuePair.getKey().equals("minWidth")) { |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 public void onCreateFailure(final String error) { | 1054 public void onCreateFailure(final String error) { |
| 1047 reportError("createSDP error: " + error); | 1055 reportError("createSDP error: " + error); |
| 1048 } | 1056 } |
| 1049 | 1057 |
| 1050 @Override | 1058 @Override |
| 1051 public void onSetFailure(final String error) { | 1059 public void onSetFailure(final String error) { |
| 1052 reportError("setSDP error: " + error); | 1060 reportError("setSDP error: " + error); |
| 1053 } | 1061 } |
| 1054 } | 1062 } |
| 1055 } | 1063 } |
| OLD | NEW |