| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 /** | |
| 192 * Callback fired once connection is established (IceConnectionState is | 187 * Callback fired once connection is established (IceConnectionState is |
| 193 * CONNECTED). | 188 * CONNECTED). |
| 194 */ | 189 */ |
| 195 public void onIceConnected(); | 190 public void onIceConnected(); |
| 196 | 191 |
| 197 /** | 192 /** |
| 198 * Callback fired once connection is closed (IceConnectionState is | 193 * Callback fired once connection is closed (IceConnectionState is |
| 199 * DISCONNECTED). | 194 * DISCONNECTED). |
| 200 */ | 195 */ |
| 201 public void onIceDisconnected(); | 196 public void onIceDisconnected(); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 if (queuedRemoteCandidates != null) { | 648 if (queuedRemoteCandidates != null) { |
| 654 queuedRemoteCandidates.add(candidate); | 649 queuedRemoteCandidates.add(candidate); |
| 655 } else { | 650 } else { |
| 656 peerConnection.addIceCandidate(candidate); | 651 peerConnection.addIceCandidate(candidate); |
| 657 } | 652 } |
| 658 } | 653 } |
| 659 } | 654 } |
| 660 }); | 655 }); |
| 661 } | 656 } |
| 662 | 657 |
| 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 | |
| 678 public void setRemoteDescription(final SessionDescription sdp) { | 658 public void setRemoteDescription(final SessionDescription sdp) { |
| 679 executor.execute(new Runnable() { | 659 executor.execute(new Runnable() { |
| 680 @Override | 660 @Override |
| 681 public void run() { | 661 public void run() { |
| 682 if (peerConnection == null || isError) { | 662 if (peerConnection == null || isError) { |
| 683 return; | 663 return; |
| 684 } | 664 } |
| 685 String sdpDescription = sdp.description; | 665 String sdpDescription = sdp.description; |
| 686 if (preferIsac) { | 666 if (preferIsac) { |
| 687 sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true); | 667 sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 private class PCObserver implements PeerConnection.Observer { | 915 private class PCObserver implements PeerConnection.Observer { |
| 936 @Override | 916 @Override |
| 937 public void onIceCandidate(final IceCandidate candidate){ | 917 public void onIceCandidate(final IceCandidate candidate){ |
| 938 executor.execute(new Runnable() { | 918 executor.execute(new Runnable() { |
| 939 @Override | 919 @Override |
| 940 public void run() { | 920 public void run() { |
| 941 events.onIceCandidate(candidate); | 921 events.onIceCandidate(candidate); |
| 942 } | 922 } |
| 943 }); | 923 }); |
| 944 } | 924 } |
| 945 | |
| 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 | 925 |
| 956 @Override | 926 @Override |
| 957 public void onSignalingChange( | 927 public void onSignalingChange( |
| 958 PeerConnection.SignalingState newState) { | 928 PeerConnection.SignalingState newState) { |
| 959 Log.d(TAG, "SignalingState: " + newState); | 929 Log.d(TAG, "SignalingState: " + newState); |
| 960 } | 930 } |
| 961 | 931 |
| 962 @Override | 932 @Override |
| 963 public void onIceConnectionChange( | 933 public void onIceConnectionChange( |
| 964 final PeerConnection.IceConnectionState newState) { | 934 final PeerConnection.IceConnectionState newState) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 public void onCreateFailure(final String error) { | 1076 public void onCreateFailure(final String error) { |
| 1107 reportError("createSDP error: " + error); | 1077 reportError("createSDP error: " + error); |
| 1108 } | 1078 } |
| 1109 | 1079 |
| 1110 @Override | 1080 @Override |
| 1111 public void onSetFailure(final String error) { | 1081 public void onSetFailure(final String error) { |
| 1112 reportError("setSDP error: " + error); | 1082 reportError("setSDP error: " + error); |
| 1113 } | 1083 } |
| 1114 } | 1084 } |
| 1115 } | 1085 } |
| OLD | NEW |