Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1172)

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: Added tests, address comments, and merge with head Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 * Callback fired once local SDP is created and set. 177 * Callback fired once local SDP is created and set.
178 */ 178 */
179 public void onLocalDescription(final SessionDescription sdp); 179 public void onLocalDescription(final SessionDescription sdp);
180 180
181 /** 181 /**
182 * Callback fired once local Ice candidate is generated. 182 * Callback fired once local Ice candidate is generated.
183 */ 183 */
184 public void onIceCandidate(final IceCandidate candidate); 184 public void onIceCandidate(final IceCandidate candidate);
185 185
186 /** 186 /**
187 * Callback fired once local ICE candidates are removed.
188 */
189 public void onIceCandidatesRemoved(final IceCandidate[] candidates);
190
191 /**
187 * Callback fired once connection is established (IceConnectionState is 192 * Callback fired once connection is established (IceConnectionState is
188 * CONNECTED). 193 * CONNECTED).
189 */ 194 */
190 public void onIceConnected(); 195 public void onIceConnected();
191 196
192 /** 197 /**
193 * Callback fired once connection is closed (IceConnectionState is 198 * Callback fired once connection is closed (IceConnectionState is
194 * DISCONNECTED). 199 * DISCONNECTED).
195 */ 200 */
196 public void onIceDisconnected(); 201 public void onIceDisconnected();
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 if (queuedRemoteCandidates != null) { 653 if (queuedRemoteCandidates != null) {
649 queuedRemoteCandidates.add(candidate); 654 queuedRemoteCandidates.add(candidate);
650 } else { 655 } else {
651 peerConnection.addIceCandidate(candidate); 656 peerConnection.addIceCandidate(candidate);
652 } 657 }
653 } 658 }
654 } 659 }
655 }); 660 });
656 } 661 }
657 662
663 public void removeRemoteIceCandidates(final IceCandidate[] candidates) {
664 executor.execute(new Runnable() {
665 @Override
666 public void run() {
667 if (peerConnection == null || isError) {
668 return;
669 }
670 // Drain the queued remote candidates if there is any so that
671 // they are processed in the proper order.
672 if (queuedRemoteCandidates != null) {
673 drainCandidates();
674 }
675 peerConnection.removeIceCandidates(candidates);
676 }
677 });
678 }
679
658 public void setRemoteDescription(final SessionDescription sdp) { 680 public void setRemoteDescription(final SessionDescription sdp) {
659 executor.execute(new Runnable() { 681 executor.execute(new Runnable() {
660 @Override 682 @Override
661 public void run() { 683 public void run() {
662 if (peerConnection == null || isError) { 684 if (peerConnection == null || isError) {
663 return; 685 return;
664 } 686 }
665 String sdpDescription = sdp.description; 687 String sdpDescription = sdp.description;
666 if (preferIsac) { 688 if (preferIsac) {
667 sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true); 689 sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 public void onIceCandidate(final IceCandidate candidate){ 939 public void onIceCandidate(final IceCandidate candidate){
918 executor.execute(new Runnable() { 940 executor.execute(new Runnable() {
919 @Override 941 @Override
920 public void run() { 942 public void run() {
921 events.onIceCandidate(candidate); 943 events.onIceCandidate(candidate);
922 } 944 }
923 }); 945 });
924 } 946 }
925 947
926 @Override 948 @Override
949 public void onIceCandidatesRemoved(final IceCandidate[] candidates) {
950 executor.execute(new Runnable() {
951 @Override
952 public void run() {
953 events.onIceCandidatesRemoved(candidates);
954 }
955 });
956 }
957
958 @Override
927 public void onSignalingChange( 959 public void onSignalingChange(
928 PeerConnection.SignalingState newState) { 960 PeerConnection.SignalingState newState) {
929 Log.d(TAG, "SignalingState: " + newState); 961 Log.d(TAG, "SignalingState: " + newState);
930 } 962 }
931 963
932 @Override 964 @Override
933 public void onIceConnectionChange( 965 public void onIceConnectionChange(
934 final PeerConnection.IceConnectionState newState) { 966 final PeerConnection.IceConnectionState newState) {
935 executor.execute(new Runnable() { 967 executor.execute(new Runnable() {
936 @Override 968 @Override
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 public void onCreateFailure(final String error) { 1108 public void onCreateFailure(final String error) {
1077 reportError("createSDP error: " + error); 1109 reportError("createSDP error: " + error);
1078 } 1110 }
1079 1111
1080 @Override 1112 @Override
1081 public void onSetFailure(final String error) { 1113 public void onSetFailure(final String error) {
1082 reportError("setSDP error: " + error); 1114 reportError("setSDP error: " + error);
1083 } 1115 }
1084 } 1116 }
1085 } 1117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698