| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 iceServersFromPCConfigJSON(roomJson.getString("pc_config")); | 132 iceServersFromPCConfigJSON(roomJson.getString("pc_config")); |
| 133 boolean isTurnPresent = false; | 133 boolean isTurnPresent = false; |
| 134 for (PeerConnection.IceServer server : iceServers) { | 134 for (PeerConnection.IceServer server : iceServers) { |
| 135 Log.d(TAG, "IceServer: " + server); | 135 Log.d(TAG, "IceServer: " + server); |
| 136 if (server.uri.startsWith("turn:")) { | 136 if (server.uri.startsWith("turn:")) { |
| 137 isTurnPresent = true; | 137 isTurnPresent = true; |
| 138 break; | 138 break; |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 // Request TURN servers. | 141 // Request TURN servers. |
| 142 if (!isTurnPresent) { | 142 if (!isTurnPresent && roomJson.has("ice_server_url")) { |
| 143 LinkedList<PeerConnection.IceServer> turnServers = | 143 LinkedList<PeerConnection.IceServer> turnServers = |
| 144 requestTurnServers(roomJson.getString("ice_server_url")); | 144 requestTurnServers(roomJson.getString("ice_server_url")); |
| 145 for (PeerConnection.IceServer turnServer : turnServers) { | 145 for (PeerConnection.IceServer turnServer : turnServers) { |
| 146 Log.d(TAG, "TurnServer: " + turnServer); | 146 Log.d(TAG, "TurnServer: " + turnServer); |
| 147 iceServers.add(turnServer); | 147 iceServers.add(turnServer); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 SignalingParameters params = new SignalingParameters( | 151 SignalingParameters params = new SignalingParameters( |
| 152 iceServers, initiator, clientId, wssUrl, wssPostUrl, offerSdp, iceCand
idates); | 152 iceServers, initiator, clientId, wssUrl, wssPostUrl, offerSdp, iceCand
idates); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 return ret; | 209 return ret; |
| 210 } | 210 } |
| 211 | 211 |
| 212 // Return the contents of an InputStream as a String. | 212 // Return the contents of an InputStream as a String. |
| 213 private static String drainStream(InputStream in) { | 213 private static String drainStream(InputStream in) { |
| 214 Scanner s = new Scanner(in).useDelimiter("\\A"); | 214 Scanner s = new Scanner(in).useDelimiter("\\A"); |
| 215 return s.hasNext() ? s.next() : ""; | 215 return s.hasNext() ? s.next() : ""; |
| 216 } | 216 } |
| 217 } | 217 } |
| OLD | NEW |