mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
module-protocol-simple: use interface address as server address
Move the address:port parsing code to the net helper. Add a default address option. Pass the interface address to protocol-simple and use this as the default address for listening. This makes sure that when the user passes tcp:3400 that we don't end up publishing 0.0.0.0:3400 but the actual address of the interface we are listening on so that the snapcast discover can use this to notify the snapcast server. Fixes #4093
This commit is contained in:
parent
38d7dedf0c
commit
f5512e8b88
3 changed files with 88 additions and 43 deletions
|
|
@ -35,6 +35,8 @@
|
|||
#include "module-protocol-pulse/format.h"
|
||||
#include "module-zeroconf-discover/avahi-poll.h"
|
||||
|
||||
#include "network-utils.h"
|
||||
|
||||
/** \page page_module_snapcast_discover Snapcast Discover
|
||||
*
|
||||
* Automatically creates a Snapcast sink device based on zeroconf
|
||||
|
|
@ -465,9 +467,9 @@ static int add_snapcast_stream(struct impl *impl, struct tunnel *t,
|
|||
while (spa_json_get_string(&it[1], v, sizeof(v)) > 0) {
|
||||
t->server_address = strdup(v);
|
||||
snapcast_connect(t);
|
||||
break;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static inline uint32_t format_from_name(const char *name, size_t len)
|
||||
|
|
@ -688,6 +690,7 @@ static void resolver_cb(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiPr
|
|||
ifreq.ifr_ifindex = interface;
|
||||
ioctl(fd, SIOCGIFNAME, &ifreq, sizeof(ifreq));
|
||||
pw_properties_setf(props, "snapcast.ifname", "%s", ifreq.ifr_name);
|
||||
pw_properties_setf(props, "local.ifname", "%s", ifreq.ifr_name);
|
||||
|
||||
struct ifaddrs *if_addr, *ifp;
|
||||
if (getifaddrs(&if_addr) < 0)
|
||||
|
|
@ -711,6 +714,10 @@ static void resolver_cb(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiPr
|
|||
family == AF_INET ? "" : "[",
|
||||
hbuf,
|
||||
family == AF_INET ? "" : "]");
|
||||
pw_properties_setf(props, "local.ifaddress", "%s%s%s",
|
||||
family == AF_INET ? "" : "[",
|
||||
hbuf,
|
||||
family == AF_INET ? "" : "]");
|
||||
} else {
|
||||
pw_log_warn("error: %m %d %s", res, gai_strerror(res));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue