Chromium Code Reviews

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java

Issue 1648813004: Remove candidates when doing continual gathering (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix a Windows compiling error Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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 10 matching lines...)
21 import org.webrtc.DataChannel; 21 import org.webrtc.DataChannel;
22 import org.webrtc.EglBase; 22 import org.webrtc.EglBase;
23 import org.webrtc.IceCandidate; 23 import org.webrtc.IceCandidate;
24 import org.webrtc.Logging; 24 import org.webrtc.Logging;
25 import org.webrtc.MediaCodecVideoEncoder; 25 import org.webrtc.MediaCodecVideoEncoder;
26 import org.webrtc.MediaConstraints; 26 import org.webrtc.MediaConstraints;
27 import org.webrtc.MediaConstraints.KeyValuePair; 27 import org.webrtc.MediaConstraints.KeyValuePair;
28 import org.webrtc.MediaStream; 28 import org.webrtc.MediaStream;
29 import org.webrtc.PeerConnection; 29 import org.webrtc.PeerConnection;
30 import org.webrtc.PeerConnection.IceConnectionState; 30 import org.webrtc.PeerConnection.IceConnectionState;
31 import org.webrtc.PeerConnection.ContinualGatheringPolicy;
31 import org.webrtc.PeerConnectionFactory; 32 import org.webrtc.PeerConnectionFactory;
32 import org.webrtc.SdpObserver; 33 import org.webrtc.SdpObserver;
33 import org.webrtc.SessionDescription; 34 import org.webrtc.SessionDescription;
34 import org.webrtc.StatsObserver; 35 import org.webrtc.StatsObserver;
35 import org.webrtc.StatsReport; 36 import org.webrtc.StatsReport;
36 import org.webrtc.VideoCapturerAndroid; 37 import org.webrtc.VideoCapturerAndroid;
37 import org.webrtc.VideoRenderer; 38 import org.webrtc.VideoRenderer;
38 import org.webrtc.VideoSource; 39 import org.webrtc.VideoSource;
39 import org.webrtc.VideoTrack; 40 import org.webrtc.VideoTrack;
40 import org.webrtc.voiceengine.WebRtcAudioManager; 41 import org.webrtc.voiceengine.WebRtcAudioManager;
(...skipping 136 matching lines...)
177 * Callback fired once local SDP is created and set. 178 * Callback fired once local SDP is created and set.
178 */ 179 */
179 public void onLocalDescription(final SessionDescription sdp); 180 public void onLocalDescription(final SessionDescription sdp);
180 181
181 /** 182 /**
182 * Callback fired once local Ice candidate is generated. 183 * Callback fired once local Ice candidate is generated.
183 */ 184 */
184 public void onIceCandidate(final IceCandidate candidate); 185 public void onIceCandidate(final IceCandidate candidate);
185 186
186 /** 187 /**
188 * Callback fired once local ICE candidates are removed.
189 */
190 public void onIceCandidatesRemoved(final IceCandidate[] candidates);
191
192 /**
187 * Callback fired once connection is established (IceConnectionState is 193 * Callback fired once connection is established (IceConnectionState is
188 * CONNECTED). 194 * CONNECTED).
189 */ 195 */
190 public void onIceConnected(); 196 public void onIceConnected();
191 197
192 /** 198 /**
193 * Callback fired once connection is closed (IceConnectionState is 199 * Callback fired once connection is closed (IceConnectionState is
194 * DISCONNECTED). 200 * DISCONNECTED).
195 */ 201 */
196 public void onIceDisconnected(); 202 public void onIceDisconnected();
(...skipping 250 matching lines...)
447 factory.setVideoHwAccelerationOptions(renderEGLContext, renderEGLContext); 453 factory.setVideoHwAccelerationOptions(renderEGLContext, renderEGLContext);
448 } 454 }
449 455
450 PeerConnection.RTCConfiguration rtcConfig = 456 PeerConnection.RTCConfiguration rtcConfig =
451 new PeerConnection.RTCConfiguration(signalingParameters.iceServers); 457 new PeerConnection.RTCConfiguration(signalingParameters.iceServers);
452 // TCP candidates are only useful when connecting to a server that supports 458 // TCP candidates are only useful when connecting to a server that supports
453 // ICE-TCP. 459 // ICE-TCP.
454 rtcConfig.tcpCandidatePolicy = PeerConnection.TcpCandidatePolicy.DISABLED; 460 rtcConfig.tcpCandidatePolicy = PeerConnection.TcpCandidatePolicy.DISABLED;
455 rtcConfig.bundlePolicy = PeerConnection.BundlePolicy.MAXBUNDLE; 461 rtcConfig.bundlePolicy = PeerConnection.BundlePolicy.MAXBUNDLE;
456 rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE; 462 rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE;
463 rtcConfig.continualGatheringPolicy =
464 ContinualGatheringPolicy.GATHER_CONTINUALLY;
pthatcher1 2016/03/01 23:51:54 Should we put this in a different CL?
honghaiz3 2016/03/02 19:06:40 Done.
457 // Use ECDSA encryption. 465 // Use ECDSA encryption.
458 rtcConfig.keyType = PeerConnection.KeyType.ECDSA; 466 rtcConfig.keyType = PeerConnection.KeyType.ECDSA;
459 467
460 peerConnection = factory.createPeerConnection( 468 peerConnection = factory.createPeerConnection(
461 rtcConfig, pcConstraints, pcObserver); 469 rtcConfig, pcConstraints, pcObserver);
462 isInitiator = false; 470 isInitiator = false;
463 471
464 // Set default WebRTC tracing and INFO libjingle logging. 472 // Set default WebRTC tracing and INFO libjingle logging.
465 // NOTE: this _must_ happen while |factory| is alive! 473 // NOTE: this _must_ happen while |factory| is alive!
466 Logging.enableTracing( 474 Logging.enableTracing(
(...skipping 181 matching lines...)
648 if (queuedRemoteCandidates != null) { 656 if (queuedRemoteCandidates != null) {
649 queuedRemoteCandidates.add(candidate); 657 queuedRemoteCandidates.add(candidate);
650 } else { 658 } else {
651 peerConnection.addIceCandidate(candidate); 659 peerConnection.addIceCandidate(candidate);
652 } 660 }
653 } 661 }
654 } 662 }
655 }); 663 });
656 } 664 }
657 665
666 public void removeRemoteIceCandidates(final IceCandidate[] candidates) {
667 executor.execute(new Runnable() {
668 @Override
669 public void run() {
670 if (peerConnection == null || isError) {
671 return;
672 }
673 // Drain the queued remote candidates if there is any so that
674 // they are processed in the proper order.
675 if (queuedRemoteCandidates != null) {
676 drainCandidates();
677 }
678 peerConnection.removeIceCandidates(candidates);
679 }
680 });
681 }
682
658 public void setRemoteDescription(final SessionDescription sdp) { 683 public void setRemoteDescription(final SessionDescription sdp) {
659 executor.execute(new Runnable() { 684 executor.execute(new Runnable() {
660 @Override 685 @Override
661 public void run() { 686 public void run() {
662 if (peerConnection == null || isError) { 687 if (peerConnection == null || isError) {
663 return; 688 return;
664 } 689 }
665 String sdpDescription = sdp.description; 690 String sdpDescription = sdp.description;
666 if (preferIsac) { 691 if (preferIsac) {
667 sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true); 692 sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
(...skipping 249 matching lines...)
917 public void onIceCandidate(final IceCandidate candidate){ 942 public void onIceCandidate(final IceCandidate candidate){
918 executor.execute(new Runnable() { 943 executor.execute(new Runnable() {
919 @Override 944 @Override
920 public void run() { 945 public void run() {
921 events.onIceCandidate(candidate); 946 events.onIceCandidate(candidate);
922 } 947 }
923 }); 948 });
924 } 949 }
925 950
926 @Override 951 @Override
952 public void onIceCandidatesRemoved(final IceCandidate[] candidates) {
953 executor.execute(new Runnable() {
954 @Override
955 public void run() {
956 events.onIceCandidatesRemoved(candidates);
957 }
958 });
959 }
960
961 @Override
927 public void onSignalingChange( 962 public void onSignalingChange(
928 PeerConnection.SignalingState newState) { 963 PeerConnection.SignalingState newState) {
929 Log.d(TAG, "SignalingState: " + newState); 964 Log.d(TAG, "SignalingState: " + newState);
930 } 965 }
931 966
932 @Override 967 @Override
933 public void onIceConnectionChange( 968 public void onIceConnectionChange(
934 final PeerConnection.IceConnectionState newState) { 969 final PeerConnection.IceConnectionState newState) {
935 executor.execute(new Runnable() { 970 executor.execute(new Runnable() {
936 @Override 971 @Override
(...skipping 139 matching lines...)
1076 public void onCreateFailure(final String error) { 1111 public void onCreateFailure(final String error) {
1077 reportError("createSDP error: " + error); 1112 reportError("createSDP error: " + error);
1078 } 1113 }
1079 1114
1080 @Override 1115 @Override
1081 public void onSetFailure(final String error) { 1116 public void onSetFailure(final String error) {
1082 reportError("setSDP error: " + error); 1117 reportError("setSDP error: " + error);
1083 } 1118 }
1084 } 1119 }
1085 } 1120 }
OLDNEW

Powered by Google App Engine