8000 Fix parsing stun configuration (#789) · samhblee/flutter-webrtc@2b573b0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b573b0

Browse files
authored
Fix parsing stun configuration (flutter-webrtc#789)
Code was expecting a stun value to be under key 'url'
1 parent e44812b commit 2b573b0

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

common/cpp/src/flutter_webrtc_base.cc

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -209,25 +209,31 @@ bool FlutterWebRTCBase::CreateIceServers(const EncodableList &iceServersArray,
209209
if (TypeIs<EncodableList>(it->second)) {
210210
const EncodableList urls = GetValue<EncodableList>(it->second);
211211
for (auto url : urls) {
212-
const EncodableMap map = GetValue<EncodableMap>(url);
213-
std::string value;
214-
auto it2 = map.find(EncodableValue("url"));
215-
if (it2 != map.end()) {
216-
value = GetValue<std::string>(it2->second);
217-
if (hasUsernameAndCredential) {
218-
std::string username =
219-
GetValue<std::string>(iceServerMap.find(EncodableValue("username"))
220-
->second);
221-
std::string credential =
222-
GetValue<std::string>(iceServerMap.find(EncodableValue("credential"))
223-
->second);
224-
ice_server.username = username;
225-
ice_server.password = credential;
226-
ice_server.uri = value;
227-
} else {
228-
ice_server.uri = value;
212+
if (TypeIs<EncodableMap>(url)) {
213+
const EncodableMap map = GetValue<EncodableMap>(url);
214+
std::string value;
215+
auto it2 = map.find(EncodableValue("url"));
216+
if (it2 != map.end()) {
217+
value = GetValue<std::string>(it2->second);
218+
if (hasUsernameAndCredential) {
219+
std::string username =
220+
GetValue<std::string>(iceServerMap.find(EncodableValue("username"))
221+
->second);
222+
std::string credential =
223+
GetValue<std::string>(iceServerMap.find(EncodableValue("credential"))
224+
->second);
225+
ice_server.username = username;
226+
ice_server.password = credential;
227+
ice_server.uri = value;
228+
} else {
229+
ice_server.uri = value;
230+
}
229231
}
230232
}
233+
else if (TypeIs<std::string>(url)) {
234+
std::string urlString = GetValue<std::string>(url);
235+
ice_server.uri = urlString;
236+
}
231237
}
232238
}
233239
}

0 commit comments

Comments
 (0)
0