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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 * | 48 * |
49 * <p>All public methods are routed to local looper thread. | 49 * <p>All public methods are routed to local looper thread. |
50 * All PeerConnectionEvents callbacks are invoked from the same looper thread. | 50 * All PeerConnectionEvents callbacks are invoked from the same looper thread. |
51 * This class is a singleton. | 51 * This class is a singleton. |
52 */ | 52 */ |
53 public class PeerConnectionClient { | 53 public class PeerConnectionClient { |
54 public static final String VIDEO_TRACK_ID = "ARDAMSv0"; | 54 public static final String VIDEO_TRACK_ID = "ARDAMSv0"; |
55 public static final String AUDIO_TRACK_ID = "ARDAMSa0"; | 55 public static final String AUDIO_TRACK_ID = "ARDAMSa0"; |
56 private static final String TAG = "PCRTCClient"; | 56 private static final String TAG = "PCRTCClient"; |
57 private static final String FIELD_TRIAL_VP9 = "WebRTC-SupportVP9/Enabled/"; | 57 private static final String FIELD_TRIAL_VP9 = "WebRTC-SupportVP9/Enabled/"; |
| 58 private static final String FIELD_TRIAL_AUTOMATIC_RESIZE = |
| 59 "WebRTC-MediaCodecVideoEncoder-AutomaticResize/Enabled/"; |
58 private static final String VIDEO_CODEC_VP8 = "VP8"; | 60 private static final String VIDEO_CODEC_VP8 = "VP8"; |
59 private static final String VIDEO_CODEC_VP9 = "VP9"; | 61 private static final String VIDEO_CODEC_VP9 = "VP9"; |
60 private static final String VIDEO_CODEC_H264 = "H264"; | 62 private static final String VIDEO_CODEC_H264 = "H264"; |
61 private static final String AUDIO_CODEC_OPUS = "opus"; | 63 private static final String AUDIO_CODEC_OPUS = "opus"; |
62 private static final String AUDIO_CODEC_ISAC = "ISAC"; | 64 private static final String AUDIO_CODEC_ISAC = "ISAC"; |
63 private static final String VIDEO_CODEC_PARAM_START_BITRATE = | 65 private static final String VIDEO_CODEC_PARAM_START_BITRATE = |
64 "x-google-start-bitrate"; | 66 "x-google-start-bitrate"; |
65 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; | 67 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; |
66 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; | 68 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; |
67 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT= "googAutoGainC
ontrol"; | 69 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT= "googAutoGainC
ontrol"; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 278 } |
277 | 279 |
278 public boolean isVideoCallEnabled() { | 280 public boolean isVideoCallEnabled() { |
279 return videoCallEnabled; | 281 return videoCallEnabled; |
280 } | 282 } |
281 | 283 |
282 private void createPeerConnectionFactoryInternal(Context context) { | 284 private void createPeerConnectionFactoryInternal(Context context) { |
283 Log.d(TAG, "Create peer connection factory. Use video: " + | 285 Log.d(TAG, "Create peer connection factory. Use video: " + |
284 peerConnectionParameters.videoCallEnabled); | 286 peerConnectionParameters.videoCallEnabled); |
285 isError = false; | 287 isError = false; |
| 288 |
| 289 // Initialize field trials. |
| 290 String field_trials = FIELD_TRIAL_AUTOMATIC_RESIZE; |
286 // Check if VP9 is used by default. | 291 // Check if VP9 is used by default. |
287 if (videoCallEnabled && peerConnectionParameters.videoCodec != null | 292 if (videoCallEnabled && peerConnectionParameters.videoCodec != null |
288 && peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_VP9)) { | 293 && peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_VP9)) { |
289 PeerConnectionFactory.initializeFieldTrials(FIELD_TRIAL_VP9); | 294 field_trials += FIELD_TRIAL_VP9; |
290 } else { | |
291 PeerConnectionFactory.initializeFieldTrials(null); | |
292 } | 295 } |
| 296 PeerConnectionFactory.initializeFieldTrials(field_trials); |
| 297 |
293 // Check if H.264 is used by default. | 298 // Check if H.264 is used by default. |
294 preferH264 = false; | 299 preferH264 = false; |
295 if (videoCallEnabled && peerConnectionParameters.videoCodec != null | 300 if (videoCallEnabled && peerConnectionParameters.videoCodec != null |
296 && peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264)) { | 301 && peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264)) { |
297 preferH264 = true; | 302 preferH264 = true; |
298 } | 303 } |
299 // Check if ISAC is used by default. | 304 // Check if ISAC is used by default. |
300 preferIsac = false; | 305 preferIsac = false; |
301 if (peerConnectionParameters.audioCodec != null | 306 if (peerConnectionParameters.audioCodec != null |
302 && peerConnectionParameters.audioCodec.equals(AUDIO_CODEC_ISAC)) { | 307 && peerConnectionParameters.audioCodec.equals(AUDIO_CODEC_ISAC)) { |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 public void onCreateFailure(final String error) { | 1032 public void onCreateFailure(final String error) { |
1028 reportError("createSDP error: " + error); | 1033 reportError("createSDP error: " + error); |
1029 } | 1034 } |
1030 | 1035 |
1031 @Override | 1036 @Override |
1032 public void onSetFailure(final String error) { | 1037 public void onSetFailure(final String error) { |
1033 reportError("setSDP error: " + error); | 1038 reportError("setSDP error: " + error); |
1034 } | 1039 } |
1035 } | 1040 } |
1036 } | 1041 } |
OLD | NEW |