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

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: Address Alex's comments 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 drainCandidates();
673 peerConnection.removeIceCandidates(candidates);
674 }
675 });
676 }
677
658 public void setRemoteDescription(final SessionDescription sdp) { 678 public void setRemoteDescription(final SessionDescription sdp) {
659 executor.execute(new Runnable() { 679 executor.execute(new Runnable() {
660 @Override 680 @Override
661 public void run() { 681 public void run() {
662 if (peerConnection == null || isError) { 682 if (peerConnection == null || isError) {
663 return; 683 return;
664 } 684 }
665 String sdpDescription = sdp.description; 685 String sdpDescription = sdp.description;
666 if (preferIsac) { 686 if (preferIsac) {
667 sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true); 687 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){ 937 public void onIceCandidate(final IceCandidate candidate){
918 executor.execute(new Runnable() { 938 executor.execute(new Runnable() {
919 @Override 939 @Override
920 public void run() { 940 public void run() {
921 events.onIceCandidate(candidate); 941 events.onIceCandidate(candidate);
922 } 942 }
923 }); 943 });
924 } 944 }
925 945
926 @Override 946 @Override
947 public void onIceCandidatesRemoved(final IceCandidate[] candidates) {
948 executor.execute(new Runnable() {
949 @Override
950 public void run() {
951 events.onIceCandidatesRemoved(candidates);
952 }
953 });
954 }
955
956 @Override
927 public void onSignalingChange( 957 public void onSignalingChange(
928 PeerConnection.SignalingState newState) { 958 PeerConnection.SignalingState newState) {
929 Log.d(TAG, "SignalingState: " + newState); 959 Log.d(TAG, "SignalingState: " + newState);
930 } 960 }
931 961
932 @Override 962 @Override
933 public void onIceConnectionChange( 963 public void onIceConnectionChange(
934 final PeerConnection.IceConnectionState newState) { 964 final PeerConnection.IceConnectionState newState) {
935 executor.execute(new Runnable() { 965 executor.execute(new Runnable() {
936 @Override 966 @Override
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 public void onCreateFailure(final String error) { 1106 public void onCreateFailure(final String error) {
1077 reportError("createSDP error: " + error); 1107 reportError("createSDP error: " + error);
1078 } 1108 }
1079 1109
1080 @Override 1110 @Override
1081 public void onSetFailure(final String error) { 1111 public void onSetFailure(final String error) {
1082 reportError("setSDP error: " + error); 1112 reportError("setSDP error: " + error);
1083 } 1113 }
1084 } 1114 }
1085 } 1115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698