holepunch: Make sure to use the same local address for video&audio

This commit is contained in:
Martin Piatka
2021-06-17 14:19:12 +02:00
parent fc4780acb2
commit cf0d644513
2 changed files with 8 additions and 1 deletions

View File

@@ -152,6 +152,8 @@ static juice_agent_t *create_agent(const struct Holepunch_config *c, void *usr_p
conf.turn_servers = NULL;
conf.turn_servers_count = 0;
conf.bind_address = c->bind_addr;
conf.cb_candidate = on_candidate;
conf.user_ptr = usr_ptr;
@@ -286,7 +288,8 @@ static bool split_host_port(char *pair, int *port){
if(end == colon + 1)
return false;
*port = p;
if(port)
*port = p;
return true;
}
@@ -351,9 +354,11 @@ bool punch_udp(struct Holepunch_config c){
*c.video_rx_port = video_ctx.local_candidate_port;
assert(split_host_port(remote, c.video_tx_port));
assert(split_host_port(local, NULL));
strncpy(c.host_addr, remote, c.host_addr_len);
c.bind_addr = local;
if(!initialize_punch(&audio_ctx, &c, "_audio")){
cleanup_punch(&video_ctx);
return false;

View File

@@ -58,6 +58,8 @@ struct Holepunch_config{
char *host_addr;
size_t host_addr_len;
const char *bind_addr;
const char *coord_srv_addr;
int coord_srv_port;
const char *stun_srv_addr;