mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
module-rtp-sap: bind transmission socket
Makes packets fly to correct interface
This commit is contained in:
parent
f2ba4caaf0
commit
024dc74e53
1 changed files with 12 additions and 5 deletions
|
|
@ -355,8 +355,10 @@ static bool is_multicast(struct sockaddr *sa, socklen_t salen)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int make_send_socket(struct sockaddr_storage *sa, socklen_t salen,
|
static int make_send_socket(
|
||||||
bool loop, int ttl, char *ifname)
|
struct sockaddr_storage *src, socklen_t src_len,
|
||||||
|
struct sockaddr_storage *sa, socklen_t salen,
|
||||||
|
bool loop, int ttl)
|
||||||
{
|
{
|
||||||
int af, fd, val, res;
|
int af, fd, val, res;
|
||||||
|
|
||||||
|
|
@ -365,6 +367,11 @@ static int make_send_socket(struct sockaddr_storage *sa, socklen_t salen,
|
||||||
pw_log_error("socket failed: %m");
|
pw_log_error("socket failed: %m");
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
if (bind(fd, (struct sockaddr*)src, src_len) < 0) {
|
||||||
|
res = -errno;
|
||||||
|
pw_log_error("bind() failed: %m");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
if (connect(fd, (struct sockaddr*)sa, salen) < 0) {
|
if (connect(fd, (struct sockaddr*)sa, salen) < 0) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
pw_log_error("connect() failed: %m");
|
pw_log_error("connect() failed: %m");
|
||||||
|
|
@ -1217,9 +1224,9 @@ static int start_sap(struct impl *impl)
|
||||||
int fd, res;
|
int fd, res;
|
||||||
struct timespec value, interval;
|
struct timespec value, interval;
|
||||||
|
|
||||||
if ((fd = make_send_socket(&impl->sap_addr, impl->sap_len,
|
if ((fd = make_send_socket(&impl->src_addr, impl->src_len,
|
||||||
impl->mcast_loop, impl->ttl,
|
&impl->sap_addr, impl->sap_len,
|
||||||
impl->ifname)) < 0)
|
impl->mcast_loop, impl->ttl)) < 0)
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
impl->sap_fd = fd;
|
impl->sap_fd = fd;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue