blob: 6df71f04e9a5403e2ea06a07461820ec020b3f29 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * 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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00009 */
10
11package org.webrtc;
12
Alex Drake68c2a562019-08-13 15:56:07 -070013import org.webrtc.PeerConnection;
14
henrike@webrtc.org28e20752013-07-10 00:45:36 +000015/**
16 * Representation of a single ICE Candidate, mirroring
17 * {@code IceCandidateInterface} in the C++ API.
18 */
19public class IceCandidate {
20 public final String sdpMid;
21 public final int sdpMLineIndex;
22 public final String sdp;
zhihuang8e32cd22017-02-17 12:45:00 -080023 public final String serverUrl;
Alex Drake68c2a562019-08-13 15:56:07 -070024 public final PeerConnection.AdapterType adapterType;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000025
deadbeefb8567942017-02-13 14:31:38 -080026 public IceCandidate(String sdpMid, int sdpMLineIndex, String sdp) {
henrike@webrtc.org28e20752013-07-10 00:45:36 +000027 this.sdpMid = sdpMid;
28 this.sdpMLineIndex = sdpMLineIndex;
29 this.sdp = sdp;
zhihuang8e32cd22017-02-17 12:45:00 -080030 this.serverUrl = "";
Alex Drake68c2a562019-08-13 15:56:07 -070031 this.adapterType = PeerConnection.AdapterType.UNKNOWN;
zhihuang8e32cd22017-02-17 12:45:00 -080032 }
33
Magnus Jedvert80610c42017-11-25 21:18:34 +010034 @CalledByNative
Alex Drake68c2a562019-08-13 15:56:07 -070035 IceCandidate(String sdpMid, int sdpMLineIndex, String sdp, String serverUrl,
36 PeerConnection.AdapterType adapterType) {
zhihuang8e32cd22017-02-17 12:45:00 -080037 this.sdpMid = sdpMid;
38 this.sdpMLineIndex = sdpMLineIndex;
39 this.sdp = sdp;
40 this.serverUrl = serverUrl;
Alex Drake68c2a562019-08-13 15:56:07 -070041 this.adapterType = adapterType;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000042 }
43
Sami Kalliomäkibde473e2017-10-30 13:34:41 +010044 @Override
henrike@webrtc.org28e20752013-07-10 00:45:36 +000045 public String toString() {
Alex Drake68c2a562019-08-13 15:56:07 -070046 return sdpMid + ":" + sdpMLineIndex + ":" + sdp + ":" + serverUrl + ":"
47 + adapterType.toString();
henrike@webrtc.org28e20752013-07-10 00:45:36 +000048 }
Magnus Jedvert80610c42017-11-25 21:18:34 +010049
50 @CalledByNative
51 String getSdpMid() {
52 return sdpMid;
53 }
54
55 @CalledByNative
56 String getSdp() {
57 return sdp;
58 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +000059}