From 43e7474d2ad6ca6b3b11d1afd90f95691b43f015 Mon Sep 17 00:00:00 2001 Message-Id: <43e7474d2ad6ca6b3b11d1afd90f95691b43f015.1714803255.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 4 May 2020 16:30:57 +0100 Subject: [PATCH] lib/uaudio-rtp.c: Always allow clients to request unicast RTP streams. Organization: Straylight/Edgeware From: Mark Wooding This seems frequently useful. --- lib/uaudio-rtp.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/uaudio-rtp.c b/lib/uaudio-rtp.c index c7be1d7..8559bb2 100644 --- a/lib/uaudio-rtp.c +++ b/lib/uaudio-rtp.c @@ -209,23 +209,23 @@ static size_t rtp_play(void *buffer, size_t nsamples, unsigned flags) { uaudio_schedule_sent(nsamples); return nsamples; } - if(rtp_mode == RTP_REQUEST) { - struct rtp_recipient *r; - struct msghdr m; - memset(&m, 0, sizeof m); - m.msg_iov = vec; - m.msg_iovlen = 2; - pthread_mutex_lock(&rtp_lock); - for(r = rtp_recipient_list; r; r = r->next) { - m.msg_name = &r->sa; - m.msg_namelen = r->sa.ss_family == AF_INET ? - sizeof(struct sockaddr_in) : sizeof (struct sockaddr_in6); - sendmsg(r->sa.ss_family == AF_INET ? rtp_fd4 : rtp_fd6, - &m, MSG_DONTWAIT|MSG_NOSIGNAL); - // TODO similar error handling to other case? - } - pthread_mutex_unlock(&rtp_lock); - } else { + /* Send stuff to explicitly registerd unicast addresses unconditionally */ + struct rtp_recipient *r; + struct msghdr m; + memset(&m, 0, sizeof m); + m.msg_iov = vec; + m.msg_iovlen = 2; + pthread_mutex_lock(&rtp_lock); + for(r = rtp_recipient_list; r; r = r->next) { + m.msg_name = &r->sa; + m.msg_namelen = r->sa.ss_family == AF_INET ? + sizeof(struct sockaddr_in) : sizeof (struct sockaddr_in6); + sendmsg(r->sa.ss_family == AF_INET ? rtp_fd4 : rtp_fd6, + &m, MSG_DONTWAIT|MSG_NOSIGNAL); + // TODO similar error handling to other case? + } + pthread_mutex_unlock(&rtp_lock); + if(rtp_mode != RTP_REQUEST) { int written_bytes; do { written_bytes = writev(rtp_fd, vec, 2); -- [mdw]