summaryrefslogtreecommitdiffstats
path: root/gst/udp
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2008-09-25 11:30:35 +0000
committerWim Taymans <wim.taymans@gmail.com>2008-09-25 11:30:35 +0000
commit712cd620af861bfef8344cb2febb45942613594b (patch)
treeeeb9b1fc5ed05af15b337b1f87cb58a6c8e30e68 /gst/udp
parentedd6239979fafeaf9735effd452878d79ea5002c (diff)
gst/udp/gstudpsrc.c: Switch on the socket family to get the addrlen size right.
Original commit message from CVS: * gst/udp/gstudpsrc.c: (gst_udpsrc_class_init), (gst_udpsrc_set_uri), (gst_udpsrc_start): Switch on the socket family to get the addrlen size right.
Diffstat (limited to 'gst/udp')
-rw-r--r--gst/udp/gstudpsrc.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c
index 0f2af457..b15ed6ec 100644
--- a/gst/udp/gstudpsrc.c
+++ b/gst/udp/gstudpsrc.c
@@ -247,9 +247,7 @@ static void
gst_udpsrc_class_init (GstUDPSrcClass * klass)
{
GObjectClass *gobject_class;
-
GstBaseSrcClass *gstbasesrc_class;
-
GstPushSrcClass *gstpushsrc_class;
gobject_class = (GObjectClass *) klass;
@@ -582,9 +580,7 @@ static gboolean
gst_udpsrc_set_uri (GstUDPSrc * src, const gchar * uri)
{
gchar *protocol;
-
gchar *location;
-
gchar *colptr;
protocol = gst_uri_get_protocol (uri);
@@ -743,17 +739,11 @@ static gboolean
gst_udpsrc_start (GstBaseSrc * bsrc)
{
guint bc_val;
-
gint reuse;
-
int port;
-
GstUDPSrc *src;
-
gint ret;
-
int rcvsize;
-
guint len;
src = GST_UDPSRC (bsrc);
@@ -779,8 +769,20 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
goto setsockopt_error;
GST_DEBUG_OBJECT (src, "binding on port %d", src->port);
- /* Mac OS is picky about the size */
- len = sizeof (struct sockaddr_in);
+
+ /* Mac OS is picky about the size for the bind so we switch on the family */
+ switch (src->myaddr.ss_family) {
+ case AF_INET:
+ len = sizeof (struct sockaddr_in);
+ break;
+ case AF_INET6:
+ len = sizeof (struct sockaddr_in6);
+ break;
+ default:
+ /* don't know, Screw MacOS and use the full length */
+ len = sizeof (src->myaddr);
+ break;
+ }
if ((ret = bind (src->sock.fd, (struct sockaddr *) &src->myaddr, len)) < 0)
goto bind_error;