Skip to content

Commit af8f6c8

Browse files
committed
chore: update to actual api
1 parent dc78582 commit af8f6c8

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

include/rtc/global.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ RTC_CPP_EXPORT void Preload();
3535
RTC_CPP_EXPORT std::shared_future<void> Cleanup();
3636

3737
RTC_CPP_EXPORT struct UnhandledStunRequest {
38-
optional<std::string> ufrag;
39-
optional<std::string> pwd;
40-
uint8_t family;
38+
optional<std::string> localUfrag;
39+
optional<std::string> remoteUfrag;
4140
std::string address;
4241
uint16_t port;
4342
};

src/global.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,13 @@ void SetSctpSettings(SctpSettings s) { impl::Init::Instance().setSctpSettings(st
9595

9696
UnhandledStunRequestCallback unboundStunCallback;
9797

98-
void InvokeUnhandledStunRequestCallback (const juice_stun_binding_t *info, void *user_ptr) {
98+
void InvokeUnhandledStunRequestCallback (const juice_mux_binding_request *info, void *user_ptr) {
9999
PLOG_DEBUG << "Invoking Unbind STUN listener";
100100
auto callback = static_cast<UnhandledStunRequestCallback *>(user_ptr);
101101

102102
(*callback)({
103-
.ufrag = std::string(info->ufrag),
104-
.pwd = std::string(info->pwd),
105-
.family = info->family,
103+
.localUfrag = std::string(info->local_ufrag),
104+
.remoteUfrag = std::string(info->remote_ufrag),
106105
.address = std::string(info->address),
107106
.port = info->port
108107
});
@@ -115,7 +114,8 @@ void OnUnhandledStunRequest ([[maybe_unused]] std::string host, [[maybe_unused]]
115114
if (callback == NULL) {
116115
PLOG_DEBUG << "Removing unhandled STUN request listener";
117116

118-
if (juice_unbind_stun() < 0) {
117+
// call with NULL callback to unbind
118+
if (juice_mux_listen(host.c_str(), port, NULL, NULL) < 0) {
119119
throw std::runtime_error("Could not unbind STUN listener");
120120
}
121121
unboundStunCallback = NULL;
@@ -131,7 +131,7 @@ void OnUnhandledStunRequest ([[maybe_unused]] std::string host, [[maybe_unused]]
131131

132132
unboundStunCallback = std::move(callback);
133133

134-
if (juice_bind_stun(host.c_str(), port, &InvokeUnhandledStunRequestCallback, &unboundStunCallback) < 0) {
134+
if (juice_mux_listen(host.c_str(), port, &InvokeUnhandledStunRequestCallback, &unboundStunCallback) < 0) {
135135
throw std::invalid_argument("Could add listener for unhandled STUN requests");
136136
}
137137
#endif

0 commit comments

Comments
 (0)