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 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, boolean tracing, |
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, |
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; |
| 150 this.tracing = tracing; |
149 this.videoWidth = videoWidth; | 151 this.videoWidth = videoWidth; |
150 this.videoHeight = videoHeight; | 152 this.videoHeight = videoHeight; |
151 this.videoFps = videoFps; | 153 this.videoFps = videoFps; |
152 this.videoStartBitrate = videoStartBitrate; | 154 this.videoStartBitrate = videoStartBitrate; |
153 this.videoCodec = videoCodec; | 155 this.videoCodec = videoCodec; |
154 this.videoCodecHwAcceleration = videoCodecHwAcceleration; | 156 this.videoCodecHwAcceleration = videoCodecHwAcceleration; |
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; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 closeInternal(); | 277 closeInternal(); |
276 } | 278 } |
277 }); | 279 }); |
278 } | 280 } |
279 | 281 |
280 public boolean isVideoCallEnabled() { | 282 public boolean isVideoCallEnabled() { |
281 return videoCallEnabled; | 283 return videoCallEnabled; |
282 } | 284 } |
283 | 285 |
284 private void createPeerConnectionFactoryInternal(Context context) { | 286 private void createPeerConnectionFactoryInternal(Context context) { |
| 287 PeerConnectionFactory.initializeInternalTracer(); |
| 288 if (peerConnectionParameters.tracing) { |
| 289 PeerConnectionFactory.startInternalTracingCapture("/mnt/sdcard/webrtc-trac
e.txt"); |
| 290 } |
285 Log.d(TAG, "Create peer connection factory. Use video: " + | 291 Log.d(TAG, "Create peer connection factory. Use video: " + |
286 peerConnectionParameters.videoCallEnabled); | 292 peerConnectionParameters.videoCallEnabled); |
287 isError = false; | 293 isError = false; |
288 | 294 |
289 // Initialize field trials. | 295 // Initialize field trials. |
290 PeerConnectionFactory.initializeFieldTrials(FIELD_TRIAL_AUTOMATIC_RESIZE); | 296 PeerConnectionFactory.initializeFieldTrials(FIELD_TRIAL_AUTOMATIC_RESIZE); |
291 | 297 |
292 // Check preferred video codec. | 298 // Check preferred video codec. |
293 preferredVideoCodec = VIDEO_CODEC_VP8; | 299 preferredVideoCodec = VIDEO_CODEC_VP8; |
294 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { | 300 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 videoSource = null; | 497 videoSource = null; |
492 } | 498 } |
493 Log.d(TAG, "Closing peer connection factory."); | 499 Log.d(TAG, "Closing peer connection factory."); |
494 if (factory != null) { | 500 if (factory != null) { |
495 factory.dispose(); | 501 factory.dispose(); |
496 factory = null; | 502 factory = null; |
497 } | 503 } |
498 options = null; | 504 options = null; |
499 Log.d(TAG, "Closing peer connection done."); | 505 Log.d(TAG, "Closing peer connection done."); |
500 events.onPeerConnectionClosed(); | 506 events.onPeerConnectionClosed(); |
| 507 PeerConnectionFactory.stopInternalTracingCapture(); |
| 508 PeerConnectionFactory.shutdownInternalTracer(); |
501 } | 509 } |
502 | 510 |
503 public boolean isHDVideo() { | 511 public boolean isHDVideo() { |
504 if (!videoCallEnabled) { | 512 if (!videoCallEnabled) { |
505 return false; | 513 return false; |
506 } | 514 } |
507 int minWidth = 0; | 515 int minWidth = 0; |
508 int minHeight = 0; | 516 int minHeight = 0; |
509 for (KeyValuePair keyValuePair : videoConstraints.mandatory) { | 517 for (KeyValuePair keyValuePair : videoConstraints.mandatory) { |
510 if (keyValuePair.getKey().equals("minWidth")) { | 518 if (keyValuePair.getKey().equals("minWidth")) { |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 public void onCreateFailure(final String error) { | 1050 public void onCreateFailure(final String error) { |
1043 reportError("createSDP error: " + error); | 1051 reportError("createSDP error: " + error); |
1044 } | 1052 } |
1045 | 1053 |
1046 @Override | 1054 @Override |
1047 public void onSetFailure(final String error) { | 1055 public void onSetFailure(final String error) { |
1048 reportError("setSDP error: " + error); | 1056 reportError("setSDP error: " + error); |
1049 } | 1057 } |
1050 } | 1058 } |
1051 } | 1059 } |
OLD | NEW |