GNOME Bugzilla – Bug 539372
udpsrc do not set port properly on anonymous binding
Last modified: 2008-06-25 08:12:02 UTC
When binding on port 0 (anonymous), port property is not set properly. getsockname must be done when binding anonymous to get port, not only when using provided fd. This breaks rtspsrc.
Is this the same as bug #539548 ?
For the rtsp part of bug #539548, yes, this is the same. Actually, rtsp creates 2 udpsrc. The first one is bound anonymous (port 0) for RTP. The second one for RTCP is bound on port + 1. The port is retrieved from udpsrc0 property port. As it is not set properly on anonymous binding, udpsrc0->port is still 0. GST_DEBUG=udpsrc:4 gst-launch udpsrc port=0 says "bound, on port 0" Then, RTCP port is 1 and trying to bind a socket on port 1 is only allowed for root ! So rtsp element will fail for any non root user. There is just a getsockname to do after the anonymous binding in udpsrc to fix it.
Right, thanks for the pointer :) 2008-06-25 Sebastian Dröge <sebastian.droege@collabora.co.uk> * gst/udp/gstudpsrc.c: (gst_udpsrc_start): Call getsockname() after the call to bind() to get updated values for the port, etc. This fixes the usage of udpsrc on anonymous binding and it's usage by rtspsrc. Fixes bugs #539372, #539548. Thanks to Aurelien Grimaud for pointing out the obvious fix.