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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 * This class is a singleton. | 67 * This class is a singleton. |
68 */ | 68 */ |
69 public class PeerConnectionClient { | 69 public class PeerConnectionClient { |
70 public static final String VIDEO_TRACK_ID = "ARDAMSv0"; | 70 public static final String VIDEO_TRACK_ID = "ARDAMSv0"; |
71 public static final String AUDIO_TRACK_ID = "ARDAMSa0"; | 71 public static final String AUDIO_TRACK_ID = "ARDAMSa0"; |
72 public static final String VIDEO_TRACK_TYPE = "video"; | 72 public static final String VIDEO_TRACK_TYPE = "video"; |
73 private static final String TAG = "PCRTCClient"; | 73 private static final String TAG = "PCRTCClient"; |
74 private static final String VIDEO_CODEC_VP8 = "VP8"; | 74 private static final String VIDEO_CODEC_VP8 = "VP8"; |
75 private static final String VIDEO_CODEC_VP9 = "VP9"; | 75 private static final String VIDEO_CODEC_VP9 = "VP9"; |
76 private static final String VIDEO_CODEC_H264 = "H264"; | 76 private static final String VIDEO_CODEC_H264 = "H264"; |
| 77 private static final String VIDEO_CODEC_H264_BASELINE = "H264 Baseline"; |
| 78 private static final String VIDEO_CODEC_H264_HIGH = "H264 High"; |
77 private static final String AUDIO_CODEC_OPUS = "opus"; | 79 private static final String AUDIO_CODEC_OPUS = "opus"; |
78 private static final String AUDIO_CODEC_ISAC = "ISAC"; | 80 private static final String AUDIO_CODEC_ISAC = "ISAC"; |
79 private static final String VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start-
bitrate"; | 81 private static final String VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start-
bitrate"; |
80 private static final String VIDEO_FLEXFEC_FIELDTRIAL = "WebRTC-FlexFEC-03/Enab
led/"; | 82 private static final String VIDEO_FLEXFEC_FIELDTRIAL = "WebRTC-FlexFEC-03/Enab
led/"; |
81 private static final String VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL = "WebRTC-In
telVP8/Enabled/"; | 83 private static final String VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL = "WebRTC-In
telVP8/Enabled/"; |
82 private static final String VIDEO_H264_HIGH_PROFILE_FIELDTRIAL = | 84 private static final String VIDEO_H264_HIGH_PROFILE_FIELDTRIAL = |
83 "WebRTC-H264HighProfile/Enabled/"; | 85 "WebRTC-H264HighProfile/Enabled/"; |
84 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; | 86 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; |
85 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; | 87 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc
ellation"; |
86 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT = "googAutoGain
Control"; | 88 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT = "googAutoGain
Control"; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 "Create peer connection factory. Use video: " + peerConnectionParameters
.videoCallEnabled); | 378 "Create peer connection factory. Use video: " + peerConnectionParameters
.videoCallEnabled); |
377 isError = false; | 379 isError = false; |
378 | 380 |
379 // Initialize field trials. | 381 // Initialize field trials. |
380 String fieldTrials = ""; | 382 String fieldTrials = ""; |
381 if (peerConnectionParameters.videoFlexfecEnabled) { | 383 if (peerConnectionParameters.videoFlexfecEnabled) { |
382 fieldTrials += VIDEO_FLEXFEC_FIELDTRIAL; | 384 fieldTrials += VIDEO_FLEXFEC_FIELDTRIAL; |
383 Log.d(TAG, "Enable FlexFEC field trial."); | 385 Log.d(TAG, "Enable FlexFEC field trial."); |
384 } | 386 } |
385 fieldTrials += VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL; | 387 fieldTrials += VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL; |
386 fieldTrials += VIDEO_H264_HIGH_PROFILE_FIELDTRIAL; | |
387 PeerConnectionFactory.initializeFieldTrials(fieldTrials); | |
388 | 388 |
389 // Check preferred video codec. | 389 // Check preferred video codec. |
390 preferredVideoCodec = VIDEO_CODEC_VP8; | 390 preferredVideoCodec = VIDEO_CODEC_VP8; |
391 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { | 391 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { |
392 if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_VP9)) { | 392 switch (peerConnectionParameters.videoCodec) { |
393 preferredVideoCodec = VIDEO_CODEC_VP9; | 393 case VIDEO_CODEC_VP8: |
394 } else if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264)) { | 394 preferredVideoCodec = VIDEO_CODEC_VP8; |
395 preferredVideoCodec = VIDEO_CODEC_H264; | 395 break; |
| 396 case VIDEO_CODEC_VP9: |
| 397 preferredVideoCodec = VIDEO_CODEC_VP9; |
| 398 break; |
| 399 case VIDEO_CODEC_H264_BASELINE: |
| 400 preferredVideoCodec = VIDEO_CODEC_H264; |
| 401 break; |
| 402 case VIDEO_CODEC_H264_HIGH: |
| 403 // TODO(magjed): Strip High from SDP when selecting Baseline instead o
f using field trial. |
| 404 fieldTrials += VIDEO_H264_HIGH_PROFILE_FIELDTRIAL; |
| 405 preferredVideoCodec = VIDEO_CODEC_H264; |
| 406 break; |
| 407 default: |
| 408 preferredVideoCodec = VIDEO_CODEC_VP8; |
396 } | 409 } |
397 } | 410 } |
398 Log.d(TAG, "Preferred video codec: " + preferredVideoCodec); | 411 Log.d(TAG, "Preferred video codec: " + preferredVideoCodec); |
| 412 PeerConnectionFactory.initializeFieldTrials(fieldTrials); |
| 413 Log.d(TAG, "Field trials: " + fieldTrials); |
399 | 414 |
400 // Check if ISAC is used by default. | 415 // Check if ISAC is used by default. |
401 preferIsac = peerConnectionParameters.audioCodec != null | 416 preferIsac = peerConnectionParameters.audioCodec != null |
402 && peerConnectionParameters.audioCodec.equals(AUDIO_CODEC_ISAC); | 417 && peerConnectionParameters.audioCodec.equals(AUDIO_CODEC_ISAC); |
403 | 418 |
404 // Enable/disable OpenSL ES playback. | 419 // Enable/disable OpenSL ES playback. |
405 if (!peerConnectionParameters.useOpenSLES) { | 420 if (!peerConnectionParameters.useOpenSLES) { |
406 Log.d(TAG, "Disable OpenSL ES audio even if device supports it"); | 421 Log.d(TAG, "Disable OpenSL ES audio even if device supports it"); |
407 WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true /* enable */); | 422 WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true /* enable */); |
408 } else { | 423 } else { |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 public void onCreateFailure(final String error) { | 1323 public void onCreateFailure(final String error) { |
1309 reportError("createSDP error: " + error); | 1324 reportError("createSDP error: " + error); |
1310 } | 1325 } |
1311 | 1326 |
1312 @Override | 1327 @Override |
1313 public void onSetFailure(final String error) { | 1328 public void onSetFailure(final String error) { |
1314 reportError("setSDP error: " + error); | 1329 reportError("setSDP error: " + error); |
1315 } | 1330 } |
1316 } | 1331 } |
1317 } | 1332 } |
OLD | NEW |