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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 * Peer connection client implementation. | 53 * Peer connection client implementation. |
54 * | 54 * |
55 * <p>All public methods are routed to local looper thread. | 55 * <p>All public methods are routed to local looper thread. |
56 * All PeerConnectionEvents callbacks are invoked from the same looper thread. | 56 * All PeerConnectionEvents callbacks are invoked from the same looper thread. |
57 * This class is a singleton. | 57 * This class is a singleton. |
58 */ | 58 */ |
59 public class PeerConnectionClient { | 59 public class PeerConnectionClient { |
60 public static final String VIDEO_TRACK_ID = "ARDAMSv0"; | 60 public static final String VIDEO_TRACK_ID = "ARDAMSv0"; |
61 public static final String AUDIO_TRACK_ID = "ARDAMSa0"; | 61 public static final String AUDIO_TRACK_ID = "ARDAMSa0"; |
62 private static final String TAG = "PCRTCClient"; | 62 private static final String TAG = "PCRTCClient"; |
63 private static final String FIELD_TRIAL_AUTOMATIC_RESIZE = | |
64 "WebRTC-MediaCodecVideoEncoder-AutomaticResize/Enabled/"; | |
65 private static final String VIDEO_CODEC_VP8 = "VP8"; | 63 private static final String VIDEO_CODEC_VP8 = "VP8"; |
66 private static final String VIDEO_CODEC_VP9 = "VP9"; | 64 private static final String VIDEO_CODEC_VP9 = "VP9"; |
67 private static final String VIDEO_CODEC_H264 = "H264"; | 65 private static final String VIDEO_CODEC_H264 = "H264"; |
68 private static final String AUDIO_CODEC_OPUS = "opus"; | 66 private static final String AUDIO_CODEC_OPUS = "opus"; |
69 private static final String AUDIO_CODEC_ISAC = "ISAC"; | 67 private static final String AUDIO_CODEC_ISAC = "ISAC"; |
70 private static final String VIDEO_CODEC_PARAM_START_BITRATE = | 68 private static final String VIDEO_CODEC_PARAM_START_BITRATE = |
71 "x-google-start-bitrate"; | 69 "x-google-start-bitrate"; |
72 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; | 70 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; |
73 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; | 71 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; |
74 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT= "googAutoGainC
ontrol"; | 72 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT= "googAutoGainC
ontrol"; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 if (peerConnectionParameters.tracing) { | 305 if (peerConnectionParameters.tracing) { |
308 PeerConnectionFactory.startInternalTracingCapture( | 306 PeerConnectionFactory.startInternalTracingCapture( |
309 Environment.getExternalStorageDirectory().getAbsolutePath() +
File.separator | 307 Environment.getExternalStorageDirectory().getAbsolutePath() +
File.separator |
310 + "webrtc-trace.txt"); | 308 + "webrtc-trace.txt"); |
311 } | 309 } |
312 Log.d(TAG, "Create peer connection factory. Use video: " + | 310 Log.d(TAG, "Create peer connection factory. Use video: " + |
313 peerConnectionParameters.videoCallEnabled); | 311 peerConnectionParameters.videoCallEnabled); |
314 isError = false; | 312 isError = false; |
315 | 313 |
316 // Initialize field trials. | 314 // Initialize field trials. |
317 PeerConnectionFactory.initializeFieldTrials(FIELD_TRIAL_AUTOMATIC_RESIZE); | 315 PeerConnectionFactory.initializeFieldTrials(""); |
318 | 316 |
319 // Check preferred video codec. | 317 // Check preferred video codec. |
320 preferredVideoCodec = VIDEO_CODEC_VP8; | 318 preferredVideoCodec = VIDEO_CODEC_VP8; |
321 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { | 319 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { |
322 if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_VP9)) { | 320 if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_VP9)) { |
323 preferredVideoCodec = VIDEO_CODEC_VP9; | 321 preferredVideoCodec = VIDEO_CODEC_VP9; |
324 } else if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264)) { | 322 } else if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264)) { |
325 preferredVideoCodec = VIDEO_CODEC_H264; | 323 preferredVideoCodec = VIDEO_CODEC_H264; |
326 } | 324 } |
327 } | 325 } |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 public void onCreateFailure(final String error) { | 1130 public void onCreateFailure(final String error) { |
1133 reportError("createSDP error: " + error); | 1131 reportError("createSDP error: " + error); |
1134 } | 1132 } |
1135 | 1133 |
1136 @Override | 1134 @Override |
1137 public void onSetFailure(final String error) { | 1135 public void onSetFailure(final String error) { |
1138 reportError("setSDP error: " + error); | 1136 reportError("setSDP error: " + error); |
1139 } | 1137 } |
1140 } | 1138 } |
1141 } | 1139 } |
OLD | NEW |