diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c index 9f58fb4..15bbf0f 100644 --- a/src/modules/raop/raop_client.c +++ b/src/modules/raop/raop_client.c @@ -394,7 +394,7 @@ fail: return -1; } -static int open_udp_socket(pa_raop_client *c, uint16_t port, uint16_t should_bind) { +static int open_udp_socket(pa_raop_client *c, uint16_t remote_port, uint16_t local_port) { struct sockaddr_in sa4; #ifdef HAVE_IPV6 struct sockaddr_in6 sa6; @@ -410,13 +410,13 @@ static int open_udp_socket(pa_raop_client *c, uint16_t port, uint16_t should_bin #endif if (inet_pton(AF_INET, c->host, &sa4.sin_addr) > 0) { sa4.sin_family = af = AF_INET; - sa4.sin_port = htons(port); + sa4.sin_port = htons(remote_port); sa = (struct sockaddr *) &sa4; salen = sizeof(sa4); #ifdef HAVE_IPV6 } else if (inet_pton(AF_INET6, c->host, &sa6.sin6_addr) > 0) { sa6.sin6_family = af = AF_INET6; - sa6.sin6_port = htons(port); + sa6.sin6_port = htons(remote_port); sa = (struct sockaddr *) &sa6; salen = sizeof(sa6); #endif @@ -434,8 +434,8 @@ static int open_udp_socket(pa_raop_client *c, uint16_t port, uint16_t should_bin pa_make_udp_socket_low_delay(fd); pa_make_fd_nonblock(fd); - if (should_bind) { - if (bind_socket(c, fd, port) < 0) { + if (local_port) { + if (bind_socket(c, fd, local_port) < 0) { pa_log("bind_socket() failed: %s", pa_cstrerror(errno)); goto fail; } @@ -446,7 +446,7 @@ static int open_udp_socket(pa_raop_client *c, uint16_t port, uint16_t should_bin goto fail; } - pa_log_debug("Connected to %s on port %d (SOCK_DGRAM)", c->host, port); + pa_log_debug("Connected to %s on port %d (SOCK_DGRAM)", c->host, remote_port); return fd; fail: @@ -689,8 +689,8 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist *he c->timing_port); c->stream_fd = open_udp_socket(c, stream_port, 0); - c->control_fd = open_udp_socket(c, c->control_port, 1); - c->timing_fd = open_udp_socket(c, c->timing_port, 1); + c->control_fd = open_udp_socket(c, c->control_port, DEFAULT_CONTROL_PORT); + c->timing_fd = open_udp_socket(c, c->timing_port, DEFAULT_TIMING_PORT); if (c->stream_fd <= 0) goto error;