From af5efc4de47285b84d8ce2216985314a3c5699e0 Mon Sep 17 00:00:00 2001 From: cruizba Date: Thu, 24 Feb 2022 21:59:00 +0100 Subject: [PATCH] openvidu-server: Simplify readIceServer method to load OPENVIDU_WEBRTC_ICE_SERVERS --- .../server/config/OpenviduConfig.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java b/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java index d8b4e75e..9be26840 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java +++ b/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java @@ -1192,17 +1192,12 @@ public class OpenviduConfig { String url = null, username = null, credential = null; String[] iceServerPropList = iceServerString.split(","); for (String iceServerProp: iceServerPropList) { - String[] iceServerPropEntry = iceServerProp.split("="); - if (iceServerPropEntry.length == 2) { - if (iceServerProp.startsWith("url=")) { - url = iceServerPropEntry[1]; - } else if (iceServerProp.startsWith("username=")) { - username = iceServerPropEntry[1]; - } else if (iceServerProp.startsWith("credential=")) { - credential = iceServerPropEntry[1]; - } else { - addError(property, "Wrong parameter: " + iceServerProp); - } + if (iceServerProp.startsWith("url=")) { + url = StringUtils.substringAfter(iceServerProp, "url="); + } else if (iceServerProp.startsWith("username=")) { + username = StringUtils.substringAfter(iceServerProp, "username="); + } else if (iceServerProp.startsWith("credential=")) { + credential = StringUtils.substringAfter(iceServerProp, "credential="); } else { addError(property, "Wrong parameter: " + iceServerProp); } @@ -1211,5 +1206,5 @@ public class OpenviduConfig { .url(url).username(username).credential(credential).build(); return iceServerProperties; } - + }