mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
raop: Send initial timing packet to prime UDP connection tracking
In case the local UDP port is blocked by a firewall by default, send an initial timing packet so the connection tracking will accept the response packages. Otherwise, the connection will fail with an 'RTSP/1.0 500 Internal Server Error' after some timeout. Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/840
This commit is contained in:
parent
58482aa9c5
commit
faac387ce9
1 changed files with 19 additions and 0 deletions
|
|
@ -681,6 +681,18 @@ static size_t handle_udp_timing_packet(pa_raop_client *c, const uint8_t packet[]
|
|||
return written;
|
||||
}
|
||||
|
||||
static void send_initial_udp_timing_packet(pa_raop_client *c) {
|
||||
uint32_t data[6] = { 0 };
|
||||
struct timeval tv;
|
||||
uint64_t initial_time = 0;
|
||||
|
||||
initial_time = timeval_to_ntp(pa_rtclock_get(&tv));
|
||||
data[4] = htonl(initial_time >> 32);
|
||||
data[5] = htonl(initial_time & 0xffffffff);
|
||||
|
||||
send_udp_timing_packet(c, data, initial_time);
|
||||
}
|
||||
|
||||
static int connect_udp_socket(pa_raop_client *c, int fd, uint16_t port) {
|
||||
struct sockaddr_in sa4;
|
||||
#ifdef HAVE_IPV6
|
||||
|
|
@ -1077,6 +1089,13 @@ connect_finish:
|
|||
|
||||
pa_log_debug("Connection established (UDP;control_port=%d;timing_port=%d)", cport, tport);
|
||||
|
||||
/* Send an initial UDP packet so a connection tracking firewall
|
||||
* knows the src_ip:src_port <-> dest_ip:dest_port relation
|
||||
* and accepts the incoming timing packets.
|
||||
*/
|
||||
send_initial_udp_timing_packet(c);
|
||||
pa_log_debug("Sent initial timing packet to UDP port %d", tport);
|
||||
|
||||
if (c->state_callback)
|
||||
c->state_callback(PA_RAOP_CONNECTED, c->state_userdata);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue