Hi all,
to enhance the performance of my (working) application I’m trying to replace the standard GStreamer elements with their threadshare counterparts (namely udpsrc and udpsink). Unfortunately, I’m running into a few issues that I would like to clarifiy/solve:
-
From what I’ve seen in my tests the ts-udpsink element will always try to use an IPv4 and an IPv6 socket, e.g. it doesn’t seem to be possible to disable IPv6 (which would be unnecessary in my application). Is this correct?
-
The ts-udpsink element seems to never close its socket. I would expect the socket to be closed when the pipeline is set to GST_STATE_NULL (and also unrefed) but I still see the ports open when running netcat, is this intentional? Do I have to take care of that myself? I’m not passing a socket object, I let the ts-udpsink element allocate the socket.
I’m on Linux and my application is written in C. Can anybody with experience using these plugins point me in the right direction?
Edit1: Forgot to mention I’m experiencing this with a build from the main branch revision db2ef187f3c6d96491ae36a824b34a88af386e33 (Mon Dec 1 18:16:03 2025 +0200).
Edit2: Sorry, I was confusing myself, actually both phenomenons are related to ts-udpsink
I was able to answer the first question myself: Yes the ts-udpsink element always uses two sockets, one for IPv4 and one for IPv6. This behaviour is not configurable.
Just in case someone ever comes across this: I also had a look into the second question and came to the conclusion that this is most probably not the intended behaviour.
I filed merge requests addressing both issues:
Thanks for posting this. I have also come across this issue. I think it only happens if you use bind-port.
In addition, if you have a ts-udpsrc listening on the same port and an ICMP Destination Unreachable comes back in response to a sent packet, I get this error:
generic\threadshare\src\udpsrc\imp.rs(682): <gstthreadshare::udpsrc:
:UdpSrcTask as gstthreadshare::runtime::task::TaskImpl>::try_next::{{closure}} (): /GstPipeline:pipeline1/GstTsUdpSrc:udpsrc-rtcp:
streaming stopped, I/O error An existing connection was forcibly closed by the remote host. (os error 10054)
When this happens, the port stays open after the pipeline state is set to NULL. But I’ve also seen the port remain open sporadically with no ICMP packets.
Sorry about the delays! I’m going to address this ASAP. Just got busy with other stuff.
1 Like
With this MR, both issues form the top comment are now fixed and backported to active previous versions.
@mcaracuel could you give it a try and report back if you still run into issues?
@fengalin I still get the streaming error when receiving the ICMP and using bind-port, but when ending the pipeline the port is being freed correctly.
I can give it a try, but the error is coming from ts-udpsrc, not ts-udpsink. I have to use bind-port on the ts-udpsink to make it the same port as ts-udpsrc so the RTP comes and goes in the same port.
Ah right, I missed that part from the logs above. That’s a totally different issue from OP’s question. In the future, please open a separate question. Also provide a minimal reproducer, preferably in Rust.
@mcaracuel I pushed new commits to my branch (also note the matching MR). Unfortunately, I couldn’t test this on Windows and reproducing this on Linux was not immediate. Can you give it a try?
@fengalin The problem still occurs.
The error is this:
0:00:00.395611500 46812 47796 ERROR ts-udpsrc generic\threadshare\src\udpsrc\imp.rs:679:<gstthreadshare::udpsrc:
:UdpSrcTask as gstthreadshare::runtime::task::TaskImpl>::try_next::{{closure}}: socket recv: An existing connection was forcibly closed by the remote host. (os error 10054)
It happens when this ICMP packet comes.
It must be coming in as a different io::ErrorKind in Windows, I would guess io::ErrorKind::Other
@mcaracuel can you replace the line 679 with:
gst::error!(CAT, obj = self.element, "socket recv: {err:?}, code: {:?}", err.raw_os_error());
run the test and paste the resulting message please?
@fengalin It’s a ConnectionReset
0:00:00.448829000 5048 52328 ERROR ts-udpsrc generic\threadshare\src\udpsrc\imp.rs:679:<gstthreadshare::udpsrc:
:UdpSrcTask as gstthreadshare::runtime::task::TaskImpl>::try_next::{{closure}}: socket recv: Os { code: 10054, kind: ConnectionReset, message: “An existing connection was forcibly closed by the remote host.” }, code: Some(10054)
@mcaracuel all right then
. Branch updated!
The MR was merged and backported to active versions.
@mcaracuel please open a new discussion or issue if you run into problems.