Skip to content

Commit

Permalink
chore: update to actual api
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Jan 14, 2025
1 parent dc78582 commit af8f6c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion deps/libjuice
5 changes: 2 additions & 3 deletions include/rtc/global.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ RTC_CPP_EXPORT void Preload();
RTC_CPP_EXPORT std::shared_future<void> Cleanup();

RTC_CPP_EXPORT struct UnhandledStunRequest {
optional<std::string> ufrag;
optional<std::string> pwd;
uint8_t family;
optional<std::string> localUfrag;
optional<std::string> remoteUfrag;
std::string address;
uint16_t port;
};
Expand Down
12 changes: 6 additions & 6 deletions src/global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,13 @@ void SetSctpSettings(SctpSettings s) { impl::Init::Instance().setSctpSettings(st

UnhandledStunRequestCallback unboundStunCallback;

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

(*callback)({
.ufrag = std::string(info->ufrag),
.pwd = std::string(info->pwd),
.family = info->family,
.localUfrag = std::string(info->local_ufrag),
.remoteUfrag = std::string(info->remote_ufrag),
.address = std::string(info->address),
.port = info->port
});
Expand All @@ -115,7 +114,8 @@ void OnUnhandledStunRequest ([[maybe_unused]] std::string host, [[maybe_unused]]
if (callback == NULL) {
PLOG_DEBUG << "Removing unhandled STUN request listener";

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

unboundStunCallback = std::move(callback);

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

0 comments on commit af8f6c8

Please sign in to comment.