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 18 matching lines...) Expand all Loading... |
29 import java.util.concurrent.ExecutorService; | 29 import java.util.concurrent.ExecutorService; |
30 import java.util.concurrent.Executors; | 30 import java.util.concurrent.Executors; |
31 import java.util.regex.Matcher; | 31 import java.util.regex.Matcher; |
32 import java.util.regex.Pattern; | 32 import java.util.regex.Pattern; |
33 import org.appspot.apprtc.AppRTCClient.SignalingParameters; | 33 import org.appspot.apprtc.AppRTCClient.SignalingParameters; |
34 import org.webrtc.AudioSource; | 34 import org.webrtc.AudioSource; |
35 import org.webrtc.AudioTrack; | 35 import org.webrtc.AudioTrack; |
36 import org.webrtc.CameraVideoCapturer; | 36 import org.webrtc.CameraVideoCapturer; |
37 import org.webrtc.DataChannel; | 37 import org.webrtc.DataChannel; |
38 import org.webrtc.EglBase; | 38 import org.webrtc.EglBase; |
| 39 import org.webrtc.HardwareVideoDecoderFactory; |
| 40 import org.webrtc.HardwareVideoEncoderFactory; |
39 import org.webrtc.IceCandidate; | 41 import org.webrtc.IceCandidate; |
40 import org.webrtc.Logging; | 42 import org.webrtc.Logging; |
41 import org.webrtc.MediaConstraints; | 43 import org.webrtc.MediaConstraints; |
42 import org.webrtc.MediaStream; | 44 import org.webrtc.MediaStream; |
43 import org.webrtc.PeerConnection; | 45 import org.webrtc.PeerConnection; |
44 import org.webrtc.PeerConnection.IceConnectionState; | 46 import org.webrtc.PeerConnection.IceConnectionState; |
45 import org.webrtc.PeerConnectionFactory; | 47 import org.webrtc.PeerConnectionFactory; |
46 import org.webrtc.RtpParameters; | 48 import org.webrtc.RtpParameters; |
47 import org.webrtc.RtpReceiver; | 49 import org.webrtc.RtpReceiver; |
48 import org.webrtc.RtpSender; | 50 import org.webrtc.RtpSender; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 333 } |
332 }); | 334 }); |
333 } | 335 } |
334 | 336 |
335 public void createPeerConnection(final VideoRenderer.Callbacks localRender, | 337 public void createPeerConnection(final VideoRenderer.Callbacks localRender, |
336 final VideoRenderer.Callbacks remoteRender, final VideoCapturer videoCaptu
rer, | 338 final VideoRenderer.Callbacks remoteRender, final VideoCapturer videoCaptu
rer, |
337 final SignalingParameters signalingParameters) { | 339 final SignalingParameters signalingParameters) { |
338 createPeerConnection( | 340 createPeerConnection( |
339 localRender, Collections.singletonList(remoteRender), videoCapturer, sig
nalingParameters); | 341 localRender, Collections.singletonList(remoteRender), videoCapturer, sig
nalingParameters); |
340 } | 342 } |
| 343 |
341 public void createPeerConnection(final VideoRenderer.Callbacks localRender, | 344 public void createPeerConnection(final VideoRenderer.Callbacks localRender, |
342 final List<VideoRenderer.Callbacks> remoteRenders, final VideoCapturer vid
eoCapturer, | 345 final List<VideoRenderer.Callbacks> remoteRenders, final VideoCapturer vid
eoCapturer, |
343 final SignalingParameters signalingParameters) { | 346 final SignalingParameters signalingParameters) { |
344 if (peerConnectionParameters == null) { | 347 if (peerConnectionParameters == null) { |
345 Log.e(TAG, "Creating peer connection without initializing factory."); | 348 Log.e(TAG, "Creating peer connection without initializing factory."); |
346 return; | 349 return; |
347 } | 350 } |
348 this.localRender = localRender; | 351 this.localRender = localRender; |
349 this.remoteRenders = remoteRenders; | 352 this.remoteRenders = remoteRenders; |
350 this.videoCapturer = videoCapturer; | 353 this.videoCapturer = videoCapturer; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 reportError(errorMessage); | 504 reportError(errorMessage); |
502 } | 505 } |
503 }); | 506 }); |
504 | 507 |
505 // Create peer connection factory. | 508 // Create peer connection factory. |
506 PeerConnectionFactory.initializeAndroidGlobals( | 509 PeerConnectionFactory.initializeAndroidGlobals( |
507 context, peerConnectionParameters.videoCodecHwAcceleration); | 510 context, peerConnectionParameters.videoCodecHwAcceleration); |
508 if (options != null) { | 511 if (options != null) { |
509 Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMas
k); | 512 Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMas
k); |
510 } | 513 } |
511 factory = new PeerConnectionFactory(options); | 514 final boolean enableH264HighProfile = |
| 515 peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264_HIGH); |
| 516 factory = new PeerConnectionFactory(options, |
| 517 new HardwareVideoEncoderFactory(rootEglBase.getEglBaseContext(), |
| 518 true /* enableIntelVp8Encoder */, enableH264HighProfile), |
| 519 new HardwareVideoDecoderFactory(rootEglBase.getEglBaseContext())); |
512 Log.d(TAG, "Peer connection factory created."); | 520 Log.d(TAG, "Peer connection factory created."); |
513 } | 521 } |
514 | 522 |
515 private void createMediaConstraintsInternal() { | 523 private void createMediaConstraintsInternal() { |
516 // Create peer connection constraints. | 524 // Create peer connection constraints. |
517 pcConstraints = new MediaConstraints(); | 525 pcConstraints = new MediaConstraints(); |
518 // Enable DTLS for normal calls and disable for loopback calls. | 526 // Enable DTLS for normal calls and disable for loopback calls. |
519 if (peerConnectionParameters.loopback) { | 527 if (peerConnectionParameters.loopback) { |
520 pcConstraints.optional.add( | 528 pcConstraints.optional.add( |
521 new MediaConstraints.KeyValuePair(DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT,
"false")); | 529 new MediaConstraints.KeyValuePair(DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT,
"false")); |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 public void onCreateFailure(final String error) { | 1366 public void onCreateFailure(final String error) { |
1359 reportError("createSDP error: " + error); | 1367 reportError("createSDP error: " + error); |
1360 } | 1368 } |
1361 | 1369 |
1362 @Override | 1370 @Override |
1363 public void onSetFailure(final String error) { | 1371 public void onSetFailure(final String error) { |
1364 reportError("setSDP error: " + error); | 1372 reportError("setSDP error: " + error); |
1365 } | 1373 } |
1366 } | 1374 } |
1367 } | 1375 } |
OLD | NEW |