From 7f7821c3f2a976fc20bd23a0aa4cc0db4808f6df Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 4 Apr 2023 17:55:02 +0200 Subject: [PATCH] module-raop: handle 0 timing_port When the timing_port is 0, just don't send out an initial timing packet. When we receive a timing packet, reply to the same address/port that the timing packet was sent from. Fixes #3133 --- src/modules/module-raop-sink.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/modules/module-raop-sink.c b/src/modules/module-raop-sink.c index d3c2cea74..6e1092ad2 100644 --- a/src/modules/module-raop-sink.c +++ b/src/modules/module-raop-sink.c @@ -995,7 +995,7 @@ static int rtsp_setup_reply(void *data, int status, const struct spa_dict *heade break; case PROTO_UDP: - if (control_port == 0 || timing_port == 0) { + if (control_port == 0) { pw_log_error("missing UDP ports in Transport"); return 0; } @@ -1005,11 +1005,17 @@ static int rtsp_setup_reply(void *data, int status, const struct spa_dict *heade return impl->server_fd; if ((impl->control_fd = connect_socket(impl, SOCK_DGRAM, impl->control_fd, control_port)) < 0) return impl->control_fd; - if ((impl->timing_fd = connect_socket(impl, SOCK_DGRAM, impl->timing_fd, timing_port)) < 0) - return impl->timing_fd; + if (timing_port != 0) { + /* it is possible that there is no timing_port. We simply don't + * connect then and don't send an initial timing packet. + * We will reply to received timing packets on the same address we + * received the packet from so we don't really need this. */ + if ((impl->timing_fd = connect_socket(impl, SOCK_DGRAM, impl->timing_fd, timing_port)) < 0) + return impl->timing_fd; - ntp = ntp_now(CLOCK_MONOTONIC); - send_udp_timing_packet(impl, ntp, ntp, NULL, 0); + ntp = ntp_now(CLOCK_MONOTONIC); + send_udp_timing_packet(impl, ntp, ntp, NULL, 0); + } impl->control_source = pw_loop_add_io(impl->loop, impl->control_fd, SPA_IO_IN, false, on_control_source_io, impl);