gst/udp/gstudpsrc.c: OS X's bind() implementation is picky about its addrlen parameter and fails with EINVAL if it is...

Original commit message from CVS:
Patch by: Daniel Franke <df at dfranke dot us>
* gst/udp/gstudpsrc.c: (gst_udpsrc_create), (gst_udpsrc_start):
OS X's bind() implementation is picky about its addrlen parameter and
fails with EINVAL if it is larger than expected for the socket's address
family. Set the length to the expected length instead. Fixes #553191.
This commit is contained in:
Daniel Franke 2008-09-25 10:34:39 +00:00 committed by Wim Taymans
parent bf8777356b
commit edd6239979
2 changed files with 12 additions and 10 deletions

View file

@ -1,3 +1,12 @@
2008-09-25 Wim Taymans <wim.taymans@collabora.co.uk>
Patch by: Daniel Franke <df at dfranke dot us>
* gst/udp/gstudpsrc.c: (gst_udpsrc_create), (gst_udpsrc_start):
OS X's bind() implementation is picky about its addrlen parameter and
fails with EINVAL if it is larger than expected for the socket's address
family. Set the length to the expected length instead. Fixes #553191.
2008-09-23 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_open):

View file

@ -376,26 +376,18 @@ static GstFlowReturn
gst_udpsrc_create (GstPushSrc * psrc, GstBuffer ** buf)
{
GstUDPSrc *udpsrc;
GstNetBuffer *outbuf;
struct sockaddr_storage tmpaddr;
socklen_t len;
guint8 *pktdata;
gint pktsize;
#ifdef G_OS_UNIX
gint readsize;
#elif defined G_OS_WIN32
gulong readsize;
#endif
GstClockTime timeout;
gint ret;
gboolean try_again;
udpsrc = GST_UDPSRC_CAST (psrc);
@ -787,8 +779,9 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
goto setsockopt_error;
GST_DEBUG_OBJECT (src, "binding on port %d", src->port);
if ((ret = bind (src->sock.fd, (struct sockaddr *) &src->myaddr,
sizeof (src->myaddr))) < 0)
/* Mac OS is picky about the size */
len = sizeof (struct sockaddr_in);
if ((ret = bind (src->sock.fd, (struct sockaddr *) &src->myaddr, len)) < 0)
goto bind_error;
len = sizeof (src->myaddr);