Add the url attribute to the IceCandidate (Java Wrapper)

The url of the ICE server is added to the IceCandiate class.
This can be used to tell which server this candidate was gathered from.

BUG=webrtc:7128

Review-Url: https://codereview.webrtc.org/2690593002
Cr-Commit-Position: refs/heads/master@{#16593}
This commit is contained in:
zhihuang
2017-02-13 14:04:50 -08:00
committed by Commit bot
parent 02c739f4ef
commit 8586c8ee88
6 changed files with 23 additions and 13 deletions

View File

@ -187,6 +187,7 @@ public class DirectRTCClient implements AppRTCClient, TCPChannelClient.TCPChanne
jsonPut(json, "label", candidate.sdpMLineIndex);
jsonPut(json, "id", candidate.sdpMid);
jsonPut(json, "candidate", candidate.sdp);
jsonPut(json, "url", candidate.serverUrl);
if (roomState != ConnectionState.CONNECTED) {
reportError("Sending ICE candidate in non connected state.");
@ -336,12 +337,13 @@ public class DirectRTCClient implements AppRTCClient, TCPChannelClient.TCPChanne
jsonPut(json, "label", candidate.sdpMLineIndex);
jsonPut(json, "id", candidate.sdpMid);
jsonPut(json, "candidate", candidate.sdp);
jsonPut(json, "url", candidate.serverUrl);
return json;
}
// Converts a JSON candidate to a Java object.
private static IceCandidate toJavaCandidate(JSONObject json) throws JSONException {
return new IceCandidate(
json.getString("id"), json.getInt("label"), json.getString("candidate"));
return new IceCandidate(json.getString("id"), json.getInt("label"), json.getString("candidate"),
json.getString("url"));
}
}

View File

@ -115,8 +115,8 @@ public class RoomParametersFetcher {
offerSdp = new SessionDescription(
SessionDescription.Type.fromCanonicalForm(messageType), message.getString("sdp"));
} else if (messageType.equals("candidate")) {
IceCandidate candidate = new IceCandidate(
message.getString("id"), message.getInt("label"), message.getString("candidate"));
IceCandidate candidate = new IceCandidate(message.getString("id"),
message.getInt("label"), message.getString("candidate"), message.getString("url"));
iceCandidates.add(candidate);
} else {
Log.e(TAG, "Unknown message: " + messageString);

View File

@ -408,12 +408,13 @@ public class WebSocketRTCClient implements AppRTCClient, WebSocketChannelEvents
jsonPut(json, "label", candidate.sdpMLineIndex);
jsonPut(json, "id", candidate.sdpMid);
jsonPut(json, "candidate", candidate.sdp);
jsonPut(json, "url", candidate.serverUrl);
return json;
}
// Converts a JSON candidate to a Java object.
IceCandidate toJavaCandidate(JSONObject json) throws JSONException {
return new IceCandidate(
json.getString("id"), json.getInt("label"), json.getString("candidate"));
return new IceCandidate(json.getString("id"), json.getInt("label"), json.getString("candidate"),
json.getString("url"));
}
}