From 2ba058d77dd56662d48f55c6c83a0161bb77e03b Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Thu, 19 Sep 2024 15:21:43 -0400 Subject: [PATCH] Only send STUN USE_CANDIDATE if controlling Agent Pion's STUN implementation rejects this as invalid --- src/agent.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/agent.c b/src/agent.c index f2c3aa9..1ff256b 100644 --- a/src/agent.c +++ b/src/agent.c @@ -329,7 +329,9 @@ static void agent_create_binding_request(Agent* agent, StunMessage* msg) { snprintf(username, sizeof(username), "%s:%s", agent->remote_ufrag, agent->local_ufrag); stun_msg_write_attr(msg, STUN_ATTR_TYPE_USERNAME, strlen(username), username); stun_msg_write_attr(msg, STUN_ATTR_TYPE_PRIORITY, 4, (char*)&agent->nominated_pair->priority); - stun_msg_write_attr(msg, STUN_ATTR_TYPE_USE_CANDIDATE, 0, NULL); + if (agent->mode == AGENT_MODE_CONTROLLING) { + stun_msg_write_attr(msg, STUN_ATTR_TYPE_USE_CANDIDATE, 0, NULL); + } stun_msg_write_attr(msg, STUN_ATTR_TYPE_ICE_CONTROLLED, 8, (char*)&tie_breaker); stun_msg_finish(msg, STUN_CREDENTIAL_SHORT_TERM, agent->remote_upwd, strlen(agent->remote_upwd)); }