From 75fe91c74799910ea23e7041184258c3638c8724 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Tue, 31 Oct 2023 17:36:46 +0100 Subject: [PATCH] rtprecv: detach sockets before attach --- src/rtprecv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rtprecv.c b/src/rtprecv.c index 4273f79544..3b38b522b1 100644 --- a/src/rtprecv.c +++ b/src/rtprecv.c @@ -685,16 +685,16 @@ int rtprecv_start_thread(struct rtp_receiver *rx) if (re_atomic_rlx(&rx->run)) return 0; + udp_thread_detach(rtp_sock(rx->rtp)); + udp_thread_detach(rtcp_sock(rx->rtp)); re_atomic_rlx_set(&rx->run, true); err = thread_create_name(&rx->thr, "RX thread", rtprecv_thread, rx); if (err) { re_atomic_rlx_set(&rx->run, false); - } - else { - udp_thread_detach(rtp_sock(rx->rtp)); - udp_thread_detach(rtcp_sock(rx->rtp)); + udp_thread_attach(rtp_sock(rx->rtp)); + udp_thread_attach(rtcp_sock(rx->rtp)); } return err;