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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 * This class is a singleton. | 64 * This class is a singleton. |
65 */ | 65 */ |
66 public class PeerConnectionClient { | 66 public class PeerConnectionClient { |
67 public static final String VIDEO_TRACK_ID = "ARDAMSv0"; | 67 public static final String VIDEO_TRACK_ID = "ARDAMSv0"; |
68 public static final String AUDIO_TRACK_ID = "ARDAMSa0"; | 68 public static final String AUDIO_TRACK_ID = "ARDAMSa0"; |
69 public static final String VIDEO_TRACK_TYPE = "video"; | 69 public static final String VIDEO_TRACK_TYPE = "video"; |
70 private static final String TAG = "PCRTCClient"; | 70 private static final String TAG = "PCRTCClient"; |
71 private static final String VIDEO_CODEC_VP8 = "VP8"; | 71 private static final String VIDEO_CODEC_VP8 = "VP8"; |
72 private static final String VIDEO_CODEC_VP9 = "VP9"; | 72 private static final String VIDEO_CODEC_VP9 = "VP9"; |
73 private static final String VIDEO_CODEC_H264 = "H264"; | 73 private static final String VIDEO_CODEC_H264 = "H264"; |
74 private static final String VIDEO_CODEC_H264_BASELINE = "H264 Baseline"; | |
75 private static final String VIDEO_CODEC_H264_HIGH = "H264 High"; | |
74 private static final String AUDIO_CODEC_OPUS = "opus"; | 76 private static final String AUDIO_CODEC_OPUS = "opus"; |
75 private static final String AUDIO_CODEC_ISAC = "ISAC"; | 77 private static final String AUDIO_CODEC_ISAC = "ISAC"; |
76 private static final String VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start- bitrate"; | 78 private static final String VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start- bitrate"; |
77 private static final String VIDEO_FLEXFEC_FIELDTRIAL = "WebRTC-FlexFEC-03/Enab led/"; | 79 private static final String VIDEO_FLEXFEC_FIELDTRIAL = "WebRTC-FlexFEC-03/Enab led/"; |
78 private static final String VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL = "WebRTC-In telVP8/Enabled/"; | 80 private static final String VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL = "WebRTC-In telVP8/Enabled/"; |
79 private static final String VIDEO_H264_HIGH_PROFILE_FIELDTRIAL = | 81 private static final String VIDEO_H264_HIGH_PROFILE_FIELDTRIAL = |
80 "WebRTC-H264HighProfile/Enabled/"; | 82 "WebRTC-H264HighProfile/Enabled/"; |
81 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; | 83 private static final String AUDIO_CODEC_PARAM_BITRATE = "maxaveragebitrate"; |
82 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc ellation"; | 84 private static final String AUDIO_ECHO_CANCELLATION_CONSTRAINT = "googEchoCanc ellation"; |
83 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT = "googAutoGain Control"; | 85 private static final String AUDIO_AUTO_GAIN_CONTROL_CONSTRAINT = "googAutoGain Control"; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 "Create peer connection factory. Use video: " + peerConnectionParameters .videoCallEnabled); | 375 "Create peer connection factory. Use video: " + peerConnectionParameters .videoCallEnabled); |
374 isError = false; | 376 isError = false; |
375 | 377 |
376 // Initialize field trials. | 378 // Initialize field trials. |
377 String fieldTrials = ""; | 379 String fieldTrials = ""; |
378 if (peerConnectionParameters.videoFlexfecEnabled) { | 380 if (peerConnectionParameters.videoFlexfecEnabled) { |
379 fieldTrials += VIDEO_FLEXFEC_FIELDTRIAL; | 381 fieldTrials += VIDEO_FLEXFEC_FIELDTRIAL; |
380 Log.d(TAG, "Enable FlexFEC field trial."); | 382 Log.d(TAG, "Enable FlexFEC field trial."); |
381 } | 383 } |
382 fieldTrials += VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL; | 384 fieldTrials += VIDEO_VP8_INTEL_HW_ENCODER_FIELDTRIAL; |
383 fieldTrials += VIDEO_H264_HIGH_PROFILE_FIELDTRIAL; | |
384 PeerConnectionFactory.initializeFieldTrials(fieldTrials); | |
385 | 385 |
386 // Check preferred video codec. | 386 // Check preferred video codec. |
387 preferredVideoCodec = VIDEO_CODEC_VP8; | 387 preferredVideoCodec = VIDEO_CODEC_VP8; |
388 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { | 388 if (videoCallEnabled && peerConnectionParameters.videoCodec != null) { |
389 if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_VP9)) { | 389 switch (peerConnectionParameters.videoCodec) { |
390 preferredVideoCodec = VIDEO_CODEC_VP9; | 390 case VIDEO_CODEC_VP8: |
391 } else if (peerConnectionParameters.videoCodec.equals(VIDEO_CODEC_H264)) { | 391 preferredVideoCodec = VIDEO_CODEC_VP8; |
392 preferredVideoCodec = VIDEO_CODEC_H264; | 392 break; |
393 case VIDEO_CODEC_VP9: | |
394 preferredVideoCodec = VIDEO_CODEC_VP9; | |
395 break; | |
396 case VIDEO_CODEC_H264_BASELINE: | |
397 preferredVideoCodec = VIDEO_CODEC_H264; | |
398 break; | |
399 case VIDEO_CODEC_H264_HIGH: | |
400 // TODO(magjed): Strip High from SDP when selecting Baseline instead o f using field trial. | |
401 fieldTrials += VIDEO_H264_HIGH_PROFILE_FIELDTRIAL; | |
402 preferredVideoCodec = VIDEO_CODEC_H264; | |
403 break; | |
404 default: | |
405 preferredVideoCodec = VIDEO_CODEC_VP8; | |
393 } | 406 } |
394 } | 407 } |
395 Log.d(TAG, "Preferred video codec: " + preferredVideoCodec); | 408 Log.d(TAG, "Preferred video codec: " + preferredVideoCodec); |
409 PeerConnectionFactory.initializeFieldTrials(fieldTrials); | |
AlexG
2017/02/13 20:52:57
nit: worth to log fieldTrails value for debug purp
magjed_webrtc
2017/02/14 10:02:09
Done.
| |
396 | 410 |
397 // Check if ISAC is used by default. | 411 // Check if ISAC is used by default. |
398 preferIsac = peerConnectionParameters.audioCodec != null | 412 preferIsac = peerConnectionParameters.audioCodec != null |
399 && peerConnectionParameters.audioCodec.equals(AUDIO_CODEC_ISAC); | 413 && peerConnectionParameters.audioCodec.equals(AUDIO_CODEC_ISAC); |
400 | 414 |
401 // Enable/disable OpenSL ES playback. | 415 // Enable/disable OpenSL ES playback. |
402 if (!peerConnectionParameters.useOpenSLES) { | 416 if (!peerConnectionParameters.useOpenSLES) { |
403 Log.d(TAG, "Disable OpenSL ES audio even if device supports it"); | 417 Log.d(TAG, "Disable OpenSL ES audio even if device supports it"); |
404 WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true /* enable */); | 418 WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true /* enable */); |
405 } else { | 419 } else { |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1282 public void onCreateFailure(final String error) { | 1296 public void onCreateFailure(final String error) { |
1283 reportError("createSDP error: " + error); | 1297 reportError("createSDP error: " + error); |
1284 } | 1298 } |
1285 | 1299 |
1286 @Override | 1300 @Override |
1287 public void onSetFailure(final String error) { | 1301 public void onSetFailure(final String error) { |
1288 reportError("setSDP error: " + error); | 1302 reportError("setSDP error: " + error); |
1289 } | 1303 } |
1290 } | 1304 } |
1291 } | 1305 } |
OLD | NEW |