| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 int videoWidth; | 130 public final int videoWidth; |
| 131 public final int videoHeight; | 131 public final int videoHeight; |
| 132 public final int videoFps; | 132 public final int videoFps; |
| 133 public final int videoStartBitrate; | 133 public final int videoStartBitrate; |
| 134 public final String videoCodec; | 134 public final String videoCodec; |
| 135 public final boolean videoCodecHwAcceleration; | 135 public final boolean videoCodecHwAcceleration; |
| 136 public final boolean captureToTexture; |
| 136 public final int audioStartBitrate; | 137 public final int audioStartBitrate; |
| 137 public final String audioCodec; | 138 public final String audioCodec; |
| 138 public final boolean noAudioProcessing; | 139 public final boolean noAudioProcessing; |
| 139 public final boolean useOpenSLES; | 140 public final boolean useOpenSLES; |
| 140 | 141 |
| 141 public PeerConnectionParameters( | 142 public PeerConnectionParameters( |
| 142 boolean videoCallEnabled, boolean loopback, | 143 boolean videoCallEnabled, boolean loopback, |
| 143 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, | 144 int videoWidth, int videoHeight, int videoFps, int videoStartBitrate, |
| 144 String videoCodec, boolean videoCodecHwAcceleration, | 145 String videoCodec, boolean videoCodecHwAcceleration, boolean captureToTe
xture, |
| 145 int audioStartBitrate, String audioCodec, | 146 int audioStartBitrate, String audioCodec, |
| 146 boolean noAudioProcessing, boolean useOpenSLES) { | 147 boolean noAudioProcessing, boolean useOpenSLES) { |
| 147 this.videoCallEnabled = videoCallEnabled; | 148 this.videoCallEnabled = videoCallEnabled; |
| 148 this.loopback = loopback; | 149 this.loopback = loopback; |
| 149 this.videoWidth = videoWidth; | 150 this.videoWidth = videoWidth; |
| 150 this.videoHeight = videoHeight; | 151 this.videoHeight = videoHeight; |
| 151 this.videoFps = videoFps; | 152 this.videoFps = videoFps; |
| 152 this.videoStartBitrate = videoStartBitrate; | 153 this.videoStartBitrate = videoStartBitrate; |
| 153 this.videoCodec = videoCodec; | 154 this.videoCodec = videoCodec; |
| 154 this.videoCodecHwAcceleration = videoCodecHwAcceleration; | 155 this.videoCodecHwAcceleration = videoCodecHwAcceleration; |
| 156 this.captureToTexture = captureToTexture; |
| 155 this.audioStartBitrate = audioStartBitrate; | 157 this.audioStartBitrate = audioStartBitrate; |
| 156 this.audioCodec = audioCodec; | 158 this.audioCodec = audioCodec; |
| 157 this.noAudioProcessing = noAudioProcessing; | 159 this.noAudioProcessing = noAudioProcessing; |
| 158 this.useOpenSLES = useOpenSLES; | 160 this.useOpenSLES = useOpenSLES; |
| 159 } | 161 } |
| 160 } | 162 } |
| 161 | 163 |
| 162 /** | 164 /** |
| 163 * Peer connection events. | 165 * Peer connection events. |
| 164 */ | 166 */ |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 Log.d(TAG, "Create peer connection."); | 424 Log.d(TAG, "Create peer connection."); |
| 423 | 425 |
| 424 Log.d(TAG, "PCConstraints: " + pcConstraints.toString()); | 426 Log.d(TAG, "PCConstraints: " + pcConstraints.toString()); |
| 425 if (videoConstraints != null) { | 427 if (videoConstraints != null) { |
| 426 Log.d(TAG, "VideoConstraints: " + videoConstraints.toString()); | 428 Log.d(TAG, "VideoConstraints: " + videoConstraints.toString()); |
| 427 } | 429 } |
| 428 queuedRemoteCandidates = new LinkedList<IceCandidate>(); | 430 queuedRemoteCandidates = new LinkedList<IceCandidate>(); |
| 429 | 431 |
| 430 if (videoCallEnabled) { | 432 if (videoCallEnabled) { |
| 431 Log.d(TAG, "EGLContext: " + renderEGLContext); | 433 Log.d(TAG, "EGLContext: " + renderEGLContext); |
| 432 factory.setVideoHwAccelerationOptions(renderEGLContext); | 434 factory.setVideoHwAccelerationOptions(renderEGLContext, renderEGLContext); |
| 433 } | 435 } |
| 434 | 436 |
| 435 PeerConnection.RTCConfiguration rtcConfig = | 437 PeerConnection.RTCConfiguration rtcConfig = |
| 436 new PeerConnection.RTCConfiguration(signalingParameters.iceServers); | 438 new PeerConnection.RTCConfiguration(signalingParameters.iceServers); |
| 437 // TCP candidates are only useful when connecting to a server that supports | 439 // TCP candidates are only useful when connecting to a server that supports |
| 438 // ICE-TCP. | 440 // ICE-TCP. |
| 439 rtcConfig.tcpCandidatePolicy = PeerConnection.TcpCandidatePolicy.DISABLED; | 441 rtcConfig.tcpCandidatePolicy = PeerConnection.TcpCandidatePolicy.DISABLED; |
| 440 rtcConfig.bundlePolicy = PeerConnection.BundlePolicy.MAXBUNDLE; | 442 rtcConfig.bundlePolicy = PeerConnection.BundlePolicy.MAXBUNDLE; |
| 441 rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE; | 443 rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE; |
| 442 // Use ECDSA encryption. | 444 // Use ECDSA encryption. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 455 | 457 |
| 456 mediaStream = factory.createLocalMediaStream("ARDAMS"); | 458 mediaStream = factory.createLocalMediaStream("ARDAMS"); |
| 457 if (videoCallEnabled) { | 459 if (videoCallEnabled) { |
| 458 String cameraDeviceName = CameraEnumerationAndroid.getDeviceName(0); | 460 String cameraDeviceName = CameraEnumerationAndroid.getDeviceName(0); |
| 459 String frontCameraDeviceName = | 461 String frontCameraDeviceName = |
| 460 CameraEnumerationAndroid.getNameOfFrontFacingDevice(); | 462 CameraEnumerationAndroid.getNameOfFrontFacingDevice(); |
| 461 if (numberOfCameras > 1 && frontCameraDeviceName != null) { | 463 if (numberOfCameras > 1 && frontCameraDeviceName != null) { |
| 462 cameraDeviceName = frontCameraDeviceName; | 464 cameraDeviceName = frontCameraDeviceName; |
| 463 } | 465 } |
| 464 Log.d(TAG, "Opening camera: " + cameraDeviceName); | 466 Log.d(TAG, "Opening camera: " + cameraDeviceName); |
| 465 videoCapturer = VideoCapturerAndroid.create(cameraDeviceName, null); | 467 videoCapturer = VideoCapturerAndroid.create(cameraDeviceName, null, |
| 468 peerConnectionParameters.captureToTexture ? renderEGLContext : null
); |
| 466 if (videoCapturer == null) { | 469 if (videoCapturer == null) { |
| 467 reportError("Failed to open camera"); | 470 reportError("Failed to open camera"); |
| 468 return; | 471 return; |
| 469 } | 472 } |
| 470 mediaStream.addTrack(createVideoTrack(videoCapturer)); | 473 mediaStream.addTrack(createVideoTrack(videoCapturer)); |
| 471 } | 474 } |
| 472 | 475 |
| 473 mediaStream.addTrack(factory.createAudioTrack( | 476 mediaStream.addTrack(factory.createAudioTrack( |
| 474 AUDIO_TRACK_ID, | 477 AUDIO_TRACK_ID, |
| 475 factory.createAudioSource(audioConstraints))); | 478 factory.createAudioSource(audioConstraints))); |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 public void onCreateFailure(final String error) { | 1045 public void onCreateFailure(final String error) { |
| 1043 reportError("createSDP error: " + error); | 1046 reportError("createSDP error: " + error); |
| 1044 } | 1047 } |
| 1045 | 1048 |
| 1046 @Override | 1049 @Override |
| 1047 public void onSetFailure(final String error) { | 1050 public void onSetFailure(final String error) { |
| 1048 reportError("setSDP error: " + error); | 1051 reportError("setSDP error: " + error); |
| 1049 } | 1052 } |
| 1050 } | 1053 } |
| 1051 } | 1054 } |
| OLD | NEW |