mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int make_send_socket(struct sockaddr_storage *sa, socklen_t salen,
 | 
			
		||||
		bool loop, int ttl, char *ifname)
 | 
			
		||||
static int make_send_socket(
 | 
			
		||||
		struct sockaddr_storage *src, socklen_t src_len,
 | 
			
		||||
		struct sockaddr_storage *sa, socklen_t salen,
 | 
			
		||||
		bool loop, int ttl)
 | 
			
		||||
{
 | 
			
		||||
	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");
 | 
			
		||||
		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) {
 | 
			
		||||
		res = -errno;
 | 
			
		||||
		pw_log_error("connect() failed: %m");
 | 
			
		||||
| 
						 | 
				
			
			@ -1217,9 +1224,9 @@ static int start_sap(struct impl *impl)
 | 
			
		|||
	int fd, res;
 | 
			
		||||
	struct timespec value, interval;
 | 
			
		||||
 | 
			
		||||
	if ((fd = make_send_socket(&impl->sap_addr, impl->sap_len,
 | 
			
		||||
					impl->mcast_loop, impl->ttl,
 | 
			
		||||
					impl->ifname)) < 0)
 | 
			
		||||
	if ((fd = make_send_socket(&impl->src_addr, impl->src_len,
 | 
			
		||||
					&impl->sap_addr, impl->sap_len,
 | 
			
		||||
					impl->mcast_loop, impl->ttl)) < 0)
 | 
			
		||||
		return fd;
 | 
			
		||||
 | 
			
		||||
	impl->sap_fd = fd;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue