After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 539372 - udpsrc do not set port properly on anonymous binding
udpsrc do not set port properly on anonymous binding
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal blocker
: 0.10.9
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-06-20 21:22 UTC by Aurelien Grimaud
Modified: 2008-06-25 08:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Aurelien Grimaud 2008-06-20 21:22:35 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.
Comment 1 Sebastian Dröge (slomo) 2008-06-25 06:45:09 UTC
Is this the same as bug #539548 ?
Comment 2 Aurelien Grimaud 2008-06-25 07:48:55 UTC
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.
Comment 3 Sebastian Dröge (slomo) 2008-06-25 08:12:02 UTC
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.