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