| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 import org.webrtc.RtpSender; | 45 import org.webrtc.RtpSender; |
| 46 import org.webrtc.SdpObserver; | 46 import org.webrtc.SdpObserver; |
| 47 import org.webrtc.SessionDescription; | 47 import org.webrtc.SessionDescription; |
| 48 import org.webrtc.StatsObserver; | 48 import org.webrtc.StatsObserver; |
| 49 import org.webrtc.StatsReport; | 49 import org.webrtc.StatsReport; |
| 50 import org.webrtc.VideoCapturer; | 50 import org.webrtc.VideoCapturer; |
| 51 import org.webrtc.VideoRenderer; | 51 import org.webrtc.VideoRenderer; |
| 52 import org.webrtc.VideoSource; | 52 import org.webrtc.VideoSource; |
| 53 import org.webrtc.VideoTrack; | 53 import org.webrtc.VideoTrack; |
| 54 import org.webrtc.voiceengine.WebRtcAudioManager; | 54 import org.webrtc.voiceengine.WebRtcAudioManager; |
| 55 import org.webrtc.voiceengine.WebRtcAudioRecord; |
| 56 import org.webrtc.voiceengine.WebRtcAudioRecord.WebRtcAudioRecordErrorCallback; |
| 55 import org.webrtc.voiceengine.WebRtcAudioUtils; | 57 import org.webrtc.voiceengine.WebRtcAudioUtils; |
| 56 | 58 |
| 57 /** | 59 /** |
| 58 * Peer connection client implementation. | 60 * Peer connection client implementation. |
| 59 * | 61 * |
| 60 * <p>All public methods are routed to local looper thread. | 62 * <p>All public methods are routed to local looper thread. |
| 61 * All PeerConnectionEvents callbacks are invoked from the same looper thread. | 63 * All PeerConnectionEvents callbacks are invoked from the same looper thread. |
| 62 * This class is a singleton. | 64 * This class is a singleton. |
| 63 */ | 65 */ |
| 64 public class PeerConnectionClient { | 66 public class PeerConnectionClient { |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 } | 421 } |
| 420 | 422 |
| 421 if (peerConnectionParameters.disableBuiltInNS) { | 423 if (peerConnectionParameters.disableBuiltInNS) { |
| 422 Log.d(TAG, "Disable built-in NS even if device supports it"); | 424 Log.d(TAG, "Disable built-in NS even if device supports it"); |
| 423 WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true); | 425 WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true); |
| 424 } else { | 426 } else { |
| 425 Log.d(TAG, "Enable built-in NS if device supports it"); | 427 Log.d(TAG, "Enable built-in NS if device supports it"); |
| 426 WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(false); | 428 WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(false); |
| 427 } | 429 } |
| 428 | 430 |
| 431 // Set audio record error callbacks. |
| 432 WebRtcAudioRecord.setErrorCallback(new WebRtcAudioRecordErrorCallback() { |
| 433 @Override |
| 434 public void onWebRtcAudioRecordInitError(String errorMessage) { |
| 435 Log.e(TAG, "onWebRtcAudioRecordInitError: " + errorMessage); |
| 436 reportError(errorMessage); |
| 437 } |
| 438 |
| 439 @Override |
| 440 public void onWebRtcAudioRecordStartError(String errorMessage) { |
| 441 Log.e(TAG, "onWebRtcAudioRecordStartError: " + errorMessage); |
| 442 reportError(errorMessage); |
| 443 } |
| 444 |
| 445 @Override |
| 446 public void onWebRtcAudioRecordError(String errorMessage) { |
| 447 Log.e(TAG, "onWebRtcAudioRecordError: " + errorMessage); |
| 448 reportError(errorMessage); |
| 449 } |
| 450 }); |
| 451 |
| 429 // Create peer connection factory. | 452 // Create peer connection factory. |
| 430 if (!PeerConnectionFactory.initializeAndroidGlobals( | 453 if (!PeerConnectionFactory.initializeAndroidGlobals( |
| 431 context, true, true, peerConnectionParameters.videoCodecHwAccelerati
on)) { | 454 context, true, true, peerConnectionParameters.videoCodecHwAccelerati
on)) { |
| 432 events.onPeerConnectionError("Failed to initializeAndroidGlobals"); | 455 events.onPeerConnectionError("Failed to initializeAndroidGlobals"); |
| 433 } | 456 } |
| 434 if (options != null) { | 457 if (options != null) { |
| 435 Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMas
k); | 458 Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMas
k); |
| 436 } | 459 } |
| 437 this.context = context; | 460 this.context = context; |
| 438 factory = new PeerConnectionFactory(options); | 461 factory = new PeerConnectionFactory(options); |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 public void onCreateFailure(final String error) { | 1277 public void onCreateFailure(final String error) { |
| 1255 reportError("createSDP error: " + error); | 1278 reportError("createSDP error: " + error); |
| 1256 } | 1279 } |
| 1257 | 1280 |
| 1258 @Override | 1281 @Override |
| 1259 public void onSetFailure(final String error) { | 1282 public void onSetFailure(final String error) { |
| 1260 reportError("setSDP error: " + error); | 1283 reportError("setSDP error: " + error); |
| 1261 } | 1284 } |
| 1262 } | 1285 } |
| 1263 } | 1286 } |
| OLD | NEW |