From 9cdf09d1067a434a8847d46a123fd5aa3e224d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 2 Apr 2020 19:42:00 +0300 Subject: [PATCH] threadshare/udpsink: Unconfigure all clients that are removed on clear() Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/101 --- gst-plugin-threadshare/src/udpsink.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst-plugin-threadshare/src/udpsink.rs b/gst-plugin-threadshare/src/udpsink.rs index 1d622b64..3c95f25c 100644 --- a/gst-plugin-threadshare/src/udpsink.rs +++ b/gst-plugin-threadshare/src/udpsink.rs @@ -358,12 +358,15 @@ impl UdpSinkPadHandlerInner { gst_pad: &gst::Pad, clients_to_add: impl Iterator, ) { - Arc::make_mut(&mut self.clients).clear(); + let old_clients = mem::replace(&mut *Arc::make_mut(&mut self.clients), vec![]); self.clients_to_configure = vec![]; self.clients_to_unconfigure = vec![]; for addr in clients_to_add { + if !old_clients.contains(&addr) { + self.clients_to_unconfigure.push(addr); + } self.add_client(gst_pad, addr); } }