Chromium Code Reviews| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 sendPostMessage(MessageType.LEAVE, leaveUrl, null); | 124 sendPostMessage(MessageType.LEAVE, leaveUrl, null); |
| 125 } | 125 } |
| 126 roomState = ConnectionState.CLOSED; | 126 roomState = ConnectionState.CLOSED; |
| 127 if (wsClient != null) { | 127 if (wsClient != null) { |
| 128 wsClient.disconnect(true); | 128 wsClient.disconnect(true); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Helper functions to get connection, post message and leave message URLs | 132 // Helper functions to get connection, post message and leave message URLs |
| 133 private String getConnectionUrl(RoomConnectionParameters connectionParameters) { | 133 private String getConnectionUrl(RoomConnectionParameters connectionParameters) { |
| 134 String url = connectionParameters.roomUrl + "/" + ROOM_JOIN + "/" + connecti onParameters.roomId; | 134 return connectionParameters.roomUrl + "/" + ROOM_JOIN + "/" + connectionPara meters.roomId |
| 135 if (connectionParameters.urlParameters != null) { | 135 + getQueryString(connectionParameters); |
|
magjed_webrtc
2017/05/02 13:14:43
It looks like it would be easier to assign "" to c
oprypin_webrtc
2017/05/02 13:17:37
It's not just a null check - it's also about the "
magjed_webrtc
2017/05/03 07:58:41
Ok, let's do it this way.
| |
| 136 url += "?" + connectionParameters.urlParameters; | |
| 137 } | |
| 138 return url; | |
| 139 } | 136 } |
| 140 | 137 |
| 141 private String getMessageUrl( | 138 private String getMessageUrl( |
| 142 RoomConnectionParameters connectionParameters, SignalingParameters signali ngParameters) { | 139 RoomConnectionParameters connectionParameters, SignalingParameters signali ngParameters) { |
| 143 return connectionParameters.roomUrl + "/" + ROOM_MESSAGE + "/" + connectionP arameters.roomId | 140 return connectionParameters.roomUrl + "/" + ROOM_MESSAGE + "/" + connectionP arameters.roomId |
| 144 + "/" + signalingParameters.clientId; | 141 + "/" + signalingParameters.clientId + getQueryString(connectionParamete rs); |
| 145 } | 142 } |
| 146 | 143 |
| 147 private String getLeaveUrl( | 144 private String getLeaveUrl( |
| 148 RoomConnectionParameters connectionParameters, SignalingParameters signali ngParameters) { | 145 RoomConnectionParameters connectionParameters, SignalingParameters signali ngParameters) { |
| 149 return connectionParameters.roomUrl + "/" + ROOM_LEAVE + "/" + connectionPar ameters.roomId + "/" | 146 return connectionParameters.roomUrl + "/" + ROOM_LEAVE + "/" + connectionPar ameters.roomId + "/" |
| 150 + signalingParameters.clientId; | 147 + signalingParameters.clientId + getQueryString(connectionParameters); |
| 148 } | |
| 149 | |
| 150 private String getQueryString(RoomConnectionParameters connectionParameters) { | |
| 151 if (connectionParameters.urlParameters != null) { | |
| 152 return "?" + connectionParameters.urlParameters; | |
| 153 } else { | |
| 154 return ""; | |
| 155 } | |
| 151 } | 156 } |
| 152 | 157 |
| 153 // Callback issued when room parameters are extracted. Runs on local | 158 // Callback issued when room parameters are extracted. Runs on local |
| 154 // looper thread. | 159 // looper thread. |
| 155 private void signalingParametersReady(final SignalingParameters signalingParam eters) { | 160 private void signalingParametersReady(final SignalingParameters signalingParam eters) { |
| 156 Log.d(TAG, "Room connection completed."); | 161 Log.d(TAG, "Room connection completed."); |
| 157 if (connectionParameters.loopback | 162 if (connectionParameters.loopback |
| 158 && (!signalingParameters.initiator || signalingParameters.offerSdp != nu ll)) { | 163 && (!signalingParameters.initiator || signalingParameters.offerSdp != nu ll)) { |
| 159 reportError("Loopback room is busy."); | 164 reportError("Loopback room is busy."); |
| 160 return; | 165 return; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 jsonPut(json, "candidate", candidate.sdp); | 419 jsonPut(json, "candidate", candidate.sdp); |
| 415 return json; | 420 return json; |
| 416 } | 421 } |
| 417 | 422 |
| 418 // Converts a JSON candidate to a Java object. | 423 // Converts a JSON candidate to a Java object. |
| 419 IceCandidate toJavaCandidate(JSONObject json) throws JSONException { | 424 IceCandidate toJavaCandidate(JSONObject json) throws JSONException { |
| 420 return new IceCandidate( | 425 return new IceCandidate( |
| 421 json.getString("id"), json.getInt("label"), json.getString("candidate")) ; | 426 json.getString("id"), json.getInt("label"), json.getString("candidate")) ; |
| 422 } | 427 } |
| 423 } | 428 } |
| OLD | NEW |