[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] raop: Send initial timing packet to prime UDP connection tracking
Tanu Kaskinen
gitlab at gitlab.freedesktop.org
Fri Apr 10 18:44:17 UTC 2020
Tanu Kaskinen pushed to branch master at PulseAudio / pulseaudio
Commits:
faac387c by StefanBruens at 2020-04-10T18:44:13+00: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
- - - - -
1 changed file:
- src/modules/raop/raop-client.c
Changes:
=====================================
src/modules/raop/raop-client.c
=====================================
@@ -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);
}
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/faac387ce9f5b05c6e1d7035e2a9379266ff722e
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/faac387ce9f5b05c6e1d7035e2a9379266ff722e
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20200410/a7bbf89c/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list